about summary refs log tree commit diff
path: root/pkgs/development/compilers/swift/swiftpm/patches/disable-xctest.patch
blob: e24d154d2987370d06187ada52e6bdc37dc5d0a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
XCTest is not fully open-source, only the Swift library parts. We don't have a
command-line runner available, so disable support.

--- a/Sources/Commands/TestingSupport.swift
+++ b/Sources/Commands/TestingSupport.swift
@@ -60,7 +60,7 @@ enum TestingSupport {
     /// - Returns: Array of TestSuite
     static func getTestSuites(fromTestAt path: AbsolutePath, swiftTool: SwiftTool, swiftOptions: SwiftToolOptions) throws -> [TestSuite] {
         // Run the correct tool.
-        #if os(macOS)
+        #if false
         let data: String = try withTemporaryFile { tempFile in
             let args = [try TestingSupport.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
             var env = try TestingSupport.constructTestEnvironment(toolchain: try swiftTool.getToolchain(), options: swiftOptions, buildParameters: swiftTool.buildParametersForTest())
--- a/Sources/swiftpm-xctest-helper/main.swift
+++ b/Sources/swiftpm-xctest-helper/main.swift
@@ -9,8 +9,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.
 ///
@@ -132,6 +135,7 @@ do {
     exit(1)
 }
 
+#endif // nix
 #else
 
 #if os(Windows)
--- a/Sources/PackageModel/Destination.swift
+++ b/Sources/PackageModel/Destination.swift
@@ -174,7 +174,7 @@ public struct Destination: Encodable, Equatable {
             arguments: ["/usr/bin/xcrun", "--sdk", "macosx", "--show-sdk-platform-path"],
             environment: environment).spm_chomp()

-        if let platformPath = platformPath, !platformPath.isEmpty {
+        if let platformPath = platformPath, !platformPath.isEmpty && !platformPath.starts(with: "@storeDir@") {
             // For XCTest framework.
             let fwk = AbsolutePath(platformPath).appending(
                 components: "Developer", "Library", "Frameworks")