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
@@ -141,7 +141,7 @@ final class BuildPlanTests: XCTestCase {
141
141
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
142
142
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
143
143
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
144
- " -target " , " x86_64-apple-macosx10.10 " , " -Xlinker " , " -add_ast_path " ,
144
+ " -target " , defaultTargetTriple , " -Xlinker " , " -add_ast_path " ,
145
145
" -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " , " -Xlinker " , " -add_ast_path " ,
146
146
" -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
147
147
]
@@ -453,7 +453,7 @@ final class BuildPlanTests: XCTestCase {
453
453
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
454
454
" @/path/to/build/release/exe.product/Objects.LinkFileList " ,
455
455
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
456
- " -target " , " x86_64-apple-macosx10.10 " ,
456
+ " -target " , defaultTargetTriple ,
457
457
] )
458
458
#else
459
459
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -555,7 +555,7 @@ final class BuildPlanTests: XCTestCase {
555
555
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
556
556
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
557
557
" -runtime-compatibility-version " , " none " ,
558
- " -target " , " x86_64-apple-macosx10.10 " ,
558
+ " -target " , defaultTargetTriple ,
559
559
] )
560
560
#else
561
561
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -706,7 +706,7 @@ final class BuildPlanTests: XCTestCase {
706
706
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
707
707
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
708
708
" -runtime-compatibility-version " , " none " ,
709
- " -target " , " x86_64-apple-macosx10.10 " ,
709
+ " -target " , defaultTargetTriple ,
710
710
] )
711
711
#else
712
712
XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
@@ -782,7 +782,7 @@ final class BuildPlanTests: XCTestCase {
782
782
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
783
783
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
784
784
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
785
- " -target " , " x86_64-apple-macosx10.10 " ,
785
+ " -target " , defaultTargetTriple ,
786
786
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
787
787
] )
788
788
#else
@@ -935,7 +935,7 @@ final class BuildPlanTests: XCTestCase {
935
935
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path/../../../ " ,
936
936
" @/path/to/build/debug/PkgPackageTests.product/Objects.LinkFileList " ,
937
937
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
938
- " -target " , " x86_64-apple-macosx \( version) " ,
938
+ " -target " , " \( hostTriple . tripleString ( forPlatformVersion : version) ) " ,
939
939
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.swiftmodule " ,
940
940
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/FooTests.swiftmodule " ,
941
941
] )
@@ -992,7 +992,7 @@ final class BuildPlanTests: XCTestCase {
992
992
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
993
993
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
994
994
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
995
- " -target " , " x86_64-apple-macosx10.10 " ,
995
+ " -target " , defaultTargetTriple ,
996
996
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
997
997
] )
998
998
#else
@@ -1090,7 +1090,7 @@ final class BuildPlanTests: XCTestCase {
1090
1090
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1091
1091
" @/path/to/build/debug/Foo.product/Objects.LinkFileList " ,
1092
1092
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1093
- " -target " , " x86_64-apple-macosx10.10 " ,
1093
+ " -target " , defaultTargetTriple ,
1094
1094
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.build/Foo.swiftmodule "
1095
1095
] )
1096
1096
@@ -1101,7 +1101,7 @@ final class BuildPlanTests: XCTestCase {
1101
1101
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/libBar-Baz.dylib " ,
1102
1102
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1103
1103
" @/path/to/build/debug/Bar-Baz.product/Objects.LinkFileList " ,
1104
- " -target " , " x86_64-apple-macosx10.10 " ,
1104
+ " -target " , defaultTargetTriple ,
1105
1105
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Bar.swiftmodule "
1106
1106
] )
1107
1107
#else
@@ -1181,7 +1181,7 @@ final class BuildPlanTests: XCTestCase {
1181
1181
" -Xlinker " , " -install_name " , " -Xlinker " , " @rpath/liblib.dylib " ,
1182
1182
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1183
1183
" @/path/to/build/debug/lib.product/Objects.LinkFileList " ,
1184
- " -target " , " x86_64-apple-macosx10.10 " ,
1184
+ " -target " , defaultTargetTriple ,
1185
1185
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
1186
1186
]
1187
1187
#else
@@ -1251,9 +1251,9 @@ final class BuildPlanTests: XCTestCase {
1251
1251
XCTAssertEqual ( lib. moduleMap, AbsolutePath ( " /path/to/build/debug/lib.build/module.modulemap " ) )
1252
1252
1253
1253
#if os(macOS)
1254
- 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 " ] )
1254
+ 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 ] )
1255
1255
1256
- 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 " ] )
1256
+ 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 ] )
1257
1257
#else
1258
1258
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] )
1259
1259
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] )
@@ -1810,14 +1810,14 @@ final class BuildPlanTests: XCTestCase {
1810
1810
1811
1811
let aTarget = try result. target ( for: " ATarget " ) . swiftTarget ( ) . compileArguments ( )
1812
1812
#if os(macOS)
1813
- XCTAssertMatch ( aTarget, [ " -target " , " x86_64-apple-macosx10 .13" , . anySequence] )
1813
+ XCTAssertMatch ( aTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .13" ) ) , . anySequence] )
1814
1814
#else
1815
1815
XCTAssertMatch ( aTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1816
1816
#endif
1817
1817
1818
1818
let bTarget = try result. target ( for: " BTarget " ) . swiftTarget ( ) . compileArguments ( )
1819
1819
#if os(macOS)
1820
- XCTAssertMatch ( bTarget, [ " -target " , " x86_64-apple-macosx10 .12" , . anySequence] )
1820
+ XCTAssertMatch ( bTarget, [ . equal ( " -target " ) , . equal ( hostTriple . tripleString ( forPlatformVersion : " 10 .12" ) ) , . anySequence] )
1821
1821
#else
1822
1822
XCTAssertMatch ( bTarget, [ . equal( " -target " ) , . equal( defaultTargetTriple) , . anySequence] )
1823
1823
#endif
0 commit comments