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

@ -35,7 +35,7 @@ idea {
} }
tasks.wrapper { tasks.wrapper {
gradleVersion = "7.4" gradleVersion = "7.4.1"
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
} }

View file

@ -15,13 +15,12 @@ object Versions {
const val kotlin = "1.6.10" const val kotlin = "1.6.10"
const val gradleNodePlugin = "3.2.1" const val gradleNodePlugin = "3.2.1"
const val gradleDockerComposePlugin = "0.15.0" const val gradleDockerComposePlugin = "0.15.1"
const val kotlinXSerialization = "1.3.2" const val kotlinXSerialization = "1.3.2"
const val kvision = "5.8.1" const val kvision = "5.8.1"
const val semver = "1.1.2" const val semver = "1.1.2"
const val http4k = "4.19.1.0" const val http4k = "4.19.1.0"
const val jsoup = "1.14.3"
const val kotest = "5.1.0" const val kotest = "5.1.0"
} }
@ -54,7 +53,10 @@ dependencies {
implementation("org.http4k:http4k-core") implementation("org.http4k:http4k-core")
implementation("org.http4k:http4k-client-okhttp") implementation("org.http4k:http4k-client-okhttp")
implementation("org.jsoup:jsoup:${Versions.jsoup}")
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
// https://youtrack.jetbrains.com/issue/IDEA-262280#focus=Comments-27-5397040.0-0
// implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
} }

View file

@ -13,8 +13,6 @@ dependencyResolutionManagement {
mavenCentral() mavenCentral()
jitpack() jitpack()
gradlePluginPortal() gradlePluginPortal()
// maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
// maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
// Declare the Node.js download repository // Declare the Node.js download repository
ivy("https://nodejs.org/dist/") { ivy("https://nodejs.org/dist/") {
@ -32,25 +30,15 @@ dependencyResolutionManagement {
} }
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
mavenCentral() mavenCentral()
jitpack() jitpack()
// maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/")
} }
} }
} }
fun RepositoryHandler.jitpack() { fun RepositoryHandler.jitpack() {
maven("https://jitpack.io") { maven("https://jitpack.io")
// content {
// includeGroup("com.github.aSemy")
// includeGroup("com.github.adamko-dev")
// includeGroup("com.github.adamko-dev.kotka-streams")
// includeGroup("dev.adamko.kotka")
// }
}
} }

View file

@ -1,21 +1,30 @@
package dev.adamko.kafkatorio package dev.adamko.kafkatorio
import org.gradle.api.internal.tasks.userinput.UserInputHandler
import org.gradle.kotlin.dsl.support.serviceOf
plugins { plugins {
idea
base base
idea
} }
group = "${rootProject.group}.${project.name}" group = rootProject.group
version = rootProject.version version = rootProject.version
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}
tasks.withType<WriteProperties>().configureEach { tasks.withType<WriteProperties>().configureEach {
encoding = Charsets.UTF_8.name() encoding = Charsets.UTF_8.name()
comment = " Do not edit manually. This file was created with task '$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 """) 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 { afterEvaluate {
tasks.named("processRun") { dependsOn(dockerUp, dockerEnv) } tasks.named("processRun") { dependsOn(dockerUp, dockerEnv) }
tasks.named("processKill") { dependsOn(dockerDown) } tasks.named("processKill") { dependsOn(dockerDown) }

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

10
gradlew vendored
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script # Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features: # requires all of these POSIX shell features:
# * functions; # * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»; # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»; # * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit». # * various built-in commands including «command», «set», and «ulimit».
# #
# Important for patching: # Important for patching:
# #

View file

@ -39,7 +39,7 @@ dependencies {
implementation("com.sksamuel.scrimage:scrimage-core:4.0.24") implementation("com.sksamuel.scrimage:scrimage-core:4.0.24")
val kotkaVersion = "v0.0.12" val kotkaVersion = "v0.0.13"
implementation("com.github.adamko-dev.kotka-streams:kotka-streams:$kotkaVersion") { implementation("com.github.adamko-dev.kotka-streams:kotka-streams:$kotkaVersion") {
isChanging = true isChanging = true
} }

View file

@ -98,7 +98,7 @@ class KxsDataOutputEncoder(
class KxsDataInputDecoder( class KxsDataInputDecoder(
private val input: DataInput, private val input: DataInput,
override val serializersModule: SerializersModule = EmptySerializersModule, override val serializersModule: SerializersModule = EmptySerializersModule,
var elementsCount: Int = 0, private var elementsCount: Int = 0,
) : AbstractDecoder() { ) : AbstractDecoder() {
private var elementIndex = 0 private var elementIndex = 0

View file

@ -5,7 +5,7 @@ import dev.adamko.kafkatorio.gradle.not
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins { plugins {
id("dev.adamko.kafkatorio.infra.process-runner") dev.adamko.kafkatorio.infra.`process-runner`
} }
description = "Start the Factorio game client" description = "Start the Factorio game client"

View file

@ -3,7 +3,7 @@ import dev.adamko.kafkatorio.gradle.factorioModAttributes
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins { plugins {
id("dev.adamko.kafkatorio.infra.docker-compose") dev.adamko.kafkatorio.infra.`docker-compose`
} }
val dockerSrcDir: Directory by extra val dockerSrcDir: Directory by extra
@ -57,3 +57,17 @@ idea {
excludeDirs.add(file("src/factorio-server")) excludeDirs.add(file("src/factorio-server"))
} }
} }
tasks.hardReset {
dependsOn(tasks.dockerRemove)
delete(
factorioServerDataDir.dir("saves"),
factorioServerDataDir.dir("temp"),
factorioServerDataDir.file("factorio-current.log"),
factorioServerDataDir.file("factorio-previous.log"),
factorioServerDataDir.file(".lock"),
)
}

View file

@ -1,5 +1,5 @@
plugins { plugins {
id("dev.adamko.kafkatorio.infra.docker-compose") dev.adamko.kafkatorio.infra.`docker-compose`
} }
description = "Kafka cluster" description = "Kafka cluster"

View file

@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins { plugins {
id("dev.adamko.kafkatorio.infra.docker-compose") dev.adamko.kafkatorio.infra.`docker-compose`
id("dev.adamko.kafkatorio.lang.kotlin-jvm") dev.adamko.kafkatorio.lang.`kotlin-jvm`
} }
val dockerSrcDir: Directory by extra(layout.projectDirectory.dir("src/main/docker")) val dockerSrcDir: Directory by extra(layout.projectDirectory.dir("src/main/docker"))

View file

@ -2,7 +2,7 @@ import org.jetbrains.kotlin.incremental.md5
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins { plugins {
id("dev.adamko.kafkatorio.infra.docker-compose") dev.adamko.kafkatorio.infra.`docker-compose`
} }
description = "Send events from a Factorio server to a Kafka topic " description = "Send events from a Factorio server to a Kafka topic "

View file

@ -1,5 +1,5 @@
plugins { plugins {
id("dev.adamko.kafkatorio.lang.kotlin-jvm") dev.adamko.kafkatorio.lang.`kotlin-jvm`
} }
//group = "${rootProject.group}.server" //group = "${rootProject.group}.server"
@ -14,4 +14,4 @@ dependencies {
implementation("io.ktor:ktor-network:1.6.4") implementation("io.ktor:ktor-network:1.6.4")
} }

View file

@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins { plugins {
id("dev.adamko.kafkatorio.lang.kotlin-js") dev.adamko.kafkatorio.lang.`kotlin-js`
kotlin("plugin.serialization") kotlin("plugin.serialization")
id("io.kvision") id("io.kvision")
} }
@ -39,8 +39,10 @@ kotlin {
sourceSets { sourceSets {
all { all {
languageSettings.optIn("kotlin.RequiresOptIn") languageSettings.apply {
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") optIn("kotlin.RequiresOptIn")
optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
} }
main { main {

View file

@ -28,12 +28,12 @@ dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories { // repositories {
mavenLocal { // mavenLocal {
//// content { // content {
//// includeGroup("io.kvision") // includeGroup("io.kvision")
//// includeGroup("dev.adamko.kotka") // includeGroup("dev.adamko.kotka")
//// } // }
} // }
} // }
} }