@@ -2275,6 +2275,44 @@ final class ExplicitModuleBuildTests: XCTestCase {
2275
2275
}
2276
2276
}
2277
2277
2278
+ func testEmitModuleSeparatelyJobs( ) throws {
2279
+ try withTemporaryDirectory { path in
2280
+ try localFileSystem. changeCurrentWorkingDirectory ( to: path)
2281
+ let moduleCachePath = path. appending ( component: " ModuleCache " )
2282
+ try localFileSystem. createDirectory ( moduleCachePath)
2283
+ let fileA = path. appending ( component: " fileA.swift " )
2284
+ try localFileSystem. writeFileContents ( fileA, bytes:
2285
+ """
2286
+ public struct A {}
2287
+ """
2288
+ )
2289
+ let fileB = path. appending ( component: " fileB.swift " )
2290
+ try localFileSystem. writeFileContents ( fileB, bytes:
2291
+ """
2292
+ public struct B {}
2293
+ """
2294
+ )
2295
+
2296
+ let outputModule = path. appending ( component: " Test.swiftmodule " )
2297
+ let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
2298
+ var driver = try Driver ( args: [ " swiftc " ,
2299
+ " -explicit-module-build " , " -v " , " -module-name " , " Test " ,
2300
+ " -module-cache-path " , moduleCachePath. nativePathString ( escaped: true ) ,
2301
+ " -working-directory " , path. nativePathString ( escaped: true ) ,
2302
+ " -emit-module " , outputModule. nativePathString ( escaped: true ) ,
2303
+ " -experimental-emit-module-separately " ,
2304
+ fileA. nativePathString ( escaped: true ) , fileB. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting,
2305
+ env: ProcessEnv . vars)
2306
+ let jobs = try driver. planBuild ( )
2307
+ let compileJobs = jobs. filter ( { $0. kind == . compile } )
2308
+ XCTAssertEqual ( compileJobs. count, 0 )
2309
+ let emitModuleJob = jobs. filter ( { $0. kind == . emitModule } )
2310
+ XCTAssertEqual ( emitModuleJob. count, 1 )
2311
+ try driver. run ( jobs: jobs)
2312
+ XCTAssertFalse ( driver. diagnosticEngine. hasErrors)
2313
+ }
2314
+ }
2315
+
2278
2316
// We only care about prebuilt modules in macOS.
2279
2317
#if os(macOS)
2280
2318
func testPrebuiltModuleGenerationJobs( ) throws {
0 commit comments