@@ -485,16 +485,18 @@ final class ExplicitModuleBuildTests: XCTestCase {
485485
486486 let linkJob = try jobs. findJob ( . link)
487487 if driver. targetTriple. isDarwin {
488- XCTAssertTrue ( linkJob. commandLine. contains ( " -possible-lswiftCore " ) )
489- XCTAssertTrue ( linkJob. commandLine. contains ( " -possible-lswift_StringProcessing " ) )
490- XCTAssertTrue ( linkJob. commandLine. contains ( " -possible-lobjc " ) )
491- XCTAssertTrue ( linkJob. commandLine. contains ( " -possible-lswift_Concurrency " ) )
492- XCTAssertTrue ( linkJob. commandLine. contains ( " -possible-lswiftSwiftOnoneSupport " ) )
488+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -possible-lswiftCore " ) )
489+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -possible-lswift_StringProcessing " ) )
490+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -possible-lobjc " ) )
491+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -possible-lswift_Concurrency " ) )
492+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -possible-lswiftSwiftOnoneSupport " ) )
493+ } else if driver. targetTriple. isWindows {
494+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag( " -lswiftCore " ) )
493495 } else {
494- XCTAssertTrue ( linkJob. commandLine. contains ( " -lswiftCore " ) )
495- XCTAssertTrue ( linkJob. commandLine. contains ( " -lswift_StringProcessing " ) )
496- XCTAssertTrue ( linkJob. commandLine. contains ( " -lswift_Concurrency " ) )
497- XCTAssertTrue ( linkJob. commandLine. contains ( " -lswiftSwiftOnoneSupport " ) )
496+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag ( " -lswiftCore " ) )
497+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag ( " -lswift_StringProcessing " ) )
498+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag ( " -lswift_Concurrency " ) )
499+ XCTAssertCommandLineContains ( linkJob. commandLine, . flag ( " -lswiftSwiftOnoneSupport " ) )
498500 }
499501 }
500502 }
@@ -610,6 +612,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
610612 let dependencyGraph = try XCTUnwrap ( driver. intermoduleDependencyGraph)
611613
612614 let checkForLinkLibrary = { ( info: ModuleInfo , linkName: String , isFramework: Bool , shouldForceLoad: Bool ) in
615+ if driver. targetTriple. isWindows && linkName != " swiftCore " {
616+ // Windows only links swiftCore.
617+ return
618+ }
613619 let linkLibraries = try XCTUnwrap ( info. linkLibraries)
614620 let linkLibrary = try XCTUnwrap ( linkLibraries. first { $0. linkName == linkName } )
615621 XCTAssertEqual ( linkLibrary. isFramework, isFramework)
@@ -773,6 +779,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
773779 } else if relativeOutputPathFileName. starts ( with: " _Builtin_stdint- " ) {
774780 try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " _Builtin_stdint " ) ,
775781 dependencyGraph: dependencyGraph)
782+ } else if relativeOutputPathFileName. starts ( with: " vcruntime- " ) {
783+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " vcruntime " ) ,
784+ dependencyGraph: dependencyGraph)
785+ } else if relativeOutputPathFileName. starts ( with: " SAL- " ) {
786+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " SAL " ) ,
787+ dependencyGraph: dependencyGraph)
776788 } else if hostTriple. isMacOSX,
777789 hostTriple. version ( for: . macOS) < Triple . Version ( 11 , 0 , 0 ) ,
778790 relativeOutputPathFileName. starts ( with: " X- " ) {
@@ -823,7 +835,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
823835 try testInputsPath. appending ( component: " ExplicitModuleBuilds " )
824836 . appending ( component: " Swift " )
825837 let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
826-
838+
827839 var driver = try Driver ( args: [ " swiftc " ,
828840 " -I " , cHeadersPath. nativePathString ( escaped: true ) ,
829841 " -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -1135,6 +1147,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
11351147 } else if relativeOutputPathFileName. starts ( with: " _Builtin_stdint- " ) {
11361148 try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " _Builtin_stdint " ) ,
11371149 dependencyGraph: dependencyGraph)
1150+ } else if relativeOutputPathFileName. starts ( with: " vcruntime- " ) {
1151+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " vcruntime " ) ,
1152+ dependencyGraph: dependencyGraph)
1153+ } else if relativeOutputPathFileName. starts ( with: " SAL- " ) {
1154+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " SAL " ) ,
1155+ dependencyGraph: dependencyGraph)
11381156 } else {
11391157 XCTFail ( " Unexpected module dependency build job output: \( outputFilePath) " )
11401158 }
@@ -1280,6 +1298,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
12801298 } else if relativeOutputPathFileName. starts ( with: " _Builtin_stdint- " ) {
12811299 try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " _Builtin_stdint " ) ,
12821300 dependencyGraph: dependencyGraph)
1301+ } else if relativeOutputPathFileName. starts ( with: " vcruntime- " ) {
1302+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " vcruntime " ) ,
1303+ dependencyGraph: dependencyGraph)
1304+ } else if relativeOutputPathFileName. starts ( with: " SAL- " ) {
1305+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " SAL " ) ,
1306+ dependencyGraph: dependencyGraph)
12831307 } else {
12841308 XCTFail ( " Unexpected module dependency build job output: \( outputFilePath) " )
12851309 }
@@ -1400,6 +1424,12 @@ final class ExplicitModuleBuildTests: XCTestCase {
14001424 } else if relativeOutputPathFileName. starts ( with: " _Builtin_stdint- " ) {
14011425 try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " _Builtin_stdint " ) ,
14021426 dependencyGraph: dependencyGraph)
1427+ } else if relativeOutputPathFileName. starts ( with: " vcruntime- " ) {
1428+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " vcruntime " ) ,
1429+ dependencyGraph: dependencyGraph)
1430+ } else if relativeOutputPathFileName. starts ( with: " SAL- " ) {
1431+ try checkExplicitModuleBuildJob ( job: job, moduleId: . clang( " SAL " ) ,
1432+ dependencyGraph: dependencyGraph)
14031433 } else {
14041434 XCTFail ( " Unexpected module dependency build job output: \( outputFilePath) " )
14051435 }
@@ -2252,7 +2282,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
22522282 hostTriple. version ( for: . macOS) < Triple . Version ( 11 , 0 , 0 ) {
22532283 expectedNumberOfDependencies = 13
22542284 } else if driver. targetTriple. isWindows {
2255- expectedNumberOfDependencies = 13
2285+ expectedNumberOfDependencies = 14
22562286 } else {
22572287 expectedNumberOfDependencies = 12
22582288 }
@@ -2826,7 +2856,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28262856 main. pathString] )
28272857 let plannedJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
28282858 let emitModuleJob = try XCTUnwrap ( plannedJobs. findJobs ( . emitModule) . spm_only)
2829- XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence : [ . flag( " -sdk " ) , . path ( . absolute ( mockSDKPath ) ) ] ) )
2859+ XCTAssertCommandLineContains ( emitModuleJob. commandLine, . flag( " -sdk " ) )
28302860 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target " ) , . flag( " x86_64-apple-macosx10.15 " ) ] ) )
28312861 }
28322862 }
@@ -2856,7 +2886,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28562886 main. pathString] )
28572887 let plannedJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
28582888 let emitModuleJob = try XCTUnwrap ( plannedJobs. findJobs ( . emitModule) . spm_only)
2859- XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence : [ . flag( " -sdk " ) , . path ( . absolute ( mockSDKPath ) ) ] ) )
2889+ XCTAssertCommandLineContains ( emitModuleJob. commandLine, . flag( " -sdk " ) )
28602890 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target " ) , . flag( " x86_64-apple-macosx10.12 " ) ] ) )
28612891 }
28622892 }
@@ -2887,7 +2917,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
28872917 main. pathString] )
28882918 let plannedJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
28892919 let emitModuleJob = try XCTUnwrap ( plannedJobs. findJobs ( . emitModule) . spm_only)
2890- XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence : [ . flag( " -sdk " ) , . path ( . absolute ( mockSDKPath ) ) ] ) )
2920+ XCTAssertCommandLineContains ( emitModuleJob. commandLine, . flag( " -sdk " ) )
28912921 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target " ) , . flag( " x86_64-apple-macosx10.15 " ) ] ) )
28922922 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target-variant " ) , . flag( " x86_64-apple-ios13.1-macabi " ) ] ) )
28932923 }
@@ -2920,7 +2950,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
29202950 main. pathString] )
29212951 let plannedJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
29222952 let emitModuleJob = try XCTUnwrap ( plannedJobs. findJobs ( . emitModule) . spm_only)
2923- XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence : [ . flag( " -sdk " ) , . path ( . absolute ( mockSDKPath ) ) ] ) )
2953+ XCTAssertCommandLineContains ( emitModuleJob. commandLine, . flag( " -sdk " ) )
29242954 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target " ) , . flag( " x86_64-apple-macosx10.12 " ) ] ) )
29252955 XCTAssertTrue ( emitModuleJob. commandLine. contains ( subsequence: [ . flag( " -clang-target-variant " ) , . flag( " x86_64-apple-ios14.0-macabi " ) ] ) )
29262956 }
0 commit comments