@@ -3088,7 +3088,7 @@ final class SwiftDriverTests: XCTestCase {
30883088 func testWMOWithNonSourceInputFirstAndModuleOutput( ) throws {
30893089 var driver1 = try Driver ( args: [
30903090 " swiftc " , " -wmo " , " danger.o " , " foo.swift " , " bar.swift " , " wibble.swift " , " -module-name " , " Test " ,
3091- " -driver-filelist-threshold=0 " , " -emit-module " , " -emit-library "
3091+ " -driver-filelist-threshold=0 " , " -emit-module " , " -emit-library " , " -no-emit-module-separately-wmo "
30923092 ] )
30933093 let plannedJobs = try driver1. planBuild ( ) . removingAutolinkExtractJobs ( )
30943094 XCTAssertEqual ( plannedJobs. count, 2 )
@@ -3467,6 +3467,22 @@ final class SwiftDriverTests: XCTestCase {
34673467 XCTAssertEqual ( plannedJobs. count, 4 )
34683468 XCTAssertEqual ( Set ( plannedJobs. map { $0. kind } ) , Set ( [ . compile, . emitModule, . link] ) )
34693469 }
3470+
3471+ do {
3472+ // Schedule an emit-module separately job even if there are non-compilable inputs.
3473+ var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " bar.dylib " , " -emit-library " , " foo.dylib " , " -emit-module-path " , " foo.swiftmodule " ] ,
3474+ env: envVars)
3475+ let plannedJobs = try driver. planBuild ( )
3476+ XCTAssertEqual ( plannedJobs. count, 3 )
3477+ XCTAssertEqual ( Set ( plannedJobs. map { $0. kind } ) , Set ( [ . compile, . emitModule, . link] ) )
3478+
3479+ let emitJob = try plannedJobs. findJob ( . emitModule)
3480+ XCTAssertTrue ( try emitJob. commandLine. contains ( where: { $0 == . path( . relative( try . init( validating: " foo.swift " ) ) ) } ) )
3481+ XCTAssertFalse ( try emitJob. commandLine. contains ( where: { $0 == . path( . relative( try . init( validating: " bar.dylib " ) ) ) } ) )
3482+
3483+ let linkJob = try plannedJobs. findJob ( . link)
3484+ XCTAssertTrue ( try linkJob. commandLine. contains ( where: { $0 == . path( . relative( try . init( validating: " bar.dylib " ) ) ) } ) )
3485+ }
34703486 }
34713487
34723488 func testEmitModuleSeparatelyWMO( ) throws {
0 commit comments