Skip to content

Commit

Permalink
Colors for initial invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszwawrzyk committed Aug 17, 2018
1 parent c6ddaa4 commit 4306042
Showing 1 changed file with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
val merged = pruned ++ fresh //.copy(relations = pruned.relations ++ fresh.relations, apis = pruned.apis ++ fresh.apis)

if (fresh.relations == merged.relations) {
debugInnerSection("Fresh [== Merged]")(fresh.relations)
debugInnerSection("Fresh == Merged")(fresh.relations)
} else {
debugInnerSection("Fresh")(fresh.relations)
debugInnerSection("Merged")(merged.relations)
Expand Down Expand Up @@ -344,21 +344,37 @@ private[inc] abstract class IncrementalCommon(val log: sbt.util.Logger, options:
log.debug("Full compilation, no sources in previous analysis.")
else if (allInvalidatedClasses.isEmpty && allInvalidatedSourcefiles.isEmpty)
log.debug("No changes")
else
else {
def color(s: String) = Console.YELLOW + s + Console.RESET
log.debug(
"\nInitial source changes: \n\tremoved:" + removedSrcs + "\n\tadded: " + addedSrcs + "\n\tmodified: " + modifiedSrcs +
"\nInvalidated products: " + changes.removedProducts +
"\nExternal API changes: " + changes.external +
"\nModified binary dependencies: " + changes.binaryDeps +
"\nInitial directly invalidated classes: " + invalidatedClasses +
"\n\nSources indirectly invalidated by:" +
"\n\tproduct: " + byProduct +
"\n\tbinary dep: " + byBinaryDep +
"\n\texternal source: " + byExtSrcDep
s"""
|${color("Initial source changes")}:
| ${color("removed")}: ${showSet(removedSrcs, baseIndent = " ")}
| ${color("added")}: ${showSet(addedSrcs, baseIndent = " ")}
| ${color("modified")}: ${showSet(modifiedSrcs, baseIndent = " ")}
|${color("Invalidated products")}: ${showSet(changes.removedProducts)}
|${color("External API changes")}: ${changes.external}
|${color("Modified binary dependencies")}: ${changes.binaryDeps}
|${color("Initial directly invalidated classes")}: $invalidatedClasses
|
|${color("Sources indirectly invalidated by")}:
| ${color("product")}: ${showSet(byProduct, baseIndent = " ")}
| ${color("binary dep")}: ${showSet(byBinaryDep, baseIndent = " ")}
| ${color("external source")}: ${showSet(byExtSrcDep, baseIndent = " ")}""".stripMargin
)
}

(allInvalidatedClasses, allInvalidatedSourcefiles)
}

private def showSet[A](s: Set[A], baseIndent: String = ""): String = {
if (s.isEmpty) {
"[]"
} else {
s.map(baseIndent + " " + _.toString).mkString("[\n", ",\n", "\n" + baseIndent + "]")
}
}

private[this] def checkAbsolute(addedSources: List[File]): Unit =
if (addedSources.nonEmpty) {
addedSources.filterNot(_.isAbsolute) match {
Expand Down

0 comments on commit 4306042

Please sign in to comment.