From 7604cbf06bb3376a89ad0fafe9aa914b39439daf Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 15 Jan 2016 02:09:15 +0400 Subject: [PATCH] Polish. --- .../com/beust/kobalt/internal/TaskManager.kt | 17 ++++++++++++----- .../kotlin/com/beust/kobalt/misc/Strings.kt | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt index 059ab2d5..784d3e6b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt @@ -7,6 +7,7 @@ import com.beust.kobalt.api.PluginTask import com.beust.kobalt.api.Project import com.beust.kobalt.api.annotation.IncrementalTask import com.beust.kobalt.api.annotation.Task +import com.beust.kobalt.misc.Strings import com.beust.kobalt.misc.benchmarkMillis import com.beust.kobalt.misc.kobaltError 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? val fp = project.projectInfo.dependsOn.filter { failedProjects.contains(it.name) + }.map { + it.name } + if (fp.size > 0) { + log(2, "Marking project ${project.name} as skipped") failedProjects.add(project.name) - kobaltError("Not building project ${project.name} since it depends on failed projects " - + fp.joinToString(",")) + kobaltError("Not building project ${project.name} since it depends on failed " + + Strings.pluralize("project", fp.size) + + " " + fp.joinToString(",")) } else { val projectName = project.name // 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 thisResult = executor.run() + if (thisResult != 0) { + log(2, "Marking project ${project.name} as failed") + failedProjects.add(project.name) + } if (result == 0) { result = thisResult } - if (result != 0) { - failedProjects.add(project.name) - } } } return RunTargetResult(result, messages) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Strings.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Strings.kt index 113488f1..de701e4e 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Strings.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/Strings.kt @@ -19,6 +19,8 @@ public class Strings { fun isEmpty(s: String?): Boolean { return s == null || s.isEmpty() } + + fun pluralize(s: String, n: Int) = s + (if (n != 1) "s" else "") } }