diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8334ffa..de72948 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '19' + java-version: '21' - uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true @@ -45,7 +45,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '19' + java-version: '21' - uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true @@ -67,7 +67,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '19' + java-version: '21' - uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 01f5397..1672c8e 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/setup-java@v2 with: distribution: 'zulu' - java-version: '19' + java-version: '21' - uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 9d548f0..08b7b59 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -9,7 +9,7 @@ plugins { kotlin { jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(20)) + languageVersion.set(JavaLanguageVersion.of(21)) vendor.set(JvmVendorSpec.AZUL) } } diff --git a/build-logic/src/main/kotlin/io/github/reactivecircus/cache4k/buildlogic/convention/ConventionPlugin.kt b/build-logic/src/main/kotlin/io/github/reactivecircus/cache4k/buildlogic/convention/ConventionPlugin.kt index 3513ba2..a48f4b9 100644 --- a/build-logic/src/main/kotlin/io/github/reactivecircus/cache4k/buildlogic/convention/ConventionPlugin.kt +++ b/build-logic/src/main/kotlin/io/github/reactivecircus/cache4k/buildlogic/convention/ConventionPlugin.kt @@ -13,13 +13,9 @@ import org.gradle.api.Project import org.gradle.api.tasks.testing.Test import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.jvm.toolchain.JvmVendorSpec -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.register -import org.gradle.kotlin.dsl.the -import org.gradle.kotlin.dsl.withType +import org.gradle.kotlin.dsl.* import org.jetbrains.dokka.gradle.DokkaMultiModuleTask import org.jetbrains.dokka.gradle.DokkaPlugin -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JsModuleKind import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension @@ -111,91 +107,82 @@ private fun Project.configureSubproject() { @Suppress("LongMethod", "MagicNumber") private fun KotlinMultiplatformExtension.configureTargets(project: Project) { - targets { + jvm { jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(20)) + languageVersion.set(JavaLanguageVersion.of(21)) vendor.set(JvmVendorSpec.AZUL) } - - @OptIn(ExperimentalKotlinGradlePluginApi::class) - targetHierarchy.default { - group("jvmAndIos") { - withJvm() - } - group("nonJvm") { - withJs() - withIosX64() - withIosArm64() - withIosSimulatorArm64() - withMacosX64() - withMacosArm64() - withTvosX64() - withTvosArm64() - withTvosSimulatorArm64() - withWatchosX64() - withWatchosArm64() - withWatchosSimulatorArm64() - withLinuxX64() - withLinuxArm64() - withMingwX64() + compilations.configureEach { + compilerOptions.configure { + jvmTarget.set(JvmTarget.JVM_11) + freeCompilerArgs.addAll( + "-Xjvm-default=all" + ) } } - - jvm { - compilations.configureEach { - compilerOptions.configure { - jvmTarget.set(JvmTarget.JVM_11) - freeCompilerArgs.addAll( - "-Xjvm-default=all" - ) + val main = compilations.getByName("main") + compilations.create("lincheck") { + defaultSourceSet { + dependencies { + implementation(main.compileDependencyFiles + main.output.classesDirs) } } - val main = compilations.getByName("main") - compilations.create("lincheck") { - defaultSourceSet { - dependencies { - implementation(main.compileDependencyFiles + main.output.classesDirs) - } - } - project.tasks.register("jvmLincheck") { - classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs - testClassesDirs = output.classesDirs - useJUnitPlatform() - testLogging { - events("passed", "skipped", "failed") - } - jvmArgs( - "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.util=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED", - ) + project.tasks.register("jvmLincheck") { + classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs + testClassesDirs = output.classesDirs + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") } + jvmArgs( + "--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-exports", "java.base/jdk.internal.util=ALL-UNNAMED", + "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", + "--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED", + ) } } - js(IR) { - compilations.all { - compilerOptions.configure { - moduleKind.set(JsModuleKind.MODULE_COMMONJS) - } + } + js { + compilations.configureEach { + compilerOptions.configure { + moduleKind.set(JsModuleKind.MODULE_COMMONJS) } - browser() - nodejs() } - iosX64() - iosArm64() - iosSimulatorArm64() - macosX64() - macosArm64() - tvosX64() - tvosArm64() - tvosSimulatorArm64() - watchosX64() - watchosArm64() - watchosSimulatorArm64() - linuxX64() - linuxArm64() - mingwX64() + browser() + nodejs() + } + iosX64() + iosArm64() + iosSimulatorArm64() + macosX64() + macosArm64() + tvosX64() + tvosArm64() + tvosSimulatorArm64() + watchosX64() + watchosArm64() + watchosSimulatorArm64() + linuxX64() + linuxArm64() + mingwX64() + applyDefaultHierarchyTemplate() + + sourceSets { + val jvmAndIos by creating { + dependsOn(commonMain.get()) + } + iosMain.get().dependsOn(jvmAndIos) + jvmMain.get().dependsOn(jvmAndIos) + + val nonJvm by creating { + dependsOn(commonMain.get()) + } + jsMain.get().dependsOn(nonJvm) + appleMain.get().dependsOn(nonJvm) + linuxMain.get().dependsOn(nonJvm) + mingwMain.get().dependsOn(nonJvm) + } } diff --git a/cache4k/build.gradle.kts b/cache4k/build.gradle.kts index d0731bc..2376d16 100644 --- a/cache4k/build.gradle.kts +++ b/cache4k/build.gradle.kts @@ -4,38 +4,32 @@ plugins { kotlin { sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation(libs.coroutines.core) implementation(libs.stately.isoCollections) implementation(libs.atomicfu) } } - val nonJvmMain by getting { - dependencies { - dependsOn(commonMain) - } - } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) implementation(libs.coroutines.test) } } - val jvmTest by getting { + jvmTest { dependencies { implementation(kotlin("test-junit5")) } } - val jvmLincheck by getting { + jvmLincheck { dependencies { - dependsOn(commonMain) implementation(kotlin("test-junit5")) implementation(libs.lincheck) } } - val jsTest by getting { + jsTest { dependencies { implementation(kotlin("test-js")) }