Skip to content

Revert "Support new XCTest overlays" #2177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sources/Commands/SwiftTestTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,8 @@ public class SwiftTestTool: SwiftTool<TestToolOptions> {
var env = try constructTestEnvironment(toolchain: try getToolchain(), options: self.options, buildParameters: self.buildParameters())
// Add the sdk platform path if we have it. If this is not present, we
// might always end up failing.
if let sdkPlatformFrameworksPath = Destination.sdkPlatformFrameworkPaths() {
env["DYLD_FRAMEWORK_PATH"] = sdkPlatformFrameworksPath.fwk.pathString
env["DYLD_LIBRARY_PATH"] = sdkPlatformFrameworksPath.lib.pathString
if let sdkPlatformFrameworksPath = Destination.sdkPlatformFrameworkPath() {
env["DYLD_FRAMEWORK_PATH"] = sdkPlatformFrameworksPath.pathString
}
try Process.checkNonZeroExit(arguments: args, environment: env)
// Read the temporary file's content.
Expand Down
2 changes: 1 addition & 1 deletion Sources/TestSupport/Resources.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Resources: ManifestResourceProvider {

#if os(macOS)
public var sdkPlatformFrameworksPath: AbsolutePath {
return Destination.sdkPlatformFrameworkPaths()!.fwk
return Destination.sdkPlatformFrameworkPath()!
}
#endif

Expand Down
32 changes: 8 additions & 24 deletions Sources/Workspace/Destination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,15 @@ public struct Destination {
}

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

return Destination(
target: hostTargetTriple,
sdk: sdkPath,
binDir: binDir,
extraCCFlags: extraCCFlags,
extraSwiftCFlags: extraSwiftCFlags,
extraCCFlags: commonArgs,
extraSwiftCFlags: commonArgs,
extraCPPFlags: ["-lc++"]
)
#else
Expand All @@ -133,31 +127,21 @@ public struct Destination {
}

/// Returns macosx sdk platform framework path.
public static func sdkPlatformFrameworkPaths(
environment: [String:String] = Process.env
) -> (fwk: AbsolutePath, lib: AbsolutePath)? {
public static func sdkPlatformFrameworkPath(environment: [String:String] = Process.env) -> AbsolutePath? {
if let path = _sdkPlatformFrameworkPath {
return path
}
let platformPath = try? Process.checkNonZeroExit(
arguments: ["xcrun", "--sdk", "macosx", "--show-sdk-platform-path"],
environment: environment).spm_chomp()
arguments: ["xcrun", "--sdk", "macosx", "--show-sdk-platform-path"], environment: environment).spm_chomp()

if let platformPath = platformPath, !platformPath.isEmpty {
// For XCTest framework.
let fwk = AbsolutePath(platformPath).appending(
_sdkPlatformFrameworkPath = AbsolutePath(platformPath).appending(
components: "Developer", "Library", "Frameworks")

// For XCTest Swift library.
let lib = AbsolutePath(platformPath).appending(
components: "Developer", "usr", "lib")

_sdkPlatformFrameworkPath = (fwk, lib)
}
return _sdkPlatformFrameworkPath
}
/// Cache storage for sdk platform path.
private static var _sdkPlatformFrameworkPath: (fwk: AbsolutePath, lib: AbsolutePath)? = nil
private static var _sdkPlatformFrameworkPath: AbsolutePath? = nil

/// Target triple for the host system.
private static let hostTargetTriple = Triple.hostTriple
Expand Down