@@ -330,7 +330,7 @@ extension IncrementalCompilationState {
330
330
+ inputsMissingOutputs)
331
331
if let reporter = reporter {
332
332
for scheduledInput in definitelyRequiredInputs. sorted ( by: { $0. file. name < $1. file. name} ) {
333
- reporter. report ( " Queuing (initial): " , path : scheduledInput)
333
+ reporter. report ( " Queuing (initial): " , scheduledInput)
334
334
}
335
335
}
336
336
@@ -349,7 +349,7 @@ extension IncrementalCompilationState {
349
349
350
350
if let reporter = reporter {
351
351
for dependent in speculativeInputs. sorted ( by: { $0. file. name < $1. file. name} ) {
352
- reporter. report ( " Queuing because of the initial set: " , path : dependent)
352
+ reporter. report ( " Queuing because of the initial set: " , dependent)
353
353
}
354
354
}
355
355
let immediatelyCompiledInputs = definitelyRequiredInputs. union ( speculativeInputs)
@@ -358,7 +358,7 @@ extension IncrementalCompilationState {
358
358
. subtracting ( immediatelyCompiledInputs)
359
359
if let reporter = reporter {
360
360
for skippedInput in skippedInputs. sorted ( by: { $0. file. name < $1. file. name} ) {
361
- reporter. report ( " Skipping input: " , path : skippedInput)
361
+ reporter. report ( " Skipping input: " , skippedInput)
362
362
}
363
363
}
364
364
return skippedInputs
@@ -404,17 +404,17 @@ extension IncrementalCompilationState {
404
404
405
405
switch previousCompilationStatus {
406
406
case . upToDate where datesMatch:
407
- reporter? . report ( " May skip current input: " , path : input)
407
+ reporter? . report ( " May skip current input: " , input)
408
408
return nil
409
409
410
410
case . upToDate:
411
- reporter? . report ( " Scheduing changed input " , path : input)
411
+ reporter? . report ( " Scheduing changed input " , input)
412
412
case . newlyAdded:
413
- reporter? . report ( " Scheduling new " , path : input)
413
+ reporter? . report ( " Scheduling new " , input)
414
414
case . needsCascadingBuild:
415
- reporter? . report ( " Scheduling cascading build " , path : input)
415
+ reporter? . report ( " Scheduling cascading build " , input)
416
416
case . needsNonCascadingBuild:
417
- reporter? . report ( " Scheduling noncascading build " , path : input)
417
+ reporter? . report ( " Scheduling noncascading build " , input)
418
418
}
419
419
return ChangedInput ( filePath: input,
420
420
status: previousCompilationStatus,
@@ -444,7 +444,7 @@ extension IncrementalCompilationState {
444
444
}
445
445
reporter? . report (
446
446
" Queuing because of \( forIncrementalExternalDependencies ? " incremental " : " " ) external dependency on newer \( extDep. file? . basename ?? " extDep? " ) " ,
447
- path : dependencySource. typedFile)
447
+ dependencySource. typedFile)
448
448
externalDependencySources. insert ( dependencySource)
449
449
}
450
450
}
@@ -481,7 +481,7 @@ extension IncrementalCompilationState {
481
481
for dep in dependentsOfOneFile where !cascadingFileSet. contains ( dep) {
482
482
if dependentFiles. insert ( dep) . 0 {
483
483
reporter? . report (
484
- " Immediately scheduling dependent on \( cascadingFile. file. basename) " , path : dep)
484
+ " Immediately scheduling dependent on \( cascadingFile. file. basename) " , dep)
485
485
}
486
486
}
487
487
}
@@ -560,7 +560,8 @@ extension IncrementalCompilationState {
560
560
561
561
if let reporter = self . reporter {
562
562
for input in discoveredInputs {
563
- reporter. report ( " Queuing because of dependencies discovered later: " , path: input)
563
+ reporter. report (
564
+ " Queuing because of dependencies discovered later: " , input)
564
565
}
565
566
}
566
567
let newJobs = try getJobsFor ( discoveredCompilationInputs: discoveredInputs)
@@ -585,7 +586,8 @@ extension IncrementalCompilationState {
585
586
if let found = moduleDependencyGraph. findSourcesToCompileAfterCompiling ( input, on: self . driver. fileSystem) {
586
587
return found
587
588
}
588
- self . reporter? . report ( " Failed to read some dependencies source; compiling everything " , path: input)
589
+ self . reporter? . report (
590
+ " Failed to read some dependencies source; compiling everything " , input)
589
591
return Array ( skippedCompileGroups. keys)
590
592
}
591
593
)
@@ -603,11 +605,11 @@ extension IncrementalCompilationState {
603
605
let primaryInputs = group. compileJob. primaryInputs
604
606
assert ( primaryInputs. count == 1 )
605
607
assert ( primaryInputs [ 0 ] == input)
606
- self . reporter? . report ( " Scheduling discovered " , path : input)
608
+ self . reporter? . report ( " Scheduling discovered " , input)
607
609
return group. allJobs ( )
608
610
}
609
611
else {
610
- self . reporter? . report ( " Tried to schedule discovered input again " , path : input)
612
+ self . reporter? . report ( " Tried to schedule discovered input again " , input)
611
613
return [ ]
612
614
}
613
615
}
@@ -651,20 +653,38 @@ extension IncrementalCompilationState {
651
653
///
652
654
/// - Parameters:
653
655
/// - message: The message to emit in the remark.
654
- /// - path: If non-nil, the path of an output for an incremental job.
655
- func report( _ message: String , path: TypedVirtualPath ? = nil ) {
656
- guard let outputFileMap = outputFileMap,
657
- let path = path,
656
+ /// - path: If non-nil, the path of some file. If the output for an incremental job, will print out the
657
+ /// source and object files.
658
+ func report( _ message: String , _ path: TypedVirtualPath ? ) {
659
+ guard let path = path,
660
+ let outputFileMap = outputFileMap,
658
661
let input = path. type == . swift ? path. file : outputFileMap. getInput ( outputFile: path. file)
659
662
else {
660
- diagnosticEngine . emit ( . remark_incremental_compilation ( because : message) )
663
+ report ( message, path ? . file )
661
664
return
662
665
}
663
666
let output = outputFileMap. getOutput ( inputFile: path. file, outputType: . object)
664
667
let compiling = " {compile: \( output. basename) <= \( input. basename) } "
665
668
diagnosticEngine. emit ( . remark_incremental_compilation( because: " \( message) \( compiling) " ) )
666
669
}
667
670
671
+ /// Entry point for a simple path, won't print the compile job, path could be anything.
672
+ func report( _ message: String , _ path: VirtualPath ? ) {
673
+ guard let path = path
674
+ else {
675
+ report ( message)
676
+ diagnosticEngine. emit ( . remark_incremental_compilation( because: message) )
677
+ return
678
+ }
679
+ diagnosticEngine. emit ( . remark_incremental_compilation( because: " \( message) ' \( path. name) ' " ) )
680
+ }
681
+
682
+ /// Entry point if no path.
683
+ func report( _ message: String ) {
684
+ diagnosticEngine. emit ( . remark_incremental_compilation( because: message) )
685
+ }
686
+
687
+
668
688
// Emits a remark indicating incremental compilation has been disabled.
669
689
func reportDisablingIncrementalBuild( _ why: String ) {
670
690
report ( " Disabling incremental build: \( why) " )
0 commit comments