bump gradle version. gradle build scripts tidy up. Make versions more consistent, share some config

This commit is contained in:
Adam 2022-02-09 11:53:58 +01:00
parent 11cbb89821
commit 96412bf7c9
13 changed files with 3752 additions and 61 deletions

3668
.kotlin-js-store/yarn.lock Normal file

File diff suppressed because it is too large Load diff

View file

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

View file

@ -7,36 +7,54 @@ plugins {
`project-report` `project-report`
} }
object Versions {
const val jvmTarget = "11"
const val kotlinTarget = "1.6"
const val gradleNodePlugin = "3.2.0"
const val gradleDockerComposePlugin = "0.15.0"
const val kotlin = "1.6.10"
const val kotlinXSerialization = "1.3.2"
const val kvision = "5.8.1"
const val semver = "1.1.2"
const val kotest = "5.1.0"
}
dependencies { dependencies {
val kotlinVersion = "1.6.10" implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:${Versions.kotlin}"))
implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion"))
implementation("org.jetbrains.kotlin:kotlin-serialization") implementation("org.jetbrains.kotlin:kotlin-serialization")
implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
val kotlinXSerializationVersion = "1.3.2" implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-serialization-bom:${Versions.kotlinXSerialization}"))
implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-serialization-bom:$kotlinXSerializationVersion"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core") implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
// implementation("com.charleskorn.kaml:kaml:0.37.0") // implementation("com.charleskorn.kaml:kaml:0.37.0")
implementation("com.github.node-gradle:gradle-node-plugin:3.1.1") implementation("com.github.node-gradle:gradle-node-plugin:${Versions.gradleNodePlugin}")
implementation("net.swiftzer.semver:semver:1.1.2") implementation("io.kotest:kotest-framework-multiplatform-plugin-gradle:${Versions.kotest}")
implementation("io.kvision:io.kvision.gradle.plugin:${Versions.kvision}")
implementation("net.swiftzer.semver:semver:${Versions.semver}")
// https://github.com/avast/gradle-docker-compose-plugin // https://github.com/avast/gradle-docker-compose-plugin
implementation("com.avast.gradle:gradle-docker-compose-plugin:0.14.12") implementation("com.avast.gradle:gradle-docker-compose-plugin:${Versions.gradleDockerComposePlugin}")
} }
val projectJvmTarget = "11"
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { kotlinOptions {
jvmTarget = projectJvmTarget jvmTarget = Versions.jvmTarget
apiVersion = "1.6" apiVersion = Versions.kotlinTarget
languageVersion = "1.6" languageVersion = Versions.kotlinTarget
} }
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
@ -50,11 +68,11 @@ tasks.withType<KotlinCompile>().configureEach {
kotlin { kotlin {
jvmToolchain { jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(projectJvmTarget)) (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(Versions.jvmTarget))
} }
kotlinDslPluginOptions { kotlinDslPluginOptions {
jvmTarget.set(projectJvmTarget) jvmTarget.set(Versions.jvmTarget)
} }
} }

View file

@ -0,0 +1,13 @@
object Versions {
const val kotlinLang = "1.6"
const val jvmTarget = "11"
const val node = "14.19.0"
const val kotlinWrappers = "0.0.1-pre.294-kotlin-1.6.10"
const val junit = "5.8.2"
const val kotest = "5.1.0"
const val mockk = "1.12.1"
}

View file

@ -1,8 +1,25 @@
package dev.adamko.kafkatorio package dev.adamko.kafkatorio
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
val jsonMapper = Json { val jsonMapper = Json {
prettyPrint = true prettyPrint = true
prettyPrintIndent = " " prettyPrintIndent = " "
} }
/**
* `kotlin-js` adds a directory in the root-dir for the Yarn lock.
* That's a bit annoying. It's a little neater if it's in the
* gradle dir, next to the version-catalog.
*/
fun Project.relocateKotlinJsStore() {
afterEvaluate {
rootProject.extensions.configure<YarnRootExtension> {
lockFileDirectory = rootProject.rootDir.resolve("gradle/kotlin-js-store")
}
}
}

View file

@ -1,8 +1,9 @@
package dev.adamko.kafkatorio.lang package dev.adamko.kafkatorio.lang
import Versions
import dev.adamko.kafkatorio.relocateKotlinJsStore
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins { plugins {
@ -11,10 +12,9 @@ plugins {
} }
dependencies { dependencies {
val kotlinWrappersVersion = "0.0.1-pre.276-kotlin-1.6.0"
implementation( implementation(
project.dependencies.platform( project.dependencies.platform(
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${kotlinWrappersVersion}" "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${Versions.kotlinWrappers}"
) )
) )
} }
@ -42,9 +42,4 @@ val nodeModulesDir: Directory by extra {
file file
} }
rootProject.extensions.configure<YarnRootExtension> { relocateKotlinJsStore()
// kotlin-js adds a directory in the root-dir for the Yarn lock.
// That's a bit annoying. It's a little neater if it's in the
// gradle dir, next to the version-catalog.
lockFileDirectory = rootProject.rootDir.resolve("gradle/kotlin-js-store")
}

View file

@ -9,7 +9,7 @@ plugins {
kotlin { kotlin {
jvmToolchain { jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11)) (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(Versions.jvmTarget))
} }
} }
@ -17,30 +17,28 @@ dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom")) implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
val junitVersion = "5.8.2" testImplementation(platform("org.junit:junit-bom:${Versions.junit}"))
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") { testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions") because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
} }
val kotestVersion = "5.0.3" testImplementation(platform("io.kotest:kotest-bom:${Versions.kotest}"))
testImplementation(platform("io.kotest:kotest-bom:$kotestVersion"))
testImplementation("io.kotest:kotest-runner-junit5") testImplementation("io.kotest:kotest-runner-junit5")
testImplementation("io.kotest:kotest-assertions-core") testImplementation("io.kotest:kotest-assertions-core")
testImplementation("io.kotest:kotest-property") testImplementation("io.kotest:kotest-property")
testImplementation("io.kotest:kotest-assertions-json") testImplementation("io.kotest:kotest-assertions-json")
testImplementation("io.mockk:mockk:1.12.1") testImplementation("io.mockk:mockk:${Versions.mockk}")
} }
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { kotlinOptions {
jvmTarget = "11" jvmTarget = Versions.jvmTarget
apiVersion = "1.6" apiVersion = Versions.kotlinLang
languageVersion = "1.6" languageVersion = Versions.kotlinLang
} }
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(

View file

@ -1,9 +1,6 @@
package dev.adamko.kafkatorio.lang package dev.adamko.kafkatorio.lang
import org.gradle.kotlin.dsl.configure import dev.adamko.kafkatorio.relocateKotlinJsStore
import org.gradle.kotlin.dsl.kotlin
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins { plugins {
@ -13,21 +10,4 @@ plugins {
} }
afterEvaluate { relocateKotlinJsStore()
rootProject.extensions.configure<NodeJsRootExtension> {
val projectNodeInstallDir = file("$rootDir/.gradle").resolve("nodejs")
if (installationDir != projectNodeInstallDir) {
installationDir = projectNodeInstallDir
}
}
rootProject.extensions.configure<YarnRootExtension> {
// kotlin-js adds a directory in the root-dir for the Yarn lock.
// That's a bit annoying. It's a little neater if it's in the
// gradle dir, next to the version-catalog.
lockFileDirectory = rootProject.rootDir.resolve("gradle/kotlin-js-store")
}
}

View file

@ -1,5 +1,6 @@
package dev.adamko.kafkatorio.lang package dev.adamko.kafkatorio.lang
import Versions
import com.github.gradle.node.NodePlugin import com.github.gradle.node.NodePlugin
import com.github.gradle.node.npm.task.NpmInstallTask import com.github.gradle.node.npm.task.NpmInstallTask
import dev.adamko.kafkatorio.gradle.areJsonPropertiesUpToDate import dev.adamko.kafkatorio.gradle.areJsonPropertiesUpToDate
@ -20,7 +21,7 @@ plugins {
node { node {
download.set(true) download.set(true)
version.set("14.18.0") version.set(Versions.node)
distBaseUrl.set(null as String?) // set by dependencyResolutionManagement distBaseUrl.set(null as String?) // set by dependencyResolutionManagement
} }
@ -56,6 +57,7 @@ val updatePackageJson by tasks.registering(UpdatePackageJson::class) {
} }
tasks.assemble { dependsOn(updatePackageJson) } tasks.assemble { dependsOn(updatePackageJson) }
tasks.withType<NpmInstallTask> { tasks.withType<NpmInstallTask> {
dependsOn(updatePackageJson) dependsOn(updatePackageJson)
} }

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.3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -4,7 +4,7 @@ import dev.adamko.kafkatorio.gradle.typescriptAttributes
plugins { plugins {
kotlin("multiplatform") kotlin("multiplatform")
kotlin("plugin.serialization") kotlin("plugin.serialization")
id("io.kotest.multiplatform") version "5.0.2" id("io.kotest.multiplatform")
distribution distribution
} }

View file

@ -18,7 +18,7 @@ val projectId: String by project.extra
@Suppress("UnstableApiUsage") // platform + version-catalog is incubating @Suppress("UnstableApiUsage") // platform + version-catalog is incubating
dependencies { dependencies {
implementation("org.apache.kafka:kafka-streams:3.1.0") implementation(libs.kafka.streams)
implementation(projects.modules.eventsSchema) implementation(projects.modules.eventsSchema)

View file

@ -4,7 +4,7 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins { plugins {
id("dev.adamko.kafkatorio.lang.kotlin-js") id("dev.adamko.kafkatorio.lang.kotlin-js")
kotlin("plugin.serialization") kotlin("plugin.serialization")
id("io.kvision") version "5.8.1" id("io.kvision")
} }
kotlin { kotlin {