Skip to content

Commit 4395540

Browse files
authored
Merge pull request #2177 from apple/revert-2160-moar-xctest
Revert "Support new XCTest overlays"
2 parents 10c8889 + a220f4c commit 4395540

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

Sources/Commands/SwiftTestTool.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,8 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
477477
var env = try constructTestEnvironment(toolchain: try getToolchain(), options: self.options, buildParameters: self.buildParameters())
478478
// Add the sdk platform path if we have it. If this is not present, we
479479
// might always end up failing.
480-
if let sdkPlatformFrameworksPath = Destination.sdkPlatformFrameworkPaths() {
481-
env["DYLD_FRAMEWORK_PATH"] = sdkPlatformFrameworksPath.fwk.pathString
482-
env["DYLD_LIBRARY_PATH"] = sdkPlatformFrameworksPath.lib.pathString
480+
if let sdkPlatformFrameworksPath = Destination.sdkPlatformFrameworkPath() {
481+
env["DYLD_FRAMEWORK_PATH"] = sdkPlatformFrameworksPath.pathString
483482
}
484483
try Process.checkNonZeroExit(arguments: args, environment: env)
485484
// Read the temporary file's content.

Sources/TestSupport/Resources.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class Resources: ManifestResourceProvider {
3636

3737
#if os(macOS)
3838
public var sdkPlatformFrameworksPath: AbsolutePath {
39-
return Destination.sdkPlatformFrameworkPaths()!.fwk
39+
return Destination.sdkPlatformFrameworkPath()!
4040
}
4141
#endif
4242

Sources/Workspace/Destination.swift

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,15 @@ public struct Destination {
103103
}
104104

105105
// Compute common arguments for clang and swift.
106-
var extraCCFlags: [String] = []
107-
var extraSwiftCFlags: [String] = []
108-
if let sdkPaths = Destination.sdkPlatformFrameworkPaths(environment: environment) {
109-
extraCCFlags += ["-F", sdkPaths.fwk.pathString]
110-
extraSwiftCFlags += ["-F", sdkPaths.fwk.pathString]
111-
extraSwiftCFlags += ["-I", sdkPaths.lib.pathString]
112-
extraSwiftCFlags += ["-L", sdkPaths.lib.pathString]
113-
}
106+
// This is currently just frameworks path.
107+
let commonArgs = Destination.sdkPlatformFrameworkPath(environment: environment).map({ ["-F", $0.pathString] }) ?? []
114108

115109
return Destination(
116110
target: hostTargetTriple,
117111
sdk: sdkPath,
118112
binDir: binDir,
119-
extraCCFlags: extraCCFlags,
120-
extraSwiftCFlags: extraSwiftCFlags,
113+
extraCCFlags: commonArgs,
114+
extraSwiftCFlags: commonArgs,
121115
extraCPPFlags: ["-lc++"]
122116
)
123117
#else
@@ -133,31 +127,21 @@ public struct Destination {
133127
}
134128

135129
/// Returns macosx sdk platform framework path.
136-
public static func sdkPlatformFrameworkPaths(
137-
environment: [String:String] = Process.env
138-
) -> (fwk: AbsolutePath, lib: AbsolutePath)? {
130+
public static func sdkPlatformFrameworkPath(environment: [String:String] = Process.env) -> AbsolutePath? {
139131
if let path = _sdkPlatformFrameworkPath {
140132
return path
141133
}
142134
let platformPath = try? Process.checkNonZeroExit(
143-
arguments: ["xcrun", "--sdk", "macosx", "--show-sdk-platform-path"],
144-
environment: environment).spm_chomp()
135+
arguments: ["xcrun", "--sdk", "macosx", "--show-sdk-platform-path"], environment: environment).spm_chomp()
145136

146137
if let platformPath = platformPath, !platformPath.isEmpty {
147-
// For XCTest framework.
148-
let fwk = AbsolutePath(platformPath).appending(
138+
_sdkPlatformFrameworkPath = AbsolutePath(platformPath).appending(
149139
components: "Developer", "Library", "Frameworks")
150-
151-
// For XCTest Swift library.
152-
let lib = AbsolutePath(platformPath).appending(
153-
components: "Developer", "usr", "lib")
154-
155-
_sdkPlatformFrameworkPath = (fwk, lib)
156140
}
157141
return _sdkPlatformFrameworkPath
158142
}
159143
/// Cache storage for sdk platform path.
160-
private static var _sdkPlatformFrameworkPath: (fwk: AbsolutePath, lib: AbsolutePath)? = nil
144+
private static var _sdkPlatformFrameworkPath: AbsolutePath? = nil
161145

162146
/// Target triple for the host system.
163147
private static let hostTargetTriple = Triple.hostTriple

0 commit comments

Comments
 (0)