Fixes "Could not create directory ...classes.bak"

Fixes https://github.com/sbt/sbt/issues/1673

There's been report of intermittent "Could not create directory" error related to "classes.bak." retronym identified that all configurations are using the same directory, and that might be the cause of race condition.
This addresses the issue by assigning a unique directory for each configuration.
This commit is contained in:
Eugene Yokota 2019-10-02 23:50:19 -04:00
parent e062a61bfe
commit 9cf3243407
1 changed files with 14 additions and 8 deletions

View File

@ -471,13 +471,6 @@ object Defaults extends BuildCommon {
// This is included into JvmPlugin.projectSettings
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
incOptions := incOptions.value
.withClassfileManagerType(
Option(
TransactionalManagerType
.of(crossTarget.value / "classes.bak", sbt.util.Logger.Null): ClassFileManagerType
).toOptional
),
scalaInstance := scalaInstanceTask.value,
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled),
sbtBinaryVersion in pluginCrossBuild := binarySbtVersion(
@ -657,7 +650,20 @@ object Defaults extends BuildCommon {
prev + (version -> (dependencyClasspathFiles / outputFileStamps).value)
},
compileBinaryFileInputs := compileBinaryFileInputs.triggeredBy(compile).value,
incOptions := { incOptions.value.withExternalHooks(externalHooks.value) },
incOptions := {
val old = incOptions.value
old
.withExternalHooks(externalHooks.value)
.withClassfileManagerType(
Option(
TransactionalManagerType
.of( // https://github.com/sbt/sbt/issues/1673
crossTarget.value / s"${prefix(configuration.value.name)}classes.bak",
sbt.util.Logger.Null
): ClassFileManagerType
).toOptional
)
},
compileIncSetup := compileIncSetupTask.value,
console := consoleTask.value,
collectAnalyses := Definition.collectAnalysesTask.map(_ => ()).value,