mirror of https://github.com/sbt/sbt.git
Add setting to switch to text analysis
As per suggestions in https://github.com/sbt/zinc/pull/351.
This commit is contained in:
parent
0cc3cfb364
commit
32d8f47248
|
|
@ -492,8 +492,11 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
}
|
||||
|
||||
def defaultCompileSettings: Seq[Setting[_]] =
|
||||
globalDefaults(enableBinaryCompileAnalysis := true)
|
||||
|
||||
lazy val configTasks: Seq[Setting[_]] = docTaskSettings(doc) ++ inTask(compile)(
|
||||
compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq(
|
||||
compileInputsSettings) ++ configGlobal ++ defaultCompileSettings ++ compileAnalysisSettings ++ Seq(
|
||||
compile := compileTask.value,
|
||||
manipulateBytecode := compileIncremental.value,
|
||||
compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value,
|
||||
|
|
@ -1369,10 +1372,11 @@ object Defaults extends BuildCommon {
|
|||
|
||||
def compileTask: Initialize[Task[CompileAnalysis]] = Def.task {
|
||||
val setup: Setup = compileIncSetup.value
|
||||
val useBinary: Boolean = enableBinaryCompileAnalysis.value
|
||||
// TODO - expose bytecode manipulation phase.
|
||||
val analysisResult: CompileResult = manipulateBytecode.value
|
||||
if (analysisResult.hasModified) {
|
||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile)
|
||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !enableBinaryCompileAnalysis)
|
||||
store.set(analysisResult.analysis, analysisResult.setup)
|
||||
}
|
||||
analysisResult.analysis
|
||||
|
|
@ -1464,7 +1468,8 @@ object Defaults extends BuildCommon {
|
|||
def compileAnalysisSettings: Seq[Setting[_]] = Seq(
|
||||
previousCompile := {
|
||||
val setup = compileIncSetup.value
|
||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile)
|
||||
val useBinary: Boolean = enableBinaryCompileAnalysis.value
|
||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary)
|
||||
store.get() match {
|
||||
case Some((an, setup)) =>
|
||||
new PreviousResult(Option(an).toOptional, Option(setup).toOptional)
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ object Keys {
|
|||
val fileInputOptions = SettingKey[Seq[String]]("file-input-options", "Options that take file input, which may invalidate the cache.", CSetting)
|
||||
val scalaCompilerBridgeSource = SettingKey[ModuleID]("scala-compiler-bridge-source", "Configures the module ID of the sources of the compiler bridge.", CSetting)
|
||||
val scalaArtifacts = SettingKey[Seq[String]]("scala-artifacts", "Configures the list of artifacts which should match the Scala binary version", CSetting)
|
||||
val enableBinaryCompileAnalysis = SettingKey[Boolean]("binary-analysis", "Writes the analysis file in binary format")
|
||||
|
||||
val clean = TaskKey[Unit]("clean", "Deletes files produced by the build, such as generated sources, compiled classes, and task caches.", APlusTask)
|
||||
val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.", APlusTask)
|
||||
|
|
|
|||
Loading…
Reference in New Issue