File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1017,6 +1017,11 @@ fileprivate func constructTestEnvironment(
1017
1017
}
1018
1018
1019
1019
#if !os(macOS)
1020
+ #if os(Windows)
1021
+ if let location = toolchain. manifestResources. xctestLocation {
1022
+ env [ " Path " ] = " \( location. pathString) ; \( env [ " Path " ] ?? " " ) "
1023
+ }
1024
+ #endif
1020
1025
return env
1021
1026
#else
1022
1027
// Fast path when no sanitizers are enabled.
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ public protocol ManifestResourceProvider {
43
43
44
44
/// Extra flags to pass the Swift compiler.
45
45
var swiftCompilerFlags : [ String ] { get }
46
+
47
+ /// XCTest Location
48
+ var xctestLocation : AbsolutePath ? { get }
46
49
}
47
50
48
51
/// Default implemention for the resource provider.
@@ -55,6 +58,10 @@ public extension ManifestResourceProvider {
55
58
var binDir : AbsolutePath ? {
56
59
return nil
57
60
}
61
+
62
+ var xctestLocation : AbsolutePath ? {
63
+ return nil
64
+ }
58
65
}
59
66
60
67
/// Protocol for the manifest loader interface.
Original file line number Diff line number Diff line change @@ -16,19 +16,22 @@ public struct UserManifestResources: ManifestResourceProvider {
16
16
public let swiftCompilerFlags : [ String ]
17
17
public let libDir : AbsolutePath
18
18
public let sdkRoot : AbsolutePath ?
19
+ public let xctestLocation : AbsolutePath ?
19
20
public let binDir : AbsolutePath ?
20
21
21
22
public init (
22
23
swiftCompiler: AbsolutePath ,
23
24
swiftCompilerFlags: [ String ] ,
24
25
libDir: AbsolutePath ,
25
26
sdkRoot: AbsolutePath ? = nil ,
27
+ xctestLocation: AbsolutePath ? = nil ,
26
28
binDir: AbsolutePath ? = nil
27
29
) {
28
30
self . swiftCompiler = swiftCompiler
29
31
self . swiftCompilerFlags = swiftCompilerFlags
30
32
self . libDir = libDir
31
33
self . sdkRoot = sdkRoot
34
+ self . xctestLocation = xctestLocation
32
35
self . binDir = binDir
33
36
}
34
37
Original file line number Diff line number Diff line change @@ -339,11 +339,29 @@ public final class UserToolchain: Toolchain {
339
339
}
340
340
}
341
341
342
+ var xctestLocation : AbsolutePath ?
343
+ #if os(Windows)
344
+ if let DEVELOPER_DIR = ProcessEnv . vars [ " DEVELOPER_DIR " ] ,
345
+ let root = try ? AbsolutePath ( validating: DEVELOPER_DIR)
346
+ . appending ( component: " Platforms " )
347
+ . appending ( component: " Windows.platform " ) {
348
+ if let info = WindowsPlatformInfo ( reading: root. appending ( component: " Info.plist " ) ,
349
+ diagnostics: nil , filesystem: localFileSystem) {
350
+ xctestLocation = root. appending ( component: " Developer " )
351
+ . appending ( component: " Library " )
352
+ . appending ( component: " XCTest- \( info. defaults. xctestVersion) " )
353
+ . appending ( component: " usr " )
354
+ . appending ( component: " bin " )
355
+ }
356
+ }
357
+ #endif
358
+
342
359
manifestResources = UserManifestResources (
343
360
swiftCompiler: swiftCompilers. manifest,
344
361
swiftCompilerFlags: self . extraSwiftCFlags,
345
362
libDir: pdLibDir,
346
363
sdkRoot: self . destination. sdk,
364
+ xctestLocation: xctestLocation,
347
365
// Set the bin directory if we don't have a lib dir.
348
366
binDir: localFileSystem. exists ( pdLibDir) ? nil : binDir
349
367
)
You can’t perform that action at this time.
0 commit comments