Skip to content

Commit

Permalink
Merge pull request #988 from ephemerist/feature/cycle-logging
Browse files Browse the repository at this point in the history
Enable cycle reporting when scalac isn't invoked
  • Loading branch information
eed3si9n committed Jun 22, 2021
2 parents 2c94c3b + 3209b9c commit a5756d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,20 @@ object Analysis {

def empty: Analysis = Empty

def summary(a: Analysis): String = {
case class Sources(java: Set[String], scala: Set[String])

def sources(a: Analysis): Sources = {
def sourceFileForClass(className: String): VirtualFileRef =
a.relations.definesClass(className).headOption.getOrElse {
sys.error(s"Can't find source file for $className")
}
def isJavaClass(className: String) = sourceFileForClass(className).id.endsWith(".java")
val (j, s) = a.apis.allInternalClasses.partition(isJavaClass)
Sources(j.toSet, s.toSet)
}

def summary(a: Analysis): String = {
val Sources(j, s) = sources(a)
val c = a.stamps.allProducts
val ext = a.apis.allExternals
val jars = a.relations.allLibraryDeps.filter(_.id.endsWith(".jar"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ private[inc] abstract class IncrementalCommon(
val continue = nextInvalidations.nonEmpty &&
lookup.shouldDoIncrementalCompilation(nextInvalidations, analysis)

// If we're completing the cycle, then mergeAndInvalidate has already been called
if (!completingCycle) {
val hasScala = Analysis.sources(partialAnalysis).scala.nonEmpty

// If we're completing the cycle and we had scala sources, then mergeAndInvalidate has already been called
if (!completingCycle || !hasScala) {
registerCycle(recompiledClasses, newApiChanges, nextInvalidations, continue)
}
CompileCycleResult(continue, nextInvalidations, analysis)
Expand Down

0 comments on commit a5756d9

Please sign in to comment.