mirror of https://github.com/sbt/sbt.git
Merge branch 'pr/3316' into wip/integration
This commit is contained in:
commit
c2c1d0ff12
|
|
@ -74,7 +74,7 @@ import Scope.{ fillTaskAxis, GlobalScope, ThisScope }
|
||||||
import sjsonnew.{ IsoLList, JsonFormat, LList, LNil }, LList.:*:
|
import sjsonnew.{ IsoLList, JsonFormat, LList, LNil }, LList.:*:
|
||||||
import std.TaskExtra._
|
import std.TaskExtra._
|
||||||
import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint }
|
import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint }
|
||||||
import xsbti.compile.IncToolOptionsUtil
|
import xsbti.compile.{ IncToolOptionsUtil, AnalysisContents }
|
||||||
import xsbti.CrossValue
|
import xsbti.CrossValue
|
||||||
|
|
||||||
// incremental compiler
|
// incremental compiler
|
||||||
|
|
@ -101,7 +101,7 @@ import sbt.internal.inc.{
|
||||||
Analysis,
|
Analysis,
|
||||||
FileValueCache,
|
FileValueCache,
|
||||||
Locate,
|
Locate,
|
||||||
LoggerReporter,
|
ManagedLoggedReporter,
|
||||||
MixedAnalyzingCompiler,
|
MixedAnalyzingCompiler,
|
||||||
ScalaInstance
|
ScalaInstance
|
||||||
}
|
}
|
||||||
|
|
@ -492,8 +492,11 @@ object Defaults extends BuildCommon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def defaultCompileSettings: Seq[Setting[_]] =
|
||||||
|
globalDefaults(enableBinaryCompileAnalysis := true)
|
||||||
|
|
||||||
lazy val configTasks: Seq[Setting[_]] = docTaskSettings(doc) ++ inTask(compile)(
|
lazy val configTasks: Seq[Setting[_]] = docTaskSettings(doc) ++ inTask(compile)(
|
||||||
compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq(
|
compileInputsSettings) ++ configGlobal ++ defaultCompileSettings ++ compileAnalysisSettings ++ Seq(
|
||||||
compile := compileTask.value,
|
compile := compileTask.value,
|
||||||
manipulateBytecode := compileIncremental.value,
|
manipulateBytecode := compileIncremental.value,
|
||||||
compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value,
|
compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value,
|
||||||
|
|
@ -1369,11 +1372,14 @@ object Defaults extends BuildCommon {
|
||||||
|
|
||||||
def compileTask: Initialize[Task[CompileAnalysis]] = Def.task {
|
def compileTask: Initialize[Task[CompileAnalysis]] = Def.task {
|
||||||
val setup: Setup = compileIncSetup.value
|
val setup: Setup = compileIncSetup.value
|
||||||
|
val useBinary: Boolean = enableBinaryCompileAnalysis.value
|
||||||
// TODO - expose bytecode manipulation phase.
|
// TODO - expose bytecode manipulation phase.
|
||||||
val analysisResult: CompileResult = manipulateBytecode.value
|
val analysisResult: CompileResult = manipulateBytecode.value
|
||||||
if (analysisResult.hasModified) {
|
if (analysisResult.hasModified) {
|
||||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile)
|
val store =
|
||||||
store.set(analysisResult.analysis, analysisResult.setup)
|
MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary)
|
||||||
|
val contents = AnalysisContents.create(analysisResult.analysis(), analysisResult.setup())
|
||||||
|
store.set(contents)
|
||||||
}
|
}
|
||||||
analysisResult.analysis
|
analysisResult.analysis
|
||||||
}
|
}
|
||||||
|
|
@ -1435,9 +1441,13 @@ object Defaults extends BuildCommon {
|
||||||
f1(foldMappers(sourcePositionMappers.value)),
|
f1(foldMappers(sourcePositionMappers.value)),
|
||||||
compileOrder.value
|
compileOrder.value
|
||||||
),
|
),
|
||||||
compilerReporter := new LoggerReporter(maxErrors.value,
|
compilerReporter := {
|
||||||
|
new ManagedLoggedReporter(
|
||||||
|
maxErrors.value,
|
||||||
streams.value.log,
|
streams.value.log,
|
||||||
foldMappers(sourcePositionMappers.value)),
|
foldMappers(sourcePositionMappers.value)
|
||||||
|
)
|
||||||
|
},
|
||||||
compileInputs := new Inputs(
|
compileInputs := new Inputs(
|
||||||
compilers.value,
|
compilers.value,
|
||||||
compileOptions.value,
|
compileOptions.value,
|
||||||
|
|
@ -1460,10 +1470,13 @@ object Defaults extends BuildCommon {
|
||||||
def compileAnalysisSettings: Seq[Setting[_]] = Seq(
|
def compileAnalysisSettings: Seq[Setting[_]] = Seq(
|
||||||
previousCompile := {
|
previousCompile := {
|
||||||
val setup = compileIncSetup.value
|
val setup = compileIncSetup.value
|
||||||
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile)
|
val useBinary: Boolean = enableBinaryCompileAnalysis.value
|
||||||
store.get() match {
|
val store = MixedAnalyzingCompiler.staticCachedStore(setup.cacheFile, !useBinary)
|
||||||
case Some((an, setup)) =>
|
store.get().toOption match {
|
||||||
new PreviousResult(Option(an).toOptional, Option(setup).toOptional)
|
case Some(contents) =>
|
||||||
|
val analysis = Option(contents.getAnalysis).toOptional
|
||||||
|
val setup = Option(contents.getMiniSetup).toOptional
|
||||||
|
new PreviousResult(analysis, setup)
|
||||||
case None => new PreviousResult(jnone[CompileAnalysis], jnone[MiniSetup])
|
case None => new PreviousResult(jnone[CompileAnalysis], jnone[MiniSetup])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1477,10 +1490,8 @@ object Defaults extends BuildCommon {
|
||||||
val problems =
|
val problems =
|
||||||
analysis.infos.allInfos.values.flatMap(i =>
|
analysis.infos.allInfos.values.flatMap(i =>
|
||||||
i.getReportedProblems ++ i.getUnreportedProblems)
|
i.getReportedProblems ++ i.getUnreportedProblems)
|
||||||
val reporter = new LoggerReporter(max, streams.value.log, foldMappers(spms))
|
val reporter = new ManagedLoggedReporter(max, streams.value.log, foldMappers(spms))
|
||||||
problems foreach { p =>
|
problems.foreach(p => reporter.log(p))
|
||||||
reporter.display(p)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID =
|
def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID =
|
||||||
|
|
|
||||||
|
|
@ -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 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 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 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 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)
|
val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.", APlusTask)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue