Gradle version bump, and fiddling with some gradle config. Add a 'hardReset' Gradle task. Add a 'docker remove' task.

This commit is contained in:
Adam 2022-03-09 21:40:40 +01:00
parent a9782a4d90
commit e630ce3702
19 changed files with 77 additions and 52 deletions

View file

@ -1,21 +1,30 @@
package dev.adamko.kafkatorio
import org.gradle.api.internal.tasks.userinput.UserInputHandler
import org.gradle.kotlin.dsl.support.serviceOf
plugins {
idea
base
idea
}
group = "${rootProject.group}.${project.name}"
group = rootProject.group
version = rootProject.version
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}
tasks.withType<WriteProperties>().configureEach {
encoding = Charsets.UTF_8.name()
comment = " Do not edit manually. This file was created with task '$name'"
}
val hardReset by tasks.registering(Delete::class) {
group = rootProject.name
doFirst("hardResetConfirmation") {
val answer = project.serviceOf<UserInputHandler>()
.askYesNoQuestion("Are you sure you want to permanently delete Kafkatorio data?")
if (answer != true) {
throw GradleException("Aborting hard reset")
}
}
}

View file

@ -31,6 +31,16 @@ val dockerDown by tasks.registering(Exec::class) {
commandLine = parseSpaceSeparatedArgs(""" docker-compose down """)
}
val dockerRemove by tasks.registering(Exec::class) {
group = dockerComposeTaskGroup
logging.captureStandardOutput(LogLevel.LIFECYCLE)
workingDir = dockerSrcDir.asFile
commandLine = parseSpaceSeparatedArgs(""" docker-compose rm --stop -v -f """)
}
afterEvaluate {
tasks.named("processRun") { dependsOn(dockerUp, dockerEnv) }
tasks.named("processKill") { dependsOn(dockerDown) }