From de2be705dee6aa647a34ed7eada99224eb1e38c8 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Thu, 26 Jun 2025 07:40:34 -0700 Subject: [PATCH] Remove the support for `CURRENT_SDK` (#251) This PR removes the no longer needed support for `CURRENT_SDK`. --- .github/workflows/common.yml | 3 --- Makefile | 23 +++++++------------ Sources/CLI/Application.swift | 3 --- .../NetworkVmnet/NetworkVmnetHelper.swift | 6 +---- .../NonisolatedInterfaceStrategy.swift | 2 -- .../RuntimeLinux/RuntimeLinuxHelper.swift | 4 ---- .../ReservedVmnetNetwork.swift | 16 ++----------- scripts/make-docs.sh | 3 --- 8 files changed, 11 insertions(+), 49 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 9c6aac1d..855b014f 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -17,8 +17,6 @@ jobs: permissions: contents: read packages: read - env: - CURRENT_SDK: y steps: - name: Checkout repository uses: actions/checkout@v4 @@ -73,7 +71,6 @@ jobs: make test cleancontent install-kernel integration env: DEVELOPER_DIR: "/Applications/Xcode_26.b1.app/Contents/Developer" - CURRENT_SDK: y # explicitly repeated due to local env block - name: Save documentation artifact uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index 114b3997..c34170de 100644 --- a/Makefile +++ b/Makefile @@ -28,12 +28,6 @@ DSYM_DIR := bin/$(BUILD_CONFIGURATION)/bundle/container-dSYM DSYM_PATH := bin/$(BUILD_CONFIGURATION)/bundle/container-dSYM.zip CODESIGN_OPTS ?= --force --sign - --timestamp=none -ifeq (,$(CURRENT_SDK)) - CURRENT_SDK_ARGS := -else - CURRENT_SDK_ARGS := -Xswiftc -DCURRENT_SDK -endif - MACOS_VERSION := $(shell sw_vers -productVersion) MACOS_MAJOR := $(shell echo $(MACOS_VERSION) | cut -d. -f1) @@ -49,8 +43,7 @@ all: init-block .PHONY: build build: @echo Building container binaries... - @#Remove this when the updated macOS SDK is available publicly - $(SWIFT) build -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) ; \ + @$(SWIFT) build -c $(BUILD_CONFIGURATION) .PHONY: container container: build @@ -126,7 +119,7 @@ dsym: .PHONY: test test: - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --skip TestCLI + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --skip TestCLI .PHONY: install-kernel install-kernel: @@ -143,12 +136,12 @@ integration: init-block @echo "Removing any existing containers" @bin/container rm --all @echo "Starting CLI integration tests" - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunLifecycle - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIExecCommand - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunCommand - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIImagesCommand - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIRunBase - @$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --filter TestCLIBuildBase + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunLifecycle + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIExecCommand + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunCommand + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIImagesCommand + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIRunBase + @$(SWIFT) test -c $(BUILD_CONFIGURATION) --filter TestCLIBuildBase @echo Ensuring apiserver stopped after the CLI integration tests... @scripts/ensure-container-stopped.sh diff --git a/Sources/CLI/Application.swift b/Sources/CLI/Application.swift index cd7c22fb..b5cb921f 100644 --- a/Sources/CLI/Application.swift +++ b/Sources/CLI/Application.swift @@ -302,9 +302,6 @@ extension Application { #if DEBUG versionDetails["build"] = "debug" #endif - #if CURRENT_SDK - versionDetails["sdk"] = "macOS 15" - #endif let gitCommit = { let sha = get_git_commit().map { String(cString: $0) } guard let sha else { diff --git a/Sources/Helpers/NetworkVmnet/NetworkVmnetHelper.swift b/Sources/Helpers/NetworkVmnet/NetworkVmnetHelper.swift index 716f0416..acbfb7af 100644 --- a/Sources/Helpers/NetworkVmnet/NetworkVmnetHelper.swift +++ b/Sources/Helpers/NetworkVmnet/NetworkVmnetHelper.swift @@ -105,15 +105,11 @@ extension NetworkVmnetHelper { } private static func createNetwork(configuration: NetworkConfiguration, log: Logger) throws -> Network { - guard #available(macOS 16, *) else { + guard #available(macOS 26, *) else { return try AllocationOnlyVmnetNetwork(configuration: configuration, log: log) } - #if !CURRENT_SDK return try ReservedVmnetNetwork(configuration: configuration, log: log) - #else - return try AllocationOnlyVmnetNetwork(configuration: configuration, log: log) - #endif } } diff --git a/Sources/Helpers/RuntimeLinux/NonisolatedInterfaceStrategy.swift b/Sources/Helpers/RuntimeLinux/NonisolatedInterfaceStrategy.swift index 467f1c6d..5a0485c5 100644 --- a/Sources/Helpers/RuntimeLinux/NonisolatedInterfaceStrategy.swift +++ b/Sources/Helpers/RuntimeLinux/NonisolatedInterfaceStrategy.swift @@ -23,7 +23,6 @@ import Logging import Virtualization import vmnet -#if !CURRENT_SDK /// Interface strategy for containers that use macOS's custom network feature. @available(macOS 26, *) struct NonisolatedInterfaceStrategy: InterfaceStrategy { @@ -47,4 +46,3 @@ struct NonisolatedInterfaceStrategy: InterfaceStrategy { return NATNetworkInterface(address: attachment.address, gateway: attachment.gateway, reference: networkRef) } } -#endif diff --git a/Sources/Helpers/RuntimeLinux/RuntimeLinuxHelper.swift b/Sources/Helpers/RuntimeLinux/RuntimeLinuxHelper.swift index 6bd7a160..0529c562 100644 --- a/Sources/Helpers/RuntimeLinux/RuntimeLinuxHelper.swift +++ b/Sources/Helpers/RuntimeLinux/RuntimeLinuxHelper.swift @@ -63,15 +63,11 @@ struct RuntimeLinuxHelper: AsyncParsableCommand { log.info("configuring XPC server") let interfaceStrategy: any InterfaceStrategy - #if !CURRENT_SDK if #available(macOS 26, *) { interfaceStrategy = NonisolatedInterfaceStrategy(log: log) } else { interfaceStrategy = IsolatedInterfaceStrategy() } - #else - interfaceStrategy = IsolatedInterfaceStrategy() - #endif let server = SandboxService(root: .init(fileURLWithPath: root), interfaceStrategy: interfaceStrategy, log: log) let xpc = XPCServer( identifier: machServiceLabel, diff --git a/Sources/Services/ContainerNetworkService/ReservedVmnetNetwork.swift b/Sources/Services/ContainerNetworkService/ReservedVmnetNetwork.swift index 624c8718..54287cfa 100644 --- a/Sources/Services/ContainerNetworkService/ReservedVmnetNetwork.swift +++ b/Sources/Services/ContainerNetworkService/ReservedVmnetNetwork.swift @@ -26,9 +26,8 @@ import SystemConfiguration import XPC import vmnet -#if !CURRENT_SDK /// Creates a vmnet network with reservation APIs. -@available(macOS 16, *) +@available(macOS 26, *) public final class ReservedVmnetNetwork: Network { @SendableProperty private var _state: NetworkState @@ -61,7 +60,7 @@ public final class ReservedVmnetNetwork: Network { } public nonisolated func withAdditionalData(_ handler: (XPCMessage?) throws -> Void) throws { - try networkLock.lock { + try networkLock.withLock { try handler(network.map { try Self.serialize_network_ref(ref: $0) }) } } @@ -149,14 +148,3 @@ public final class ReservedVmnetNetwork: Network { ) } } - -extension NSLock { - /// lock during the execution of the provided function - fileprivate func lock(_ fn: () throws -> T) rethrows -> T { - self.lock() - defer { self.unlock() } - - return try fn() - } -} -#endif diff --git a/scripts/make-docs.sh b/scripts/make-docs.sh index 2e07c288..a75643d3 100755 --- a/scripts/make-docs.sh +++ b/scripts/make-docs.sh @@ -14,9 +14,6 @@ # limitations under the License. opts=() -if [ ! -z "${CURRENT_SDK}" ] ; then - opts+=("-Xswiftc" "-DCURRENT_SDK") -fi opts+=("--allow-writing-to-directory" "$1") opts+=("generate-documentation") opts+=("--target" "ContainerSandboxService")