Skip to content

Commit

Permalink
Added support for kotlin_language_version and kotlin_api_version
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrasnoff committed Feb 14, 2025
1 parent 584acce commit 42229bb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 18 deletions.
7 changes: 1 addition & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ val propertyFile = "application.properties"
plugins {
alias(libs.plugins.spring.dependency.management)
alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.plugin.spring)
}

kotlin.jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
id("base-kotlin-jvm-conventions")
}

apply<NodeJsRootPlugin>()
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ repositories {

// workaround to pass libs into conventions (see https://github.com/gradle/gradle/issues/15383)
dependencies {
implementation(libs.kotlin.gradlePlugin)
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
28 changes: 28 additions & 0 deletions buildSrc/src/main/kotlin/base-kotlin-jvm-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
plugins {
kotlin("jvm")
}

kotlin {

logger.info("For the ${project.name} we used $kotlinVersion kotlin version in this build.")

sourceSets.configureEach {
languageSettings {
val kotlinLanguageVersion = project.providers.gradleProperty("kotlin_language_version")
if (kotlinLanguageVersion.isPresent) {
languageVersion = kotlinLanguageVersion.get()
logger.info("An overriding Kotlin language version of $languageVersion was found for project ${project.name}")
}
val kotlinApiVersion = project.providers.gradleProperty("kotlin_api_version")
if (kotlinApiVersion.isPresent) {
apiVersion = kotlinApiVersion.get()
logger.info("An overriding Kotlin api version of $apiVersion was found for project ${project.name}")
}
}
}

jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
}
}
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm")
id("base-kotlin-jvm-conventions")
}

dependencies {
Expand Down
8 changes: 4 additions & 4 deletions dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
import org.jetbrains.kotlin.gradle.targets.js.KotlinWasmTargetAttribute

plugins {
id("base-kotlin-jvm-conventions")
}

val kotlinDependency: Configuration by configurations.creating {
isTransitive = false
}
Expand Down Expand Up @@ -96,10 +100,6 @@ val copyComposeWasmCompilerPlugins by tasks.creating(Copy::class) {
into(libComposeWasmCompilerPluginsFolder)
}

plugins {
kotlin("jvm")
}

dependencies {
kotlinDependency(libs.junit)
kotlinDependency(libs.hamcrest)
Expand Down
7 changes: 1 addition & 6 deletions executors/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
plugins {
kotlin("jvm")
}

kotlin.jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.AMAZON)
id("base-kotlin-jvm-conventions")
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" }
kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-gradle-plugin-idea = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin-idea", version.ref = "kotlin" }
kotlin-dom-api-compat = { group = "org.jetbrains.kotlin", name = "kotlin-dom-api-compat", version.ref = "kotlin" }
kotlin-compose-compiler-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-compose-compiler-plugin", version.ref = "kotlin" }
Expand Down
2 changes: 1 addition & 1 deletion indexation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm")
id("base-kotlin-jvm-conventions")
application
}

Expand Down

0 comments on commit 42229bb

Please sign in to comment.