Make clean task run exclusively

Cherry-picked acf6c1191e
This commit is contained in:
Eugene Yokota 2017-04-12 02:06:31 -04:00 committed by Dale Wijnand
parent 183adc3d23
commit 377ff91484
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
2 changed files with 12 additions and 6 deletions

View File

@ -344,7 +344,7 @@ object Defaults extends BuildCommon {
lazy val projectTasks: Seq[Setting[_]] = Seq(
cleanFiles := cleanFilesTask.value,
cleanKeepFiles := historyPath.value.toVector,
clean := IO.delete(cleanFiles.value),
clean := (Def.task { IO.delete(cleanFiles.value) } tag (Tags.Clean)).value,
consoleProject := consoleProjectTask.value,
watchTransitiveSources := watchTransitiveSourcesTask.value,
watch := watchSetting.value
@ -647,10 +647,15 @@ object Defaults extends BuildCommon {
def detectTests: Initialize[Task[Seq[TestDefinition]]] = (loadedTestFrameworks, compile, streams) map { (frameworkMap, analysis, s) =>
Tests.discover(frameworkMap.values.toList, analysis, s.log)._1
}
def defaultRestrictions: Initialize[Seq[Tags.Rule]] = parallelExecution { par =>
val max = EvaluateTask.SystemProcessors
Tags.limitAll(if (par) max else 1) :: Tags.limit(Tags.ForkedTestGroup, 1) :: Nil
}
def defaultRestrictions: Initialize[Seq[Tags.Rule]] =
Def.setting {
val par = parallelExecution.value
val max = EvaluateTask.SystemProcessors
Tags.limitAll(if (par) max else 1) ::
Tags.limit(Tags.ForkedTestGroup, 1) ::
Tags.exclusiveGroup(Tags.Clean) ::
Nil
}
lazy val packageBase: Seq[Setting[_]] = Seq(
artifact := Artifact(moduleName.value)

View File

@ -13,6 +13,7 @@ object Tags {
val Test = Tag("test")
val Update = Tag("update")
val Publish = Tag("publish")
val Clean = Tag("clean")
val CPU = Tag("cpu")
val Network = Tag("network")
@ -111,4 +112,4 @@ object Tags {
val groups = exclusiveTags.count(tag => tags.getOrElse(tag, 0) > 0)
groups <= 1
}
}
}