1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

Fail the build if "assemble" fails.

This commit is contained in:
Cedric Beust 2015-12-25 19:06:55 +04:00
parent 231b18302e
commit bcc6af5f37

View file

@ -1,15 +1,12 @@
package com.beust.kobalt.plugin.packaging package com.beust.kobalt.plugin.packaging
import com.beust.kobalt.Features import com.beust.kobalt.*
import com.beust.kobalt.IFileSpec
import com.beust.kobalt.IFileSpec.FileSpec import com.beust.kobalt.IFileSpec.FileSpec
import com.beust.kobalt.IFileSpec.Glob import com.beust.kobalt.IFileSpec.Glob
import com.beust.kobalt.TaskResult
import com.beust.kobalt.api.* import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Directive import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.api.annotation.ExportedProjectProperty import com.beust.kobalt.api.annotation.ExportedProjectProperty
import com.beust.kobalt.api.annotation.Task import com.beust.kobalt.api.annotation.Task
import com.beust.kobalt.glob
import com.beust.kobalt.internal.JvmCompilerPlugin import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.PomGenerator import com.beust.kobalt.maven.PomGenerator
@ -177,6 +174,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
@Task(name = TASK_ASSEMBLE, description = "Package the artifacts", @Task(name = TASK_ASSEMBLE, description = "Package the artifacts",
runAfter = arrayOf(JvmCompilerPlugin.TASK_COMPILE)) runAfter = arrayOf(JvmCompilerPlugin.TASK_COMPILE))
fun doTaskAssemble(project: Project) : TaskResult { fun doTaskAssemble(project: Project) : TaskResult {
try {
project.projectProperties.put(PACKAGES, packages) project.projectProperties.put(PACKAGES, packages)
packages.filter { it.project.name == project.name }.forEach { pkg -> packages.filter { it.project.name == project.name }.forEach { pkg ->
pkg.jars.forEach { jarGenerator.generateJar(pkg.project, context, it) } pkg.jars.forEach { jarGenerator.generateJar(pkg.project, context, it) }
@ -187,6 +185,9 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
} }
} }
return TaskResult() return TaskResult()
} catch(ex: Exception) {
throw KobaltException(ex)
}
} }
fun addPackage(p: PackageConfig) { fun addPackage(p: PackageConfig) {