mirror of https://github.com/sbt/sbt.git
Add support for compile task specific settings on `compile` task axis
So far we had ability to configure compile task specific settings on `Compile` Configuration scope only. We can now add `compile` task scope as well. Usecase: one can now specify: ``` // applies for all tasks on Compile axis scalacOptions in Compile += "-deprecation" // applies for compile tasks on Compile axis scalacOptions in (Compile, compile) += "-Xcheckinit" // effectively, "-deprecation -Xcheckinit" ```
This commit is contained in:
parent
14f6d7fd87
commit
2e554c10ba
|
|
@ -208,7 +208,7 @@ object Defaults extends BuildCommon
|
||||||
}
|
}
|
||||||
def compilersSetting = compilers <<= (scalaInstance, appConfiguration, streams, classpathOptions, javaHome) map { (si, app, s, co, jh) => Compiler.compilers(si, co, jh)(app, s.log) }
|
def compilersSetting = compilers <<= (scalaInstance, appConfiguration, streams, classpathOptions, javaHome) map { (si, app, s, co, jh) => Compiler.compilers(si, co, jh)(app, s.log) }
|
||||||
|
|
||||||
lazy val configTasks = docSetting(doc) ++ compileInputsSettings ++ Seq(
|
lazy val configTasks = docSetting(doc) ++ compileTaskSettings ++ compileInputsSettings ++ Seq(
|
||||||
initialCommands in GlobalScope :== "",
|
initialCommands in GlobalScope :== "",
|
||||||
cleanupCommands in GlobalScope :== "",
|
cleanupCommands in GlobalScope :== "",
|
||||||
compile <<= compileTask tag(Tags.Compile, Tags.CPU),
|
compile <<= compileTask tag(Tags.Compile, Tags.CPU),
|
||||||
|
|
@ -515,7 +515,9 @@ object Defaults extends BuildCommon
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
|
|
||||||
def compileTask = (compileInputs, streams) map { (i,s) => Compiler(i,s.log) }
|
def compileTaskSettings: Seq[Setting[_]] = inTask(compile)(compileInputsSettings)
|
||||||
|
|
||||||
|
def compileTask = (compileInputs in compile, streams) map { (i,s) => Compiler(i,s.log) }
|
||||||
def compileIncSetupTask =
|
def compileIncSetupTask =
|
||||||
(dependencyClasspath, cacheDirectory, skip in compile, definesClass) map { (cp, cacheDir, skip, definesC) =>
|
(dependencyClasspath, cacheDirectory, skip in compile, definesClass) map { (cp, cacheDir, skip, definesC) =>
|
||||||
Compiler.IncSetup(analysisMap(cp), definesC, skip, cacheDir / "inc_compile")
|
Compiler.IncSetup(analysisMap(cp), definesC, skip, cacheDir / "inc_compile")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
object A {
|
||||||
|
def x(i: Int) = 3
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
object B {
|
||||||
|
def x(i: Int) = 3
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
object C {
|
||||||
|
// broken method, D doesn't exist
|
||||||
|
def x: Int = D.i
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
-> compile
|
||||||
|
|
||||||
|
> 'set sources in (Compile, compile) <<= sources in (Compile, compile) map { _.filterNot(_.getName contains "C") }'
|
||||||
|
|
||||||
|
> compile
|
||||||
Loading…
Reference in New Issue