pottering about with making a docker-compose plugin

This commit is contained in:
Adam 2022-09-18 17:35:38 +02:00
parent 16dc72ae71
commit 805d4c8170
7 changed files with 177 additions and 6 deletions

View file

@ -45,10 +45,8 @@ val dockerRemove by tasks.registering(Exec::class) {
}
afterEvaluate {
tasks.named("processRun") { dependsOn(dockerUp, dockerEnvUpdate) }
tasks.named("processKill") { dependsOn(dockerDown) }
}
tasks.matching { it.name == "processRun" }.configureEach { dependsOn(dockerUp, dockerEnvUpdate) }
tasks.matching { it.name == "processKill" }.configureEach { dependsOn(dockerDown) }
val dockerEnvUpdate by tasks.registering(DockerEnvUpdateTask::class) {

View file

@ -23,6 +23,7 @@ import org.gradle.work.NormalizeLineEndings
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
@CacheableTask
@Suppress("UnstableApiUsage")
abstract class DockerComposeExec @Inject constructor(
private val executor: ExecOperations,
private val objects: ObjectFactory,
@ -57,8 +58,9 @@ abstract class DockerComposeExec @Inject constructor(
group = DOCKER_COMPOSE_GROUP
logging.captureStandardOutput(LogLevel.LIFECYCLE)
super.onlyIf {
it is DockerComposeExec && it.dockerIsActive.getOrElse(false)
super.onlyIf { task ->
require(task is DockerComposeExec)
task.dockerIsActive.getOrElse(false)
}
}