Skip to content

Commit

Permalink
Prepare for Kotlin community build (#3140)
Browse files Browse the repository at this point in the history
  • Loading branch information
serras authored Oct 11, 2023
1 parent f0a49d8 commit 68938d3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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=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()
Expand Down
9 changes: 9 additions & 0 deletions arrow-libs/core/arrow-atomic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -77,3 +80,9 @@ kotlin {
}
}
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xexpect-actual-classes"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public typealias ValidatedNel<E, A> = Validated<Nel<E>, A>

@Deprecated(
ValidatedDeprMsg + "Use Right to construct Either values instead",
ReplaceWith("Either.Right(value)", "arrow.core.Either")
ReplaceWith("Either.Right<A>", "arrow.core.Either")
)
public typealias Valid<A> = Validated.Valid<A>

@Deprecated(
ValidatedDeprMsg + "Use Left to construct Either values instead",
ReplaceWith("Either.Left(value)", "arrow.core.Either")
ReplaceWith("Either.Left<E>", "arrow.core.Either")
)
public typealias Invalid<E> = Validated.Invalid<E>

Expand Down Expand Up @@ -318,7 +318,7 @@ public sealed class Validated<out E, out A> {

@Deprecated(
ValidatedDeprMsg + "Use Right to construct Either values instead",
ReplaceWith("Either.Right(value)", "arrow.core.Either")
ReplaceWith("Either.Right<A>", "arrow.core.Either")
)
public data class Valid<out A>(val value: A) : Validated<Nothing, A>() {
override fun toString(): String = "Validated.Valid($value)"
Expand All @@ -332,7 +332,7 @@ public sealed class Validated<out E, out A> {

@Deprecated(
ValidatedDeprMsg + "Use Left to construct Either values instead",
ReplaceWith("Either.Left(value)", "arrow.core.Either")
ReplaceWith("Either.Left<E>", "arrow.core.Either")
)
public data class Invalid<out E>(val value: E) : Validated<E, Nothing>() {
override fun toString(): String = "Validated.Invalid($value)"
Expand Down
12 changes: 11 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<KotlinCompile> {
kotlinOptions {
(project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = it }
(project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = it }
}
}
}
}

Expand Down
14 changes: 9 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}

Expand All @@ -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!!)
}
}
}
Expand Down

0 comments on commit 68938d3

Please sign in to comment.