1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See http://swift.org/LICENSE.txt for license information
@@ -142,7 +142,7 @@ final class BuildPlanTests: XCTestCase {
142
142
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
143
143
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
144
144
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
145
- " -target " , " x86_64-apple-macosx10.10 " , " -Xlinker " , " -add_ast_path " ,
145
+ " -target " , defaultTargetTriple , " -Xlinker " , " -add_ast_path " ,
146
146
" -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " , " -Xlinker " , " -add_ast_path " ,
147
147
" -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
148
148
]
@@ -454,7 +454,7 @@ final class BuildPlanTests: XCTestCase {
454
454
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
455
455
" @/path/to/build/release/exe.product/Objects.LinkFileList " ,
456
456
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
457
- " -target " , " x86_64-apple-macosx10.10 " ,
457
+ " -target " , defaultTargetTriple ,
458
458
] )
459
459
#else
460
460
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -556,7 +556,7 @@ final class BuildPlanTests: XCTestCase {
556
556
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
557
557
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
558
558
" -runtime-compatibility-version " , " none " ,
559
- " -target " , " x86_64-apple-macosx10.10 " ,
559
+ " -target " , defaultTargetTriple ,
560
560
] )
561
561
#else
562
562
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -707,7 +707,7 @@ final class BuildPlanTests: XCTestCase {
707
707
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
708
708
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
709
709
" -runtime-compatibility-version " , " none " ,
710
- " -target " , " x86_64-apple-macosx10.10 " ,
710
+ " -target " , defaultTargetTriple ,
711
711
] )
712
712
#else
713
713
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -783,7 +783,7 @@ final class BuildPlanTests: XCTestCase {
783
783
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
784
784
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
785
785
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
786
- " -target " , " x86_64-apple-macosx10.10 " ,
786
+ " -target " , defaultTargetTriple ,
787
787
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
788
788
] )
789
789
#else
@@ -936,7 +936,7 @@ final class BuildPlanTests: XCTestCase {
936
936
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path/../../../ " ,
937
937
" @/path/to/build/debug/PkgPackageTests.product/Objects.LinkFileList " ,
938
938
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
939
- " -target " , " x86_64-apple-macosx \( version) " ,
939
+ " -target " , " \( hostTriple . tripleString ( forPlatformVersion : version) ) " ,
940
940
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.swiftmodule " ,
941
941
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/FooTests.swiftmodule " ,
942
942
] )
@@ -993,7 +993,7 @@ final class BuildPlanTests: XCTestCase {
993
993
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
994
994
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
995
995
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
996
- " -target " , " x86_64-apple-macosx10.10 " ,
996
+ " -target " , defaultTargetTriple ,
997
997
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
998
998
] )
999
999
#else
@@ -1091,7 +1091,7 @@ final class BuildPlanTests: XCTestCase {
1091
1091
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1092
1092
" @/path/to/build/debug/Foo.product/Objects.LinkFileList " ,
1093
1093
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1094
- " -target " , " x86_64-apple-macosx10.10 " ,
1094
+ " -target " , defaultTargetTriple ,
1095
1095
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.build/Foo.swiftmodule "
1096
1096
] )
1097
1097
@@ -1102,7 +1102,7 @@ final class BuildPlanTests: XCTestCase {
1102
1102
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/libBar-Baz.dylib " ,
1103
1103
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1104
1104
" @/path/to/build/debug/Bar-Baz.product/Objects.LinkFileList " ,
1105
- " -target " , " x86_64-apple-macosx10.10 " ,
1105
+ " -target " , defaultTargetTriple ,
1106
1106
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Bar.swiftmodule "
1107
1107
] )
1108
1108
#else
@@ -1182,7 +1182,7 @@ final class BuildPlanTests: XCTestCase {
1182
1182
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/liblib.dylib " ,
1183
1183
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1184
1184
" @/path/to/build/debug/lib.product/Objects.LinkFileList " ,
1185
- " -target " , " x86_64-apple-macosx10.10 " ,
1185
+ " -target " , defaultTargetTriple ,
1186
1186
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
1187
1187
]
1188
1188
#else
@@ -1252,9 +1252,9 @@ final class BuildPlanTests: XCTestCase {
1252
1252
XCTAssertEqual ( lib. moduleMap, AbsolutePath ( " /path/to/build/debug/lib.build/module.modulemap " ) )
1253
1253
1254
1254
#if os(macOS)
1255
- 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 " ] )
1255
+ 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 ] )
1256
1256
1257
- 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 " ] )
1257
+ 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 ] )
1258
1258
#else
1259
1259
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] )
1260
1260
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] )
@@ -1811,14 +1811,14 @@ final class BuildPlanTests: XCTestCase {
1811
1811
1812
1812
let aTarget = try result. target ( for: " ATarget " ) . swiftTarget ( ) . compileArguments ( )
1813
1813
#if os(macOS)
1814
- XCTAssertMatch ( aTarget, [ " -target " , " x86_64-apple-macosx10 .13" , . anySequence] )
1814
+ XCTAssertMatch ( aTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .13" ) ) , . anySequence] )
1815
1815
#else
1816
1816
XCTAssertMatch ( aTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1817
1817
#endif
1818
1818
1819
1819
let bTarget = try result. target ( for: " BTarget " ) . swiftTarget ( ) . compileArguments ( )
1820
1820
#if os(macOS)
1821
- XCTAssertMatch ( bTarget, [ " -target " , " x86_64-apple-macosx10 .12" , . anySequence] )
1821
+ XCTAssertMatch ( bTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .12" ) ) , . anySequence] )
1822
1822
#else
1823
1823
XCTAssertMatch ( bTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1824
1824
#endif
0 commit comments