From 990e1eb3fc3af8901b707e8673034f6dc7eeddb2 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Mena Date: Wed, 11 Oct 2023 15:25:55 +0200 Subject: [PATCH 1/3] Prepare for K2 community build --- .github/workflows/pull_request.yml | 5 +---- build.gradle.kts | 12 +++++++++++- settings.gradle.kts | 14 +++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8607894e725..6af3f70f8a2 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -165,9 +165,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 - env: - KOTLIN_OVERRIDE: 1.9.30-dev-1098 - steps: - uses: actions/checkout@v4 with: @@ -182,7 +179,7 @@ jobs: - name: jvmTest (K2 enabled) uses: gradle/gradle-build-action@v2 with: - arguments: jvmTest -Pkotlin.experimental.tryK2=true + arguments: jvmTest -Pkotlin_version=2.0.0-dev-4562 -Pkotlin_repo_url="https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap" -Pkotlin_language_version=2.0 - name: Upload reports if: failure() diff --git a/build.gradle.kts b/build.gradle.kts index 1f29a72bc3e..004599263ac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ import kotlinx.knit.KnitPluginExtension import org.jetbrains.dokka.gradle.DokkaMultiModuleTask import org.jetbrains.dokka.gradle.DokkaTaskPartial import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { @@ -21,7 +22,16 @@ allprojects { repositories { mavenCentral() maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") + (project.rootProject.properties["kotlin_repo_url"] as? String)?.also { maven(it) } + } + + tasks { + withType { + kotlinOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = it } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = it } + } + } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index bb9ced41f33..771956c34f2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,11 +3,12 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") rootProject.name = "arrow" pluginManagement { + @Suppress("LocalVariableName") val kotlin_repo_url: String? by settings repositories { gradlePluginPortal() mavenCentral() mavenLocal() - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") + kotlin_repo_url?.also { maven(it) } } } @@ -17,17 +18,20 @@ plugins { } dependencyResolutionManagement { + @Suppress("LocalVariableName") val kotlin_repo_url: String? by settings + @Suppress("LocalVariableName") val kotlin_version: String? by settings + repositories { mavenCentral() gradlePluginPortal() mavenLocal() + kotlin_repo_url?.also { maven(it) } } versionCatalogs { create("libs") { - val kotlinOverride = System.getenv("KOTLIN_OVERRIDE") - if (!kotlinOverride.isNullOrBlank()) { - println("Overriding Kotlin version with $kotlinOverride") - version("kotlin", kotlinOverride) + if (!kotlin_version.isNullOrBlank()) { + println("Overriding Kotlin version with $kotlin_version") + version("kotlin", kotlin_version!!) } } } From 3e22459bcaadbd0f4373ab8c2819deae5e974db5 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Mena Date: Wed, 11 Oct 2023 15:30:40 +0200 Subject: [PATCH 2/3] Try GitHub Action again --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6af3f70f8a2..e4338285bf9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -179,7 +179,7 @@ jobs: - name: jvmTest (K2 enabled) uses: gradle/gradle-build-action@v2 with: - arguments: jvmTest -Pkotlin_version=2.0.0-dev-4562 -Pkotlin_repo_url="https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap" -Pkotlin_language_version=2.0 + arguments: "jvmTest -Pkotlin_version=2.0.0-dev-4562 -Pkotlin_repo_url=https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap -Pkotlin_language_version=2.0" - name: Upload reports if: failure() From e94bb316eedac9fad8cf7d8ef2724ffb733b064f Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Mena Date: Wed, 11 Oct 2023 16:04:12 +0200 Subject: [PATCH 3/3] Small fixes to make it work --- .github/workflows/pull_request.yml | 2 +- arrow-libs/core/arrow-atomic/build.gradle.kts | 9 +++++++++ .../src/commonMain/kotlin/arrow/core/Validated.kt | 8 ++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e4338285bf9..9ec9b0fd2b8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -179,7 +179,7 @@ jobs: - name: jvmTest (K2 enabled) uses: gradle/gradle-build-action@v2 with: - arguments: "jvmTest -Pkotlin_version=2.0.0-dev-4562 -Pkotlin_repo_url=https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap -Pkotlin_language_version=2.0" + arguments: "jvmTest -Pkotlin_version=1.9.30-dev-2548 -Pkotlin_repo_url=https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap -Pkotlin_language_version=2.0" - name: Upload reports if: failure() diff --git a/arrow-libs/core/arrow-atomic/build.gradle.kts b/arrow-libs/core/arrow-atomic/build.gradle.kts index c5930a388cc..53e4715ae43 100644 --- a/arrow-libs/core/arrow-atomic/build.gradle.kts +++ b/arrow-libs/core/arrow-atomic/build.gradle.kts @@ -1,5 +1,8 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + + plugins { id(libs.plugins.kotlin.multiplatform.get().pluginId) alias(libs.plugins.arrowGradleConfig.kotlin) @@ -77,3 +80,9 @@ kotlin { } } } + +tasks.withType().configureEach { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + "-Xexpect-actual-classes" + } +} diff --git a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Validated.kt b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Validated.kt index 4b1a23e872e..b33d6f29d9a 100644 --- a/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Validated.kt +++ b/arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Validated.kt @@ -18,13 +18,13 @@ public typealias ValidatedNel = Validated, A> @Deprecated( ValidatedDeprMsg + "Use Right to construct Either values instead", - ReplaceWith("Either.Right(value)", "arrow.core.Either") + ReplaceWith("Either.Right", "arrow.core.Either") ) public typealias Valid = Validated.Valid @Deprecated( ValidatedDeprMsg + "Use Left to construct Either values instead", - ReplaceWith("Either.Left(value)", "arrow.core.Either") + ReplaceWith("Either.Left", "arrow.core.Either") ) public typealias Invalid = Validated.Invalid @@ -318,7 +318,7 @@ public sealed class Validated { @Deprecated( ValidatedDeprMsg + "Use Right to construct Either values instead", - ReplaceWith("Either.Right(value)", "arrow.core.Either") + ReplaceWith("Either.Right", "arrow.core.Either") ) public data class Valid(val value: A) : Validated() { override fun toString(): String = "Validated.Valid($value)" @@ -332,7 +332,7 @@ public sealed class Validated { @Deprecated( ValidatedDeprMsg + "Use Left to construct Either values instead", - ReplaceWith("Either.Left(value)", "arrow.core.Either") + ReplaceWith("Either.Left", "arrow.core.Either") ) public data class Invalid(val value: E) : Validated() { override fun toString(): String = "Validated.Invalid($value)"