IncOptions class backup directory should be per-compilation, not shared.

Otherwise, one concurrent compilation will clean the directory out from under another.
This commit is contained in:
Mark Harrah 2013-05-30 15:00:26 -04:00
parent 431a0be42d
commit cd2b1edf6c
2 changed files with 7 additions and 3 deletions

View File

@ -48,7 +48,9 @@ object IncOptions {
apiDumpDirectory = None,
newClassfileManager = ClassfileManager.deleteImmediately
)
def defaultTransactional(tempDir: File): IncOptions = Default.copy(newClassfileManager = ClassfileManager.transactional(tempDir))
def defaultTransactional(tempDir: File): IncOptions = setTransactional(Default, tempDir)
def setTransactional(opts: IncOptions, tempDir: File): IncOptions =
opts.copy(newClassfileManager = ClassfileManager.transactional(tempDir))
val transitiveStepKey = "transitiveStep"
val recompileAllFractionKey = "recompileAllFraction"

View File

@ -14,7 +14,7 @@ package sbt
import CrossVersion.{binarySbtVersion, binaryScalaVersion, partialVersion}
import complete._
import std.TaskExtra._
import inc.{FileValueCache, Locate}
import inc.{FileValueCache, IncOptions, Locate}
import testing.{Framework, Runner, AnnotatedFingerprint, SubclassFingerprint}
import sys.error
@ -195,13 +195,14 @@ object Defaults extends BuildCommon
)
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
incOptions in GlobalScope := sbt.inc.IncOptions.defaultTransactional(crossTarget.value.getParentFile / "classes.bak"),
incOptions := IncOptions.setTransactional(incOptions.value, crossTarget.value / "classes.bak"),
scalaInstance <<= scalaInstanceTask,
crossVersion := (if(crossPaths.value) CrossVersion.binary else CrossVersion.Disabled),
crossTarget := makeCrossTarget(target.value, scalaBinaryVersion.value, sbtBinaryVersion.value, sbtPlugin.value, crossPaths.value)
)
// must be a val: duplication detected by object identity
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(Seq(
incOptions := IncOptions.Default,
classpathOptions :== ClasspathOptions.boot,
classpathOptions in console :== ClasspathOptions.repl,
compileOrder :== CompileOrder.Mixed,
@ -218,6 +219,7 @@ object Defaults extends BuildCommon
val scalaBase = if(cross) t / ("scala-" + sv) else t
if(plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
}
def compilersSetting = compilers := Compiler.compilers(scalaInstance.value, classpathOptions.value, javaHome.value)(appConfiguration.value, streams.value.log)
lazy val configTasks = docTaskSettings(doc) ++ inTask(compile)(compileInputsSettings) ++ configGlobal ++ Seq(