bump gradle version. gradle build scripts tidy up. Make versions more consistent, share some config
This commit is contained in:
parent
11cbb89821
commit
96412bf7c9
13 changed files with 3752 additions and 61 deletions
|
|
@ -1,8 +1,25 @@
|
|||
package dev.adamko.kafkatorio
|
||||
|
||||
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 {
|
||||
prettyPrint = true
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
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.tasks.RootPackageJsonTask
|
||||
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
||||
|
||||
|
||||
plugins {
|
||||
|
|
@ -11,10 +12,9 @@ plugins {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
val kotlinWrappersVersion = "0.0.1-pre.276-kotlin-1.6.0"
|
||||
implementation(
|
||||
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
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
relocateKotlinJsStore()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ plugins {
|
|||
|
||||
kotlin {
|
||||
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"))
|
||||
|
||||
val junitVersion = "5.8.2"
|
||||
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
|
||||
testImplementation(platform("org.junit:junit-bom:${Versions.junit}"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
|
||||
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:$kotestVersion"))
|
||||
testImplementation(platform("io.kotest:kotest-bom:${Versions.kotest}"))
|
||||
testImplementation("io.kotest:kotest-runner-junit5")
|
||||
testImplementation("io.kotest:kotest-assertions-core")
|
||||
testImplementation("io.kotest:kotest-property")
|
||||
testImplementation("io.kotest:kotest-assertions-json")
|
||||
|
||||
testImplementation("io.mockk:mockk:1.12.1")
|
||||
testImplementation("io.mockk:mockk:${Versions.mockk}")
|
||||
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
apiVersion = "1.6"
|
||||
languageVersion = "1.6"
|
||||
jvmTarget = Versions.jvmTarget
|
||||
apiVersion = Versions.kotlinLang
|
||||
languageVersion = Versions.kotlinLang
|
||||
}
|
||||
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package dev.adamko.kafkatorio.lang
|
||||
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.kotlin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
|
||||
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
|
||||
import dev.adamko.kafkatorio.relocateKotlinJsStore
|
||||
|
||||
|
||||
plugins {
|
||||
|
|
@ -13,21 +10,4 @@ plugins {
|
|||
}
|
||||
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
relocateKotlinJsStore()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package dev.adamko.kafkatorio.lang
|
||||
|
||||
import Versions
|
||||
import com.github.gradle.node.NodePlugin
|
||||
import com.github.gradle.node.npm.task.NpmInstallTask
|
||||
import dev.adamko.kafkatorio.gradle.areJsonPropertiesUpToDate
|
||||
|
|
@ -20,7 +21,7 @@ plugins {
|
|||
|
||||
node {
|
||||
download.set(true)
|
||||
version.set("14.18.0")
|
||||
version.set(Versions.node)
|
||||
|
||||
distBaseUrl.set(null as String?) // set by dependencyResolutionManagement
|
||||
}
|
||||
|
|
@ -56,6 +57,7 @@ val updatePackageJson by tasks.registering(UpdatePackageJson::class) {
|
|||
}
|
||||
|
||||
tasks.assemble { dependsOn(updatePackageJson) }
|
||||
|
||||
tasks.withType<NpmInstallTask> {
|
||||
dependsOn(updatePackageJson)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue