Skip to content

Commit 6381827

Browse files
committed
Add separators for compilation cycles
1 parent 0ccc1b3 commit 6381827

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object Incremental {
7676
else
7777
incremental.log.debug(
7878
"All initially invalidated classes: " + initialInvClasses + "\n" +
79-
"All initially invalidated sources:" + initialInvSources + "\n")
79+
"All initially invalidated sources: " + initialInvSources + "\n")
8080
val analysis = manageClassfiles(options) { classfileManager =>
8181
incremental.cycle(initialInvClasses,
8282
initialInvSources,

internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
4747
if (invalidatedRaw.isEmpty && modifiedSrcs.isEmpty)
4848
previous
4949
else {
50+
debugOuterSection(s"Recompilation cycle #$cycleNum")
5051
val invalidatedPackageObjects =
5152
this.invalidatedPackageObjects(invalidatedRaw, previous.relations, previous.apis)
5253
if (invalidatedPackageObjects.nonEmpty)
@@ -111,23 +112,18 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
111112
val invalidatedSources = classes.flatMap(previous.relations.definesClass) ++ modifiedSrcs
112113
val invalidatedSourcesForCompilation = expand(invalidatedSources, allSources)
113114
val pruned = Incremental.prune(invalidatedSourcesForCompilation, previous, classfileManager)
114-
debugSection("Pruned")(pruned.relations)
115+
debugInnerSection("Pruned")(pruned.relations)
115116

116117
val fresh = doCompile(invalidatedSourcesForCompilation, binaryChanges)
117118
// For javac as class files are added to classfileManager as they are generated, so
118119
// this step is redundant. For scalac this is still necessary. TODO: do the same for scalac.
119120
classfileManager.generated(fresh.relations.allProducts.toArray)
120-
debugSection("Fresh")(fresh.relations)
121+
debugInnerSection("Fresh")(fresh.relations)
121122
val merged = pruned ++ fresh //.copy(relations = pruned.relations ++ fresh.relations, apis = pruned.apis ++ fresh.apis)
122-
debugSection("Merged")(merged.relations)
123+
debugInnerSection("Merged")(merged.relations)
123124
(merged, invalidatedSourcesForCompilation)
124125
}
125126

126-
private[this] def debugSection(header: String)(content: => Any): Unit = {
127-
import Console._
128-
debug(s"$CYAN************* $header:$RESET\n$content\n$CYAN************* (end of $header)$RESET")
129-
}
130-
131127
private[this] def emptyChanges: DependencyChanges = new DependencyChanges {
132128
val modifiedBinaries = new Array[File](0)
133129
val modifiedClasses = new Array[String](0)
@@ -338,6 +334,7 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
338334
val allInvalidatedClasses = invalidatedClasses ++ byExtSrcDep
339335
val allInvalidatedSourcefiles = addedSrcs ++ modifiedSrcs ++ byProduct ++ byBinaryDep
340336

337+
debugOuterSection(s"Initial invalidation")
341338
if (previous.allSources.isEmpty)
342339
log.debug("Full compilation, no sources in previous analysis.")
343340
else if (allInvalidatedClasses.isEmpty && allInvalidatedSourcefiles.isEmpty)
@@ -506,4 +503,15 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
506503
}
507504
xs.toSet
508505
}
506+
507+
private[this] def debugOuterSection(header: String): Unit = {
508+
import Console._
509+
log.debug(s"$GREEN*************************** $header$RESET")
510+
}
511+
512+
private[this] def debugInnerSection(header: String)(content: => Any): Unit = {
513+
import Console._
514+
debug(s"$CYAN************* $header:$RESET\n$content\n$CYAN************* (end of $header)$RESET")
515+
}
516+
509517
}

0 commit comments

Comments
 (0)