bump project to 0.7.0 (and fix docker .env task for all docker .envs)

This commit is contained in:
Adam 2022-07-06 17:40:21 +02:00
parent 5fcb831df2
commit 665327e010
16 changed files with 78 additions and 28 deletions

View file

@ -12,7 +12,7 @@ plugins {
} }
group = "dev.adamko.kafkatorio" group = "dev.adamko.kafkatorio"
version = "0.6.1" version = "0.7.0"
val licenseFile: RegularFile by extra(layout.projectDirectory.file("LICENSE")) val licenseFile: RegularFile by extra(layout.projectDirectory.file("LICENSE"))

View file

@ -91,3 +91,6 @@ fun Project.taskProvider(taskName: String): Provider<Task> = providers.provider
}.flatMap { }.flatMap {
tasks.named(it) tasks.named(it)
} }
const val DOCKER_COMPOSE_TASK_GROUP = "docker-compose"

View file

@ -1,5 +1,7 @@
package dev.adamko.kafkatorio.infra package dev.adamko.kafkatorio.infra
import dev.adamko.kafkatorio.gradle.DOCKER_COMPOSE_TASK_GROUP
import dev.adamko.kafkatorio.task.DockerEnvUpdateTask
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins { plugins {
@ -7,14 +9,13 @@ plugins {
id("dev.adamko.kafkatorio.infra.process-runner") id("dev.adamko.kafkatorio.infra.process-runner")
} }
val dockerComposeTaskGroup: String by extra("docker-compose")
val dockerComposeProjectName: String by extra(rootProject.name) val dockerComposeProjectName: String by extra(rootProject.name)
val dockerSrcDir: Directory by extra(layout.projectDirectory.dir("src")) val dockerSrcDir: Directory by extra(layout.projectDirectory.dir("src"))
val dockerUp by tasks.registering(Exec::class) { val dockerUp by tasks.registering(Exec::class) {
group = dockerComposeTaskGroup group = DOCKER_COMPOSE_TASK_GROUP
dependsOn(tasks.assemble) dependsOn(tasks.assemble)
logging.captureStandardOutput(LogLevel.LIFECYCLE) logging.captureStandardOutput(LogLevel.LIFECYCLE)
@ -25,7 +26,7 @@ val dockerUp by tasks.registering(Exec::class) {
val dockerDown by tasks.registering(Exec::class) { val dockerDown by tasks.registering(Exec::class) {
group = dockerComposeTaskGroup group = DOCKER_COMPOSE_TASK_GROUP
logging.captureStandardOutput(LogLevel.LIFECYCLE) logging.captureStandardOutput(LogLevel.LIFECYCLE)
@ -35,7 +36,7 @@ val dockerDown by tasks.registering(Exec::class) {
val dockerRemove by tasks.registering(Exec::class) { val dockerRemove by tasks.registering(Exec::class) {
group = dockerComposeTaskGroup group = DOCKER_COMPOSE_TASK_GROUP
logging.captureStandardOutput(LogLevel.LIFECYCLE) logging.captureStandardOutput(LogLevel.LIFECYCLE)
@ -45,17 +46,13 @@ val dockerRemove by tasks.registering(Exec::class) {
afterEvaluate { afterEvaluate {
tasks.named("processRun") { dependsOn(dockerUp, dockerEnv) } tasks.named("processRun") { dependsOn(dockerUp, dockerEnvUpdate) }
tasks.named("processKill") { dependsOn(dockerDown) } tasks.named("processKill") { dependsOn(dockerDown) }
} }
val dockerEnv by tasks.registering(WriteProperties::class) { val dockerEnvUpdate by tasks.registering(DockerEnvUpdateTask::class) {
group = dockerComposeTaskGroup dotEnvFile.set(dockerSrcDir.file(".env"))
logging.captureStandardOutput(LogLevel.LIFECYCLE)
setOutputFile(dockerSrcDir.file(".env"))
properties( properties(
"COMPOSE_PROJECT_NAME" to dockerComposeProjectName, "COMPOSE_PROJECT_NAME" to dockerComposeProjectName,
@ -64,4 +61,4 @@ val dockerEnv by tasks.registering(WriteProperties::class) {
} }
tasks.assemble { dependsOn(dockerEnv) } tasks.assemble { dependsOn(dockerEnvUpdate) }

View file

@ -0,0 +1,27 @@
package dev.adamko.kafkatorio.task
import dev.adamko.kafkatorio.gradle.DOCKER_COMPOSE_TASK_GROUP
import javax.inject.Inject
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.logging.LogLevel
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.WriteProperties
@CacheableTask
open class DockerEnvUpdateTask @Inject constructor(
private val objects: ObjectFactory
) : WriteProperties() {
@Internal
val dotEnvFile: RegularFileProperty = objects.fileProperty()
init {
group = DOCKER_COMPOSE_TASK_GROUP
super.setOutputFile(dotEnvFile)
super.getLogging().captureStandardOutput(LogLevel.LIFECYCLE)
}
}

View file

@ -1,6 +1,6 @@
{ {
"name": "kafkatorio-events-mod", "name": "kafkatorio-events-mod",
"version": "0.6.1", "version": "0.7.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -1,6 +1,6 @@
{ {
"name": "kafkatorio-events-mod", "name": "kafkatorio-events-mod",
"version": "0.6.1", "version": "0.7.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "tstl", "build": "tstl",

View file

@ -1,3 +1,4 @@
import dev.adamko.kafkatorio.task.DockerEnvUpdateTask
import dev.adamko.kafkatorio.task.KafkaConsumerGroupsTask import dev.adamko.kafkatorio.task.KafkaConsumerGroupsTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@ -106,3 +107,14 @@ idea {
) )
} }
} }
val dockerEnvUpdate by tasks.registering(DockerEnvUpdateTask::class) {
dotEnvFile.set(layout.projectDirectory.file("docker/.env"))
properties(
"COMPOSE_PROJECT_NAME" to rootProject.name,
"KAFKATORIO_VERSION" to project.version,
)
}
tasks.assemble { dependsOn(dockerEnvUpdate) }

View file

@ -1,3 +1,3 @@
# Do not edit manually. This file was created with task 'dockerEnv' # Do not edit manually. This file was created with task 'dockerEnvUpdate'
COMPOSE_PROJECT_NAME=kafkatorio COMPOSE_PROJECT_NAME=kafkatorio
KAFKATORIO_VERSION=0.6.1 KAFKATORIO_VERSION=0.7.0

View file

@ -53,7 +53,7 @@ tasks.dockerUp {
} }
tasks.dockerEnv { tasks.dockerEnvUpdate {
properties("FACTORIO_VERSION" to libs.versions.factorio.get()) properties("FACTORIO_VERSION" to libs.versions.factorio.get())
} }

View file

@ -1,4 +1,4 @@
# Do not edit manually. This file was created with task 'dockerEnv' # Do not edit manually. This file was created with task 'dockerEnvUpdate'
COMPOSE_PROJECT_NAME=kafkatorio COMPOSE_PROJECT_NAME=kafkatorio
FACTORIO_VERSION=1.1.61 FACTORIO_VERSION=1.1.61
KAFKATORIO_VERSION=0.6.1 KAFKATORIO_VERSION=0.7.0

View file

@ -4,7 +4,7 @@ plugins {
description = "Kafka cluster" description = "Kafka cluster"
tasks.dockerEnv { tasks.dockerEnvUpdate {
properties( properties(
"GRAFANA_VERSION" to libs.versions.grafana, "GRAFANA_VERSION" to libs.versions.grafana,
"PROMETHEUS_VERSION" to libs.versions.prometheus, "PROMETHEUS_VERSION" to libs.versions.prometheus,

View file

@ -1,7 +1,7 @@
# Do not edit manually. This file was created with task 'dockerEnv' # Do not edit manually. This file was created with task 'dockerEnvUpdate'
COMPOSE_PROJECT_NAME=kafkatorio COMPOSE_PROJECT_NAME=kafkatorio
GRAFANA_VERSION=8.5.0 GRAFANA_VERSION=8.5.0
KAFKATORIO_VERSION=0.6.1 KAFKATORIO_VERSION=0.7.0
KAFKA_DL_URL=https\://dlcdn.apache.org/kafka/3.2.0/kafka_2.13-3.2.0.tgz KAFKA_DL_URL=https\://dlcdn.apache.org/kafka/3.2.0/kafka_2.13-3.2.0.tgz
KAFKA_VERSION=3.2.0 KAFKA_VERSION=3.2.0
PROMETHEUS_VERSION=v2.34.0 PROMETHEUS_VERSION=v2.34.0

View file

@ -15,7 +15,7 @@ tasks.dockerUp {
val dockerBuildKafkaPipe by tasks.registering(DockerComposeExec::class) { val dockerBuildKafkaPipe by tasks.registering(DockerComposeExec::class) {
dependsOn(tasks.dockerEnv) dependsOn(tasks.dockerEnvUpdate)
dockerComposeDir.set(dockerSrcDir) dockerComposeDir.set(dockerSrcDir)
command.set("docker-compose build kafka-pipe") command.set("docker-compose build kafka-pipe")

View file

@ -1,3 +1,3 @@
# Do not edit manually. This file was created with task 'dockerEnv' # Do not edit manually. This file was created with task 'dockerEnvUpdate'
COMPOSE_PROJECT_NAME=kafkatorio COMPOSE_PROJECT_NAME=kafkatorio
KAFKATORIO_VERSION=0.6.1 KAFKATORIO_VERSION=0.7.0

View file

@ -144,3 +144,14 @@ fun KotlinDependencyHandler.kvision(
// resolution("webpack-dev-server", "4.9.1") // resolution("webpack-dev-server", "4.9.1")
// } // }
//} //}
val dockerEnvUpdate by tasks.registering(dev.adamko.kafkatorio.task.DockerEnvUpdateTask::class) {
dotEnvFile.set(layout.projectDirectory.file("docker/.env"))
properties(
"COMPOSE_PROJECT_NAME" to rootProject.name,
"KAFKATORIO_VERSION" to project.version,
)
}
tasks.assemble { dependsOn(dockerEnvUpdate) }

View file

@ -1,3 +1,3 @@
# Do not edit manually. This file was created with task 'dockerEnv' # Do not edit manually. This file was created with task 'dockerEnvUpdate'
COMPOSE_PROJECT_NAME=kafkatorio COMPOSE_PROJECT_NAME=kafkatorio
KAFKATORIO_VERSION=0.6.1 KAFKATORIO_VERSION=0.7.0