File tree 2 files changed +30
-6
lines changed
Sources/SwiftDriver/ExplicitModuleBuilds/InterModuleDependencies
2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ internal extension InterModuleDependencyGraph {
367
367
}
368
368
}
369
369
370
- // Check if any of the textual sources of this module are newer than this module
370
+ // Check if any of the input sources of this module are newer than this module
371
371
switch checkedModuleInfo. details {
372
372
case . swift( let swiftDetails) :
373
373
if let moduleInterfacePath = swiftDetails. moduleInterfacePath {
@@ -400,11 +400,12 @@ internal extension InterModuleDependencyGraph {
400
400
}
401
401
}
402
402
case . swiftPrebuiltExternal( _) :
403
- // TODO: We have to give-up here until we have a way to verify the timestamp of the binary module.
404
- // We can do better here by knowing if this module hasn't changed - which would allows us to not
405
- // invalidate any of the dependencies that depend on it.
406
- reporter? . report ( " Unable to verify binary module dependency up-to-date: \( moduleID. moduleNameForDiagnostic) " )
407
- return false ;
403
+ // We do not verify the binary module itself being out-of-date if we do not have a textual
404
+ // interface it was built from, but we can safely treat it as up-to-date, particularly
405
+ // because if it is newer than any of the modules they depend on it, they will
406
+ // still get invalidated in the check above for whether a module has
407
+ // any dependencies newer than it.
408
+ return true ;
408
409
case . swiftPlaceholder( _) :
409
410
// TODO: This should never ever happen. Hard error?
410
411
return false ;
Original file line number Diff line number Diff line change @@ -516,6 +516,29 @@ extension IncrementalCompilationTests {
516
516
linking
517
517
}
518
518
}
519
+
520
+ func testExplicitIncrementalBuildUnchangedBinaryDependencyDoesNotInvalidateUpstreamDependencies( ) throws {
521
+ replace ( contentsOf: " other " , with: " import J; " )
522
+ try buildInitialState ( checkDiagnostics: false , explicitModuleBuild: true )
523
+ // Touch one of the inputs to actually trigger the incremental build, so that we can ensure
524
+ // no module deps get re-built
525
+ touch ( inputPath ( basename: " other " ) )
526
+
527
+ try doABuild (
528
+ " Unchanged binary dependency (G) " ,
529
+ checkDiagnostics: false ,
530
+ extraArguments: explicitBuildArgs,
531
+ whenAutolinking: autolinkLifecycleExpectedDiags
532
+ ) {
533
+ readGraph
534
+ enablingCrossModule
535
+ readInterModuleGraph
536
+ interModuleDependencyGraphUpToDate
537
+ schedulingChangedInitialQueuing ( " other " )
538
+ reading ( deps: " other " )
539
+ schedLinking
540
+ }
541
+ }
519
542
}
520
543
521
544
extension IncrementalCompilationTests {
You can’t perform that action at this time.
0 commit comments