Skip to content

[5.4] [Bootstrap] Do not pass -Ddispatch_DIR to the Yams CMake build (#3363) #3423

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
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
35 changes: 20 additions & 15 deletions Tests/BuildTests/BuildPlanTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See http://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -142,7 +142,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx10.10", "-Xlinker", "-add_ast_path",
"-target", defaultTargetTriple, "-Xlinker", "-add_ast_path",
"-Xlinker", "/path/to/build/debug/exe.build/exe.swiftmodule", "-Xlinker", "-add_ast_path",
"-Xlinker", "/path/to/build/debug/lib.swiftmodule",
]
Expand All @@ -169,6 +169,11 @@ final class BuildPlanTests: XCTestCase {
}

func testExplicitSwiftPackageBuild() throws {
#if os(macOS) && arch(arm64)
// Disabled on Apple Silicon on the 5.4 branch
// because relies on fixes from later compiler versions.
throw XCTSkip()
#endif
try withTemporaryDirectory { path in
// Create a test package with three targets:
// A -> B -> C
Expand Down Expand Up @@ -454,7 +459,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/release/exe.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
])
#else
XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), [
Expand Down Expand Up @@ -556,7 +561,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
"-runtime-compatibility-version", "none",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
])
#else
XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), [
Expand Down Expand Up @@ -707,7 +712,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
"-runtime-compatibility-version", "none",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
])
#else
XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), [
Expand Down Expand Up @@ -783,7 +788,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/exe.build/exe.swiftmodule",
])
#else
Expand Down Expand Up @@ -936,7 +941,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path/../../../",
"@/path/to/build/debug/PkgPackageTests.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx\(version)",
"-target", "\(hostTriple.tripleString(forPlatformVersion: version))",
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/Foo.swiftmodule",
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/FooTests.swiftmodule",
])
Expand Down Expand Up @@ -993,7 +998,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/exe.build/exe.swiftmodule",
])
#else
Expand Down Expand Up @@ -1091,7 +1096,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/Foo.product/Objects.LinkFileList",
"-Xlinker", "-rpath", "-Xlinker", "/fake/path/lib/swift/macosx",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/Foo.build/Foo.swiftmodule"
])

Expand All @@ -1102,7 +1107,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-install_name", "-Xlinker", "@rpath/libBar-Baz.dylib",
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/Bar-Baz.product/Objects.LinkFileList",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/Bar.swiftmodule"
])
#else
Expand Down Expand Up @@ -1182,7 +1187,7 @@ final class BuildPlanTests: XCTestCase {
"-Xlinker", "-install_name", "-Xlinker", "@rpath/liblib.dylib",
"-Xlinker", "-rpath", "-Xlinker", "@loader_path",
"@/path/to/build/debug/lib.product/Objects.LinkFileList",
"-target", "x86_64-apple-macosx10.10",
"-target", defaultTargetTriple,
"-Xlinker", "-add_ast_path", "-Xlinker", "/path/to/build/debug/lib.swiftmodule",
]
#else
Expand Down Expand Up @@ -1252,9 +1257,9 @@ final class BuildPlanTests: XCTestCase {
XCTAssertEqual(lib.moduleMap, AbsolutePath("/path/to/build/debug/lib.build/module.modulemap"))

#if os(macOS)
XCTAssertEqual(try result.buildProduct(for: "lib").linkArguments(), ["/fake/path/to/swiftc", "-lc++", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/liblib.dylib", "-module-name", "lib", "-emit-library", "-Xlinker", "-install_name", "-Xlinker", "@rpath/liblib.dylib", "-Xlinker", "-rpath", "-Xlinker", "@loader_path", "@/path/to/build/debug/lib.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", "x86_64-apple-macosx10.10"])
XCTAssertEqual(try result.buildProduct(for: "lib").linkArguments(), ["/fake/path/to/swiftc", "-lc++", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/liblib.dylib", "-module-name", "lib", "-emit-library", "-Xlinker", "-install_name", "-Xlinker", "@rpath/liblib.dylib", "-Xlinker", "-rpath", "-Xlinker", "@loader_path", "@/path/to/build/debug/lib.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", defaultTargetTriple])

XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), ["/fake/path/to/swiftc", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/exe", "-module-name", "exe", "-emit-executable", "-Xlinker", "-rpath", "-Xlinker", "@loader_path", "@/path/to/build/debug/exe.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", "x86_64-apple-macosx10.10"])
XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), ["/fake/path/to/swiftc", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/exe", "-module-name", "exe", "-emit-executable", "-Xlinker", "-rpath", "-Xlinker", "@loader_path", "@/path/to/build/debug/exe.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", defaultTargetTriple])
#else
XCTAssertEqual(try result.buildProduct(for: "lib").linkArguments(), ["/fake/path/to/swiftc", "-lstdc++", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/liblib.so", "-module-name", "lib", "-emit-library", "-Xlinker", "-rpath=$ORIGIN", "@/path/to/build/debug/lib.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", defaultTargetTriple])
XCTAssertEqual(try result.buildProduct(for: "exe").linkArguments(), ["/fake/path/to/swiftc", "-L", "/path/to/build/debug", "-o", "/path/to/build/debug/exe", "-module-name", "exe", "-emit-executable", "-Xlinker", "-rpath=$ORIGIN", "@/path/to/build/debug/exe.product/Objects.LinkFileList", "-runtime-compatibility-version", "none", "-target", defaultTargetTriple])
Expand Down Expand Up @@ -1811,14 +1816,14 @@ final class BuildPlanTests: XCTestCase {

let aTarget = try result.target(for: "ATarget").swiftTarget().compileArguments()
#if os(macOS)
XCTAssertMatch(aTarget, ["-target", "x86_64-apple-macosx10.13", .anySequence])
XCTAssertMatch(aTarget, [.equal("-target"), .equal(hostTriple.tripleString(forPlatformVersion: "10.13")), .anySequence])
#else
XCTAssertMatch(aTarget, [.equal("-target"), .equal(defaultTargetTriple), .anySequence] )
#endif

let bTarget = try result.target(for: "BTarget").swiftTarget().compileArguments()
#if os(macOS)
XCTAssertMatch(bTarget, ["-target", "x86_64-apple-macosx10.12", .anySequence])
XCTAssertMatch(bTarget, [.equal("-target"), .equal(hostTriple.tripleString(forPlatformVersion: "10.12")), .anySequence])
#else
XCTAssertMatch(bTarget, [.equal("-target"), .equal(defaultTargetTriple), .anySequence] )
#endif
Expand Down
3 changes: 0 additions & 3 deletions Utilities/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,6 @@ def build_yams(args):
cmake_flags.append("-DCMAKE_C_FLAGS=-target %s%s" % (get_build_target(args), g_macos_deployment_target))
cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target)
else:
if args.dispatch_build_dir:
cmake_flags.append(get_dispatch_cmake_arg(args))

if args.foundation_build_dir:
cmake_flags.append(get_foundation_cmake_arg(args))

Expand Down