diff --git a/build.gradle.kts b/build.gradle.kts index 37dac2e20..516f8a6fe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,6 @@ plugins { alias(libs.plugins.kotlinx.rpc) apply false alias(libs.plugins.atomicfu) apply false alias(libs.plugins.conventions.kover) - alias(libs.plugins.conventions.gradle.doctor) alias(libs.plugins.conventions.root) } diff --git a/compiler-plugin/build.gradle.kts b/compiler-plugin/build.gradle.kts index 129b4df7e..6b9ab3c6c 100644 --- a/compiler-plugin/build.gradle.kts +++ b/compiler-plugin/build.gradle.kts @@ -5,7 +5,7 @@ import util.whenForIde plugins { - alias(libs.plugins.conventions.gradle.doctor) + id("empty") // resolve conventions classpath } val rpcVersion: String = libs.versions.kotlinx.rpc.get() diff --git a/dokka-plugin/build.gradle.kts b/dokka-plugin/build.gradle.kts index c8a226da6..08692e046 100644 --- a/dokka-plugin/build.gradle.kts +++ b/dokka-plugin/build.gradle.kts @@ -3,7 +3,6 @@ */ plugins { - alias(libs.plugins.conventions.gradle.doctor) alias(libs.plugins.kotlin.jvm) } @@ -12,10 +11,6 @@ version = libs.versions.kotlinx.rpc.get() logger.lifecycle("[Dokka Plugin] kotlinx.rpc project version: $version, Kotlin version: ${libs.versions.kotlin.lang.get()}") -kotlin { - jvmToolchain(8) -} - dependencies { compileOnly(libs.dokka.core) compileOnly(libs.dokka.base) diff --git a/gradle-conventions/build.gradle.kts b/gradle-conventions/build.gradle.kts index fce7debd1..30489119f 100644 --- a/gradle-conventions/build.gradle.kts +++ b/gradle-conventions/build.gradle.kts @@ -10,8 +10,8 @@ dependencies { implementation(libs.kotlin.gradle.plugin) implementation(libs.detekt.gradle.plugin) implementation(libs.dokka.gradle.plugin) - implementation(libs.gradle.doctor.gradle.plugin) implementation(libs.gradle.publish.gradle.plugin) + implementation(libs.compat.patrouille.gradle.plugin) implementation(libs.kover.gradle.plugin) diff --git a/gradle-conventions/src/main/kotlin/conventions-gradle-doctor.gradle.kts b/gradle-conventions/src/main/kotlin/conventions-gradle-doctor.gradle.kts deleted file mode 100644 index f90709cf5..000000000 --- a/gradle-conventions/src/main/kotlin/conventions-gradle-doctor.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -plugins { - id("com.osacky.doctor") -} - -doctor { - enableTestCaching.assign(false) - disallowMultipleDaemons.assign(false) - GCFailThreshold.assign(0.5f) -} diff --git a/gradle-conventions/src/main/kotlin/conventions-jvm.gradle.kts b/gradle-conventions/src/main/kotlin/conventions-jvm.gradle.kts index 77b1bea6c..89c0c1b2e 100644 --- a/gradle-conventions/src/main/kotlin/conventions-jvm.gradle.kts +++ b/gradle-conventions/src/main/kotlin/conventions-jvm.gradle.kts @@ -1,9 +1,11 @@ /* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ @file:OptIn(ExperimentalAbiValidation::class) +import compat.patrouille.configureJavaCompatibility +import compat.patrouille.configureKotlinCompatibility import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation import util.configureAbiFilters import util.enableAbiValidation @@ -18,11 +20,10 @@ java { withSourcesJar() } -kotlin { - jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - } +configureJavaCompatibility(8) +configureKotlinCompatibility("2.0.0") +kotlin { explicitApi() abiValidation { diff --git a/gradle-conventions/src/main/kotlin/conventions-kmp.gradle.kts b/gradle-conventions/src/main/kotlin/conventions-kmp.gradle.kts index 44f80f0d1..58781cc69 100644 --- a/gradle-conventions/src/main/kotlin/conventions-kmp.gradle.kts +++ b/gradle-conventions/src/main/kotlin/conventions-kmp.gradle.kts @@ -4,6 +4,8 @@ @file:OptIn(ExperimentalAbiValidation::class) +import compat.patrouille.configureJavaCompatibility +import compat.patrouille.configureKotlinCompatibility import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation import util.* import util.targets.configureJs @@ -38,3 +40,6 @@ withKmpConfig { } configureJvm(isKmp = true) + +configureJavaCompatibility(8) +configureKotlinCompatibility("2.0.0") diff --git a/gradle-conventions/src/main/kotlin/conventions-kotlin-version.gradle.kts b/gradle-conventions/src/main/kotlin/conventions-kotlin-version.gradle.kts index 5994aa8e4..e3dad7042 100644 --- a/gradle-conventions/src/main/kotlin/conventions-kotlin-version.gradle.kts +++ b/gradle-conventions/src/main/kotlin/conventions-kotlin-version.gradle.kts @@ -2,10 +2,7 @@ * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import util.withKotlinJvmExtension import util.withKotlinKmpExtension @@ -16,27 +13,10 @@ fun KotlinProjectExtension.optInForRpcApi() { } } -/** - * Set the compatibility mode to the lower supported language version. - * - * This should be lined up with the minimal supported compiler plugin version. - * - * We update the language version only for the 'main' sources sets. - * This makes our tests execute against the latest compiler plugin version (for example, with K2 instead of K1). - */ -fun KotlinCommonCompilerOptions.setProjectLanguageVersion() { - languageVersion.set(KotlinVersion.KOTLIN_2_0) - apiVersion.set(KotlinVersion.KOTLIN_2_0) -} - withKotlinJvmExtension { optInForRpcApi() - - compilerOptions.setProjectLanguageVersion() } withKotlinKmpExtension { optInForRpcApi() - - compilerOptions.setProjectLanguageVersion() } diff --git a/gradle-conventions/src/main/kotlin/empty.gradle.kts b/gradle-conventions/src/main/kotlin/empty.gradle.kts new file mode 100644 index 000000000..fb187a997 --- /dev/null +++ b/gradle-conventions/src/main/kotlin/empty.gradle.kts @@ -0,0 +1,6 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +// DON'T DELETE. +// Resolves conventions classpath where no other convention is applied diff --git a/gradle-conventions/src/main/kotlin/util/targets/configure.kt b/gradle-conventions/src/main/kotlin/util/targets/configure.kt index 2dc911583..77346f401 100644 --- a/gradle-conventions/src/main/kotlin/util/targets/configure.kt +++ b/gradle-conventions/src/main/kotlin/util/targets/configure.kt @@ -60,10 +60,6 @@ fun KmpConfig.configureKotlinExtension(action: Action { - if (this.name.contains("Test")) { - compilerOptions { - // for kotlin.time.Clock API - languageVersion.set(KotlinVersion.KOTLIN_2_1) - apiVersion.set(KotlinVersion.KOTLIN_2_1) +kotlin { + targets.all { + compilations.matching { + it.name.lowercase().endsWith("test") + }.all { + compileTaskProvider.configure { + compilerOptions { + languageVersion.set(KotlinVersion.KOTLIN_2_1) + apiVersion.set(KotlinVersion.KOTLIN_2_1) + } + } } } -} -kotlin { sourceSets { commonMain { dependencies { diff --git a/versions-root/libs.versions.toml b/versions-root/libs.versions.toml index 021d4708d..4bbaf7f7f 100644 --- a/versions-root/libs.versions.toml +++ b/versions-root/libs.versions.toml @@ -18,7 +18,6 @@ kotlin-wrappers = "2025.6.11" junit4 = "4.13.2" junit5 = "5.13.2" intellij = "241.19416.19" -gradle-doctor = "0.11.0" kotlinx-browser = "0.3" dokka = "2.0.0" puppeteer = "24.9.0" @@ -28,6 +27,7 @@ detekt-gradle-plugin = "1.23.8" kover = "0.9.1" develocity = "3.19.2" common-custom-user-data = "2.3" +compat-patrouille = "0.0.1" [libraries] # kotlinx.rpc – references to the included builds @@ -108,8 +108,8 @@ common-custom-user-data = { module ="com.gradle:common-custom-user-data-gradle-p detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt-gradle-plugin" } kover-gradle-plugin = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" } dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } -gradle-doctor-gradle-plugin = { module = "com.osacky.doctor:doctor-plugin", version.ref = "gradle-doctor" } gradle-publish-gradle-plugin = { module = "com.gradle.publish:plugin-publish-plugin", version.ref = "gradle-plugin-publish" } +compat-patrouille-gradle-plugin = { module = "com.gradleup.compat.patrouille:compat-patrouille-gradle-plugin", version.ref = "compat-patrouille" } [plugins] kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-lang" } @@ -128,7 +128,6 @@ conventions-jvm = { id = "conventions-jvm" } conventions-kmp = { id = "conventions-kmp" } conventions-gradle-publish = { id = "conventions-gradle-publish" } conventions-kover = { id = "conventions-kover" } -conventions-gradle-doctor = { id = "conventions-gradle-doctor" } conventions-npm = { id = "conventions-npm" } conventions-root = { id = "conventions-root" } conventions-dokka-spec = { id = "conventions-dokka-spec" }