-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See also sbt/zinc#1326 This adds a new setting `enableConsistentCompileAnalysis`, which enables the new "Consistent" Analysis format, which is faster and more repeatable than the status quo. This is initialized to `true` by default. It can be opted out either by the setting or using `-Dsbt.analysis2024=false`.
- Loading branch information
Showing
10 changed files
with
121 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* sbt | ||
* Copyright 2023, Scala center | ||
* Copyright 2011 - 2022, Lightbend, Inc. | ||
* Copyright 2008 - 2010, Mark Harrah | ||
* Licensed under Apache License 2.0 (see LICENSE) | ||
*/ | ||
|
||
package sbt | ||
package internal | ||
|
||
import java.nio.file.Path | ||
import sbt.internal.inc.MixedAnalyzingCompiler | ||
import scala.concurrent.ExecutionContext | ||
import xsbti.compile.{ AnalysisStore => XAnalysisStore } | ||
import xsbti.compile.analysis.ReadWriteMappers | ||
|
||
private[sbt] object AnalysisUtil { | ||
// some machines have many cores. | ||
// we don't want to occupy them all for analysis serialization. | ||
lazy val parallelism: Int = | ||
scala.math.min( | ||
Runtime.getRuntime.availableProcessors(), | ||
8, | ||
) | ||
def staticCachedStore( | ||
analysisFile: Path, | ||
useTextAnalysis: Boolean, | ||
useConsistent: Boolean, | ||
): XAnalysisStore = | ||
MixedAnalyzingCompiler.staticCachedStore( | ||
analysisFile = analysisFile, | ||
useTextAnalysis = useTextAnalysis, | ||
useConsistent = false, | ||
mappers = ReadWriteMappers.getEmptyMappers(), | ||
sort = true, | ||
ec = ExecutionContext.global, | ||
parallelism = parallelism, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
sbt-app/src/sbt-test/source-dependencies/export-jars/changes/B.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
object B | ||
{ | ||
def main(args: Array[String]) = assert(args(0).toInt == A.x ) | ||
} | ||
object B { | ||
def main(args: Array[String]) = assert(args(0).toInt == A.x, s"actual A.x is ${A.x}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
$ copy-file changes/B.scala B.scala | ||
|
||
$ copy-file changes/A1.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
> run 1 | ||
$ copy-file changes/A2.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
# done this way because last modified times often have ~1s resolution | ||
> run 2 | ||
$ copy-file changes/A3.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
> run 3 | ||
|
||
$ copy-file changes/build2.sbt build2.sbt | ||
> reload | ||
|
||
$ copy-file changes/A1.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
> run 1 | ||
$ copy-file changes/A2.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
> run 2 | ||
$ copy-file changes/A3.scala a/A.scala | ||
$ sleep 1000 | ||
|
||
> run 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,7 @@ $ copy-file changes/C.scala C.scala | |
-> run | ||
|
||
$ copy-file changes/A2.scala A.scala | ||
$ sleep 1000 | ||
|
||
> compile | ||
> run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters