mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Polish.
This commit is contained in:
parent
92f1044a82
commit
7604cbf06b
2 changed files with 14 additions and 5 deletions
|
@ -7,6 +7,7 @@ import com.beust.kobalt.api.PluginTask
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.api.annotation.IncrementalTask
|
import com.beust.kobalt.api.annotation.IncrementalTask
|
||||||
import com.beust.kobalt.api.annotation.Task
|
import com.beust.kobalt.api.annotation.Task
|
||||||
|
import com.beust.kobalt.misc.Strings
|
||||||
import com.beust.kobalt.misc.benchmarkMillis
|
import com.beust.kobalt.misc.benchmarkMillis
|
||||||
import com.beust.kobalt.misc.kobaltError
|
import com.beust.kobalt.misc.kobaltError
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
|
@ -60,11 +61,16 @@ public class TaskManager @Inject constructor(val args: Args, val incrementalMana
|
||||||
// Does the current project depend on any failed projects?
|
// Does the current project depend on any failed projects?
|
||||||
val fp = project.projectInfo.dependsOn.filter {
|
val fp = project.projectInfo.dependsOn.filter {
|
||||||
failedProjects.contains(it.name)
|
failedProjects.contains(it.name)
|
||||||
|
}.map {
|
||||||
|
it.name
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fp.size > 0) {
|
if (fp.size > 0) {
|
||||||
|
log(2, "Marking project ${project.name} as skipped")
|
||||||
failedProjects.add(project.name)
|
failedProjects.add(project.name)
|
||||||
kobaltError("Not building project ${project.name} since it depends on failed projects "
|
kobaltError("Not building project ${project.name} since it depends on failed "
|
||||||
+ fp.joinToString(","))
|
+ Strings.pluralize("project", fp.size)
|
||||||
|
+ " " + fp.joinToString(","))
|
||||||
} else {
|
} else {
|
||||||
val projectName = project.name
|
val projectName = project.name
|
||||||
// There can be multiple tasks by the same name (e.g. PackagingPlugin and AndroidPlugin both
|
// There can be multiple tasks by the same name (e.g. PackagingPlugin and AndroidPlugin both
|
||||||
|
@ -168,12 +174,13 @@ public class TaskManager @Inject constructor(val args: Args, val incrementalMana
|
||||||
|
|
||||||
val executor = DynamicGraphExecutor(graph, factory)
|
val executor = DynamicGraphExecutor(graph, factory)
|
||||||
val thisResult = executor.run()
|
val thisResult = executor.run()
|
||||||
|
if (thisResult != 0) {
|
||||||
|
log(2, "Marking project ${project.name} as failed")
|
||||||
|
failedProjects.add(project.name)
|
||||||
|
}
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = thisResult
|
result = thisResult
|
||||||
}
|
}
|
||||||
if (result != 0) {
|
|
||||||
failedProjects.add(project.name)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RunTargetResult(result, messages)
|
return RunTargetResult(result, messages)
|
||||||
|
|
|
@ -19,6 +19,8 @@ public class Strings {
|
||||||
fun isEmpty(s: String?): Boolean {
|
fun isEmpty(s: String?): Boolean {
|
||||||
return s == null || s.isEmpty()
|
return s == null || s.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun pluralize(s: String, n: Int) = s + (if (n != 1) "s" else "")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue