Skip to content

Commit

Permalink
New target hierarchy setup. Update JVM toolchains to 21.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Nov 7, 2023
1 parent c63e62c commit 1f15bb9
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 95 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(20))
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.AZUL)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Test>("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<Test>("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)

}
}
16 changes: 5 additions & 11 deletions cache4k/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down

0 comments on commit 1f15bb9

Please sign in to comment.