@@ -266,6 +266,45 @@ extension IncrementalCompilationTests {
266
266
try checkPropagationOfTopLevelChange ( checkDiagnostics: checkDiagnostics)
267
267
}
268
268
269
+ func testFileMapMissingMainEntry( ) throws {
270
+ try buildInitialState ( checkDiagnostics: true )
271
+ OutputFileMapCreator . write (
272
+ module: module, inputPaths: inputPathsAndContents. map { $0. 0 } ,
273
+ derivedData: derivedDataPath, to: OFM, excludeMainEntry: true )
274
+ try doABuild ( " output file map missing main entry " , checkDiagnostics: true , extraArguments: [ ] , whenAutolinking: [ ] ) {
275
+ missingMainDependencyEntry
276
+ disablingIncremental
277
+ foundBatchableJobs ( 2 )
278
+ formingOneBatch
279
+ addingToBatchThenForming ( " main " , " other " )
280
+ compiling ( " main " , " other " )
281
+ startingLinking
282
+ finishedLinking
283
+ }
284
+ }
285
+
286
+ func testFileMapMissingMainEntryWMO( ) throws {
287
+ try buildInitialState ( checkDiagnostics: true )
288
+ guard let sdkArgumentsForTesting = try Driver . sdkArgumentsForTesting ( )
289
+ else {
290
+ throw XCTSkip ( " Cannot perform this test on this host " )
291
+ }
292
+
293
+ OutputFileMapCreator . write (
294
+ module: module, inputPaths: inputPathsAndContents. map { $0. 0 } ,
295
+ derivedData: derivedDataPath, to: OFM, excludeMainEntry: true )
296
+
297
+ let args = [
298
+ " swiftc " ,
299
+ " -module-name " , module,
300
+ " -o " , derivedDataPath. appending ( component: module + " .o " ) . pathString,
301
+ " -output-file-map " , OFM . pathString,
302
+ " -whole-module-optimization " ,
303
+ " -no-color-diagnostics " ,
304
+ ] + inputPathsAndContents. map { $0. 0 . pathString} . sorted ( ) + sdkArgumentsForTesting
305
+ _ = try doABuild ( whenAutolinking: [ ] , expecting: [ ] , arguments: args)
306
+ }
307
+
269
308
// FIXME: Expect failure in Linux in CI just as testIncrementalDiagnostics
270
309
func testAlwaysRebuildDependents( ) throws {
271
310
#if !os(Linux)
@@ -1257,6 +1296,12 @@ extension DiagVerifiable {
1257
1296
@DiagsBuilder var disablingIncrementalCannotReadBuildRecord : [ Diagnostic . Message ] {
1258
1297
" Incremental compilation: Disabling incremental build: could not read build record "
1259
1298
}
1299
+ @DiagsBuilder var missingMainDependencyEntry : [ Diagnostic . Message ] {
1300
+ . warning( " ignoring -incremental; output file map has no master dependencies entry ( \" swift-dependencies \" under \" \" ) " )
1301
+ }
1302
+ @DiagsBuilder var disablingIncremental : [ Diagnostic . Message ] {
1303
+ " Incremental compilation: Disabling incremental build: no build record path "
1304
+ }
1260
1305
// MARK: - graph
1261
1306
@DiagsBuilder var createdGraphFromSwiftdeps : [ Diagnostic . Message ] {
1262
1307
" Incremental compilation: Created dependency graph from swiftdeps files "
0 commit comments