Loading pkgs/development/compilers/swift/swiftpm/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ let substituteInPlace Sources/PackageModel/UserToolchain.swift \ --replace-fail \ 'librariesPath = applicationPath.parentDirectory' \ "librariesPath = AbsolutePath(\"$out\")" "librariesPath = try AbsolutePath(validating: \"$out\")" # Fix case-sensitivity issues. # Upstream PR: https://github.com/apple/swift-package-manager/pull/6500 Loading pkgs/development/compilers/swift/swiftpm/patches/cmake-disable-rpath.patch +4 −4 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ Disable rpath for the bootstrap build with CMake. --- a/Sources/PackageDescription/CMakeLists.txt +++ b/Sources/PackageDescription/CMakeLists.txt @@ -31,14 +31,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface) target_compile_options(PackageDescription PUBLIC $<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>) @@ -27,14 +27,11 @@ $<$<COMPILE_LANGUAGE:Swift>:-package-description-version$<SEMICOLON>999.0>) if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) - target_link_options(PackageDescription PRIVATE - "SHELL:-Xlinker -install_name -Xlinker @rpath/libPackageDescription.dylib") endif() Loading pkgs/development/compilers/swift/swiftpm/patches/disable-index-store.patch +3 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ Clang. Make it opt-in by default. (It is assumed the `target.type == test` check is for Xcode support, because there is no evidence of it in swift-corelibs-xctest.) --- a/Sources/Build/BuildPlan.swift +++ b/Sources/Build/BuildPlan.swift @@ -103,14 +103,7 @@ extension BuildParameters { --- a/Sources/Build/BuildPlan/BuildPlan.swift +++ b/Sources/Build/BuildPlan/BuildPlan.swift @@ -111,14 +111,7 @@ case .off: addIndexStoreArguments = false case .auto: Loading pkgs/development/compilers/swift/swiftpm/patches/disable-sandbox.patch +9 −3 Original line number Diff line number Diff line Loading @@ -2,13 +2,18 @@ Nix may already sandbox the build, in which case sandbox_apply will fail. --- a/Sources/Basics/Sandbox.swift +++ b/Sources/Basics/Sandbox.swift @@ -33,12 +33,14 @@ public enum Sandbox { readOnlyDirectories: [AbsolutePath] = [] @@ -57,6 +57,8 @@ allowNetworkConnections: [SandboxNetworkPermission] = [] ) throws -> [String] { #if os(macOS) + let env = ProcessInfo.processInfo.environment + if env["NIX_BUILD_TOP"] == nil || env["IN_NIX_SHELL"] != nil { let profile = try macOSSandboxProfile(strictness: strictness, writableDirectories: writableDirectories, readOnlyDirectories: readOnlyDirectories) let profile = try macOSSandboxProfile( fileSystem: fileSystem, strictness: strictness, @@ -65,10 +67,10 @@ allowNetworkConnections: allowNetworkConnections ) return ["/usr/bin/sandbox-exec", "-p", profile] + command - #else + } Loading @@ -19,3 +24,4 @@ Nix may already sandbox the build, in which case sandbox_apply will fail. } /// Basic strictness level of a sandbox applied to a command line. pkgs/development/compilers/swift/swiftpm/patches/disable-xctest.patch +4 −27 Original line number Diff line number Diff line Loading @@ -3,35 +3,12 @@ command-line runner available, so disable support. --- a/Sources/Commands/Utilities/TestingSupport.swift +++ b/Sources/Commands/Utilities/TestingSupport.swift @@ -72,7 +72,7 @@ enum TestingSupport { /// - Returns: Array of TestSuite static func getTestSuites(fromTestAt path: AbsolutePath, swiftTool: SwiftTool, enableCodeCoverage: Bool, sanitizers: [Sanitizer]) throws -> [TestSuite] { @@ -105,7 +105,7 @@ ) throws -> [TestSuite] { // Run the correct tool. var args = [String]() - #if os(macOS) + #if false let data: String = try withTemporaryFile { tempFile in let args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString] args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString] var env = try Self.constructTestEnvironment( --- a/Sources/swiftpm-xctest-helper/main.swift +++ b/Sources/swiftpm-xctest-helper/main.swift @@ -11,8 +11,11 @@ //===----------------------------------------------------------------------===// #if os(macOS) -import XCTest import func Darwin.C.exit +print("Not supported in Nix.") +exit(1) +#if false +import XCTest /// A helper tool to get list of tests from a XCTest Bundle on macOS. /// @@ -134,6 +137,7 @@ do { exit(1) } +#endif // nix #else #if os(Windows) Loading
pkgs/development/compilers/swift/swiftpm/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ let substituteInPlace Sources/PackageModel/UserToolchain.swift \ --replace-fail \ 'librariesPath = applicationPath.parentDirectory' \ "librariesPath = AbsolutePath(\"$out\")" "librariesPath = try AbsolutePath(validating: \"$out\")" # Fix case-sensitivity issues. # Upstream PR: https://github.com/apple/swift-package-manager/pull/6500 Loading
pkgs/development/compilers/swift/swiftpm/patches/cmake-disable-rpath.patch +4 −4 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ Disable rpath for the bootstrap build with CMake. --- a/Sources/PackageDescription/CMakeLists.txt +++ b/Sources/PackageDescription/CMakeLists.txt @@ -31,14 +31,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface) target_compile_options(PackageDescription PUBLIC $<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>) @@ -27,14 +27,11 @@ $<$<COMPILE_LANGUAGE:Swift>:-package-description-version$<SEMICOLON>999.0>) if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) - target_link_options(PackageDescription PRIVATE - "SHELL:-Xlinker -install_name -Xlinker @rpath/libPackageDescription.dylib") endif() Loading
pkgs/development/compilers/swift/swiftpm/patches/disable-index-store.patch +3 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ Clang. Make it opt-in by default. (It is assumed the `target.type == test` check is for Xcode support, because there is no evidence of it in swift-corelibs-xctest.) --- a/Sources/Build/BuildPlan.swift +++ b/Sources/Build/BuildPlan.swift @@ -103,14 +103,7 @@ extension BuildParameters { --- a/Sources/Build/BuildPlan/BuildPlan.swift +++ b/Sources/Build/BuildPlan/BuildPlan.swift @@ -111,14 +111,7 @@ case .off: addIndexStoreArguments = false case .auto: Loading
pkgs/development/compilers/swift/swiftpm/patches/disable-sandbox.patch +9 −3 Original line number Diff line number Diff line Loading @@ -2,13 +2,18 @@ Nix may already sandbox the build, in which case sandbox_apply will fail. --- a/Sources/Basics/Sandbox.swift +++ b/Sources/Basics/Sandbox.swift @@ -33,12 +33,14 @@ public enum Sandbox { readOnlyDirectories: [AbsolutePath] = [] @@ -57,6 +57,8 @@ allowNetworkConnections: [SandboxNetworkPermission] = [] ) throws -> [String] { #if os(macOS) + let env = ProcessInfo.processInfo.environment + if env["NIX_BUILD_TOP"] == nil || env["IN_NIX_SHELL"] != nil { let profile = try macOSSandboxProfile(strictness: strictness, writableDirectories: writableDirectories, readOnlyDirectories: readOnlyDirectories) let profile = try macOSSandboxProfile( fileSystem: fileSystem, strictness: strictness, @@ -65,10 +67,10 @@ allowNetworkConnections: allowNetworkConnections ) return ["/usr/bin/sandbox-exec", "-p", profile] + command - #else + } Loading @@ -19,3 +24,4 @@ Nix may already sandbox the build, in which case sandbox_apply will fail. } /// Basic strictness level of a sandbox applied to a command line.
pkgs/development/compilers/swift/swiftpm/patches/disable-xctest.patch +4 −27 Original line number Diff line number Diff line Loading @@ -3,35 +3,12 @@ command-line runner available, so disable support. --- a/Sources/Commands/Utilities/TestingSupport.swift +++ b/Sources/Commands/Utilities/TestingSupport.swift @@ -72,7 +72,7 @@ enum TestingSupport { /// - Returns: Array of TestSuite static func getTestSuites(fromTestAt path: AbsolutePath, swiftTool: SwiftTool, enableCodeCoverage: Bool, sanitizers: [Sanitizer]) throws -> [TestSuite] { @@ -105,7 +105,7 @@ ) throws -> [TestSuite] { // Run the correct tool. var args = [String]() - #if os(macOS) + #if false let data: String = try withTemporaryFile { tempFile in let args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString] args = [try Self.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString] var env = try Self.constructTestEnvironment( --- a/Sources/swiftpm-xctest-helper/main.swift +++ b/Sources/swiftpm-xctest-helper/main.swift @@ -11,8 +11,11 @@ //===----------------------------------------------------------------------===// #if os(macOS) -import XCTest import func Darwin.C.exit +print("Not supported in Nix.") +exit(1) +#if false +import XCTest /// A helper tool to get list of tests from a XCTest Bundle on macOS. /// @@ -134,6 +137,7 @@ do { exit(1) } +#endif // nix #else #if os(Windows)