From c860806e993c27abc9a3e898690cd313ccae2ecf Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Thu, 4 Jul 2024 10:55:18 +0200 Subject: [PATCH] Fix incompatible versioning (#3463) --- arrow-libs/core/arrow-annotations/build.gradle.kts | 10 ++++++++++ arrow-libs/core/arrow-atomic/build.gradle.kts | 7 +++++++ arrow-libs/core/arrow-autoclose/build.gradle.kts | 8 ++++++++ arrow-libs/core/arrow-cache4k/build.gradle.kts | 12 +++++++++++- .../core/arrow-core-high-arity/build.gradle.kts | 8 ++++++++ arrow-libs/core/arrow-core-retrofit/build.gradle.kts | 11 +++++++++++ .../core/arrow-core-serialization/build.gradle.kts | 10 ++++++++++ arrow-libs/core/arrow-core/build.gradle.kts | 7 +++++++ arrow-libs/core/arrow-eval/build.gradle.kts | 10 ++++++++++ arrow-libs/core/arrow-functions/build.gradle.kts | 10 ++++++++++ arrow-libs/fx/arrow-collectors/build.gradle.kts | 8 ++++++++ arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts | 8 ++++++++ arrow-libs/fx/arrow-fx-stm/build.gradle.kts | 7 +++++++ .../optics/arrow-optics-compose/build.gradle.kts | 8 ++++++++ .../optics/arrow-optics-ksp-plugin/build.gradle.kts | 9 +++++++++ .../optics/arrow-optics-reflect/build.gradle.kts | 12 ++++++++++++ arrow-libs/optics/arrow-optics/build.gradle.kts | 10 ++++++++++ .../resilience/arrow-resilience/build.gradle.kts | 10 ++++++++++ build.gradle.kts | 12 ++---------- 19 files changed, 166 insertions(+), 11 deletions(-) diff --git a/arrow-libs/core/arrow-annotations/build.gradle.kts b/arrow-libs/core/arrow-annotations/build.gradle.kts index b06c40bd0d9..1b9e385f48d 100644 --- a/arrow-libs/core/arrow-annotations/build.gradle.kts +++ b/arrow-libs/core/arrow-annotations/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -31,4 +35,10 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } diff --git a/arrow-libs/core/arrow-atomic/build.gradle.kts b/arrow-libs/core/arrow-atomic/build.gradle.kts index 6a88e04f814..445ae20498d 100644 --- a/arrow-libs/core/arrow-atomic/build.gradle.kts +++ b/arrow-libs/core/arrow-atomic/build.gradle.kts @@ -1,6 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -48,6 +49,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/core/arrow-autoclose/build.gradle.kts b/arrow-libs/core/arrow-autoclose/build.gradle.kts index 41bbbead065..b42aecd9769 100644 --- a/arrow-libs/core/arrow-autoclose/build.gradle.kts +++ b/arrow-libs/core/arrow-autoclose/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -42,6 +44,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } // enables context receivers for Jvm Tests diff --git a/arrow-libs/core/arrow-cache4k/build.gradle.kts b/arrow-libs/core/arrow-cache4k/build.gradle.kts index f356e50e5d4..f73ae851bd2 100644 --- a/arrow-libs/core/arrow-cache4k/build.gradle.kts +++ b/arrow-libs/core/arrow-cache4k/build.gradle.kts @@ -1,7 +1,11 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { - `java-library` + // `java-library` id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.publish) alias(libs.plugins.spotless) @@ -58,6 +62,12 @@ kotlin { // -- Deprecated as of 1.8.20 -- // iosArm32() // deprecated as of 1.8.20 // watchosX86() + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.named("jvmJar").configure { diff --git a/arrow-libs/core/arrow-core-high-arity/build.gradle.kts b/arrow-libs/core/arrow-core-high-arity/build.gradle.kts index 4be415ff55f..a6d64bbe79f 100644 --- a/arrow-libs/core/arrow-core-high-arity/build.gradle.kts +++ b/arrow-libs/core/arrow-core-high-arity/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -35,4 +37,10 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } diff --git a/arrow-libs/core/arrow-core-retrofit/build.gradle.kts b/arrow-libs/core/arrow-core-retrofit/build.gradle.kts index a2591291de5..27346d0ab9a 100644 --- a/arrow-libs/core/arrow-core-retrofit/build.gradle.kts +++ b/arrow-libs/core/arrow-core-retrofit/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -36,6 +40,13 @@ dependencies { testImplementation(libs.squareup.moshi.kotlin) } +kotlin { + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } +} + tasks.jar { manifest { attributes["Automatic-Module-Name"] = "arrow.core.retrofit" diff --git a/arrow-libs/core/arrow-core-serialization/build.gradle.kts b/arrow-libs/core/arrow-core-serialization/build.gradle.kts index b5032a523d2..3b4f18c59e4 100644 --- a/arrow-libs/core/arrow-core-serialization/build.gradle.kts +++ b/arrow-libs/core/arrow-core-serialization/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -39,6 +43,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/core/arrow-core/build.gradle.kts b/arrow-libs/core/arrow-core/build.gradle.kts index 0dde880ffa1..ca137dabeda 100644 --- a/arrow-libs/core/arrow-core/build.gradle.kts +++ b/arrow-libs/core/arrow-core/build.gradle.kts @@ -1,6 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.time.Duration @@ -69,6 +70,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } // enables context receivers for Jvm Tests diff --git a/arrow-libs/core/arrow-eval/build.gradle.kts b/arrow-libs/core/arrow-eval/build.gradle.kts index 46c68562995..85f4a155243 100644 --- a/arrow-libs/core/arrow-eval/build.gradle.kts +++ b/arrow-libs/core/arrow-eval/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -41,6 +45,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/core/arrow-functions/build.gradle.kts b/arrow-libs/core/arrow-functions/build.gradle.kts index a5b7ca4ab7d..baf746a18a0 100644 --- a/arrow-libs/core/arrow-functions/build.gradle.kts +++ b/arrow-libs/core/arrow-functions/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -44,6 +48,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/fx/arrow-collectors/build.gradle.kts b/arrow-libs/fx/arrow-collectors/build.gradle.kts index 9bd99f8caed..cd714dfd748 100644 --- a/arrow-libs/fx/arrow-collectors/build.gradle.kts +++ b/arrow-libs/fx/arrow-collectors/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import java.time.Duration plugins { @@ -58,6 +60,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType { diff --git a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts index dc5673e8672..57aa3c3d677 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts +++ b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import java.time.Duration @@ -64,6 +66,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/fx/arrow-fx-stm/build.gradle.kts b/arrow-libs/fx/arrow-fx-stm/build.gradle.kts index b0dd944c352..11428d36987 100644 --- a/arrow-libs/fx/arrow-fx-stm/build.gradle.kts +++ b/arrow-libs/fx/arrow-fx-stm/build.gradle.kts @@ -1,6 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -50,6 +51,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/optics/arrow-optics-compose/build.gradle.kts b/arrow-libs/optics/arrow-optics-compose/build.gradle.kts index 3bf48b114e2..7fb8dbd8e9c 100644 --- a/arrow-libs/optics/arrow-optics-compose/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics-compose/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl @@ -74,6 +76,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/optics/arrow-optics-ksp-plugin/build.gradle.kts b/arrow-libs/optics/arrow-optics-ksp-plugin/build.gradle.kts index 6a8c710024a..8eb8eb6cb6c 100644 --- a/arrow-libs/optics/arrow-optics-ksp-plugin/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics-ksp-plugin/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -16,6 +20,11 @@ spotless { kotlin { explicitApi = null + + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } apply(from = property("ANIMALSNIFFER_MPP")) diff --git a/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts b/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts index a5f2cbcf692..6f57cda752f 100644 --- a/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.jvm.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -30,6 +34,14 @@ dependencies { testImplementation(libs.kotest.property) } +kotlin { + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } +} + tasks.jar { manifest { attributes["Automatic-Module-Name"] = "arrow.optics.reflect" diff --git a/arrow-libs/optics/arrow-optics/build.gradle.kts b/arrow-libs/optics/arrow-optics/build.gradle.kts index d3af169c050..eb419c1654c 100644 --- a/arrow-libs/optics/arrow-optics/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -42,6 +46,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/arrow-libs/resilience/arrow-resilience/build.gradle.kts b/arrow-libs/resilience/arrow-resilience/build.gradle.kts index 4b3e910d765..4335b6a4f5f 100644 --- a/arrow-libs/resilience/arrow-resilience/build.gradle.kts +++ b/arrow-libs/resilience/arrow-resilience/build.gradle.kts @@ -1,5 +1,9 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -39,6 +43,12 @@ kotlin { } } } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } } tasks.withType().configureEach { diff --git a/build.gradle.kts b/build.gradle.kts index 91afa0bf4f6..f7fa301b1ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,9 +4,10 @@ import kotlinx.knit.KnitPluginExtension import kotlinx.validation.ExperimentalBCVApi import org.jetbrains.dokka.gradle.DokkaMultiModuleTask import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile allprojects { if (property("version") == "unspecified") { @@ -33,15 +34,6 @@ allprojects { google() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - - tasks { - withType { - compilerOptions { - (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } - (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } - } - } - } } plugins {