@@ -147,6 +147,7 @@ final class BuildPlanTests: XCTestCase {
147
147
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
148
148
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
149
149
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
150
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
150
151
" -target " , defaultTargetTriple, " -Xlinker " , " -add_ast_path " ,
151
152
" -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " , " -Xlinker " , " -add_ast_path " ,
152
153
" -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
@@ -465,6 +466,7 @@ final class BuildPlanTests: XCTestCase {
465
466
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
466
467
" @/path/to/build/release/exe.product/Objects.LinkFileList " ,
467
468
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
469
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
468
470
" -target " , defaultTargetTriple,
469
471
] )
470
472
#else
@@ -802,6 +804,7 @@ final class BuildPlanTests: XCTestCase {
802
804
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
803
805
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
804
806
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
807
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
805
808
" -target " , defaultTargetTriple,
806
809
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
807
810
] )
@@ -967,6 +970,7 @@ final class BuildPlanTests: XCTestCase {
967
970
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path/../../../ " ,
968
971
" @/path/to/build/debug/PkgPackageTests.product/Objects.LinkFileList " ,
969
972
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
973
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
970
974
" -target " , " \( hostTriple. tripleString ( forPlatformVersion: version) ) " ,
971
975
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.swiftmodule " ,
972
976
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/FooTests.swiftmodule " ,
@@ -982,6 +986,54 @@ final class BuildPlanTests: XCTestCase {
982
986
#endif
983
987
}
984
988
989
+ func testConcurrencyInOS( ) throws {
990
+ let fs = InMemoryFileSystem ( emptyFiles:
991
+ " /Pkg/Sources/exe/main.swift "
992
+ )
993
+
994
+ let observability = ObservabilitySystem . makeForTesting ( )
995
+ let graph = try loadPackageGraph (
996
+ fs: fs,
997
+ manifests: [
998
+ Manifest . createRootManifest (
999
+ name: " Pkg " ,
1000
+ path: . init( " /Pkg " ) ,
1001
+ platforms: [
1002
+ PlatformDescription ( name: " macos " , version: " 12.0 " ) ,
1003
+ ] ,
1004
+ targets: [
1005
+ TargetDescription ( name: " exe " , dependencies: [ ] ) ,
1006
+ ] ) ,
1007
+ ] ,
1008
+ observabilityScope: observability. topScope
1009
+ )
1010
+ XCTAssertNoDiagnostics ( observability. diagnostics)
1011
+
1012
+ let result = BuildPlanResult ( plan: try BuildPlan (
1013
+ buildParameters: mockBuildParameters ( config: . release) ,
1014
+ graph: graph,
1015
+ fileSystem: fs,
1016
+ observabilityScope: observability. topScope
1017
+ ) )
1018
+
1019
+ result. checkProductsCount ( 1 )
1020
+ result. checkTargetsCount ( 1 )
1021
+
1022
+ let exe = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
1023
+ XCTAssertMatch ( exe, [ " -swift-version " , " 4 " , " -O " , " -g " , . equal( j) , " -DSWIFT_PACKAGE " , " -module-cache-path " , " /path/to/build/release/ModuleCache " , . anySequence] )
1024
+
1025
+ #if os(macOS)
1026
+ XCTAssertEqual ( try result. buildProduct ( for: " exe " ) . linkArguments ( ) , [
1027
+ " /fake/path/to/swiftc " , " -g " , " -L " , " /path/to/build/release " ,
1028
+ " -o " , " /path/to/build/release/exe " , " -module-name " , " exe " , " -emit-executable " ,
1029
+ " -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1030
+ " @/path/to/build/release/exe.product/Objects.LinkFileList " ,
1031
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1032
+ " -target " , hostTriple. tripleString ( forPlatformVersion: " 12.0 " ) ,
1033
+ ] )
1034
+ #endif
1035
+ }
1036
+
985
1037
func testParseAsLibraryFlagForExe( ) throws {
986
1038
let fs = InMemoryFileSystem ( emptyFiles:
987
1039
// First executable has a single source file not named `main.swift`.
@@ -1082,6 +1134,7 @@ final class BuildPlanTests: XCTestCase {
1082
1134
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1083
1135
" @/path/to/build/debug/exe.product/Objects.LinkFileList " ,
1084
1136
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1137
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
1085
1138
" -target " , defaultTargetTriple,
1086
1139
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/exe.build/exe.swiftmodule " ,
1087
1140
] )
@@ -1188,6 +1241,7 @@ final class BuildPlanTests: XCTestCase {
1188
1241
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1189
1242
" @/path/to/build/debug/Foo.product/Objects.LinkFileList " ,
1190
1243
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1244
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
1191
1245
" -target " , defaultTargetTriple,
1192
1246
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Foo.build/Foo.swiftmodule "
1193
1247
] )
@@ -1200,6 +1254,7 @@ final class BuildPlanTests: XCTestCase {
1200
1254
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1201
1255
" @/path/to/build/debug/Bar-Baz.product/Objects.LinkFileList " ,
1202
1256
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1257
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
1203
1258
" -target " , defaultTargetTriple,
1204
1259
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/Bar.swiftmodule "
1205
1260
] )
@@ -1283,6 +1338,7 @@ final class BuildPlanTests: XCTestCase {
1283
1338
" -Xlinker " , " -rpath " , " -Xlinker " , " @loader_path " ,
1284
1339
" @/path/to/build/debug/lib.product/Objects.LinkFileList " ,
1285
1340
" -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift/macosx " ,
1341
+ " -Xlinker " , " -rpath " , " -Xlinker " , " /fake/path/lib/swift-5.5/macosx " ,
1286
1342
" -target " , defaultTargetTriple,
1287
1343
" -Xlinker " , " -add_ast_path " , " -Xlinker " , " /path/to/build/debug/lib.swiftmodule " ,
1288
1344
]
0 commit comments