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

Introducing ITaskContributor.

This commit is contained in:
Cedric Beust 2015-12-05 07:46:08 -08:00
parent 235ff7337f
commit b1860e64e2
10 changed files with 99 additions and 45 deletions

View file

@ -28,7 +28,8 @@ import javax.inject.Singleton
@Singleton
class PackagingPlugin @Inject constructor(val dependencyManager : DependencyManager,
val executors: KobaltExecutors, val localRepo: LocalRepo) : ConfigPlugin<InstallConfig>() {
val executors: KobaltExecutors, val localRepo: LocalRepo)
: ConfigPlugin<InstallConfig>(), ITaskContributor {
companion object {
const val PLUGIN_NAME = "Packaging"
@ -51,10 +52,13 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
private val packages = arrayListOf<PackageConfig>()
val taskContributor : TaskContributor = TaskContributor()
override fun apply(project: Project, context: KobaltContext) {
super.apply(project, context)
project.projectProperties.put(LIBS_DIR, libsDir(project))
addVariantTasks(project, "assemble", runAfter = listOf("compile"), runTask = { taskAssemble(project) })
taskContributor.addVariantTasks(project, context, "assemble", runAfter = listOf("compile"),
runTask = { taskAssemble(project) })
}
private fun libsDir(project: Project) = KFiles.makeDir(buildDir(project).path, "libs").path
@ -269,6 +273,9 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
return TaskResult()
}
//ITaskContributor
override fun tasksFor(context: KobaltContext): List<DynamicTask> = taskContributor.dynamicTasks
}
@Directive