From a220f4c37a224b521063dbe21155228223eb4850 Mon Sep 17 00:00:00 2001 From: Ankit Aggarwal Date: Thu, 20 Jun 2019 15:11:51 -0700 Subject: [PATCH] Revert "Support new XCTest overlays" --- Sources/Commands/SwiftTestTool.swift | 5 ++--- Sources/TestSupport/Resources.swift | 2 +- Sources/Workspace/Destination.swift | 32 +++++++--------------------- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/Sources/Commands/SwiftTestTool.swift b/Sources/Commands/SwiftTestTool.swift index 32b50293168..660217448d0 100644 --- a/Sources/Commands/SwiftTestTool.swift +++ b/Sources/Commands/SwiftTestTool.swift @@ -477,9 +477,8 @@ public class SwiftTestTool: SwiftTool { 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. diff --git a/Sources/TestSupport/Resources.swift b/Sources/TestSupport/Resources.swift index 49f0506c6fa..fe05e9a8b11 100644 --- a/Sources/TestSupport/Resources.swift +++ b/Sources/TestSupport/Resources.swift @@ -36,7 +36,7 @@ public class Resources: ManifestResourceProvider { #if os(macOS) public var sdkPlatformFrameworksPath: AbsolutePath { - return Destination.sdkPlatformFrameworkPaths()!.fwk + return Destination.sdkPlatformFrameworkPath()! } #endif diff --git a/Sources/Workspace/Destination.swift b/Sources/Workspace/Destination.swift index 22bb20f78f9..368c77c6758 100644 --- a/Sources/Workspace/Destination.swift +++ b/Sources/Workspace/Destination.swift @@ -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 @@ -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