Skip to content

Commit

Permalink
Don't auto-invalidate java sources every cycle, take 2
Browse files Browse the repository at this point in the history
This propagates "don't auto-invalidate Java sources in every cycle" to pipelining as well.
Note that all Java sources are invalidated in Incremental.scala:
https://github.com/sbt/zinc/blob/21c73c9e6758d27a388d3df70ccbe8f85e6d04e8/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala#L386-L388

I don't think it's necessary to invalidate them for all cycles.
  • Loading branch information
eed3si9n committed Sep 6, 2020
1 parent dab5c35 commit ea8fbb9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ object Incremental {
classfileManager,
output,
1,
pickleJava,
)
else {
val analysis =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ private[inc] abstract class IncrementalCommon(
classfileManager: XClassFileManager,
output: Output,
cycleNum: Int,
isPipeline: Boolean,
) {
def toVf(ref: VirtualFileRef): VirtualFile = converter.toVirtualFile(ref)
def sourceRefs: Set[VirtualFileRef] = allSources.asInstanceOf[Set[VirtualFileRef]]
lazy val javaSources: Set[VirtualFileRef] = sourceRefs.filter(_.id.endsWith(".java"))

def hasNext: Boolean = invalidatedClasses.nonEmpty || initialChangedSources.nonEmpty

Expand Down Expand Up @@ -120,7 +118,7 @@ private[inc] abstract class IncrementalCommon(
// Return immediate analysis as all sources have been recompiled
copy(
if (continue && !handler.isFullCompilation) nextInvalidations else Set.empty,
if (continue && !handler.isFullCompilation && isPipeline) javaSources else Set.empty,
Set.empty,
binaryChanges = IncrementalCommon.emptyChanges,
previous = current,
cycleNum = cycleNum + 1,
Expand Down Expand Up @@ -231,7 +229,6 @@ private[inc] abstract class IncrementalCommon(
classfileManager: XClassFileManager,
output: Output,
cycleNum: Int,
isPipeline: Boolean
): Analysis = {
var s = CycleState(
invalidatedClasses,
Expand All @@ -245,7 +242,6 @@ private[inc] abstract class IncrementalCommon(
classfileManager,
output,
cycleNum,
isPipeline,
)
val it = iterations(s)
while (it.hasNext) {
Expand Down

0 comments on commit ea8fbb9

Please sign in to comment.