Skip to content

Commit

Permalink
build: use LTS JDK (21) to develop the project
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv committed Jan 3, 2025
1 parent 5b55034 commit cbb5ab3
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
- uses: "actions/setup-java@v4"
with:
distribution: "temurin"
java-version: 23
java-version: 21
- uses: "gradle/actions/setup-gradle@v4"
with:
build-scan-publish: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: "actions/setup-java@v4"
with:
distribution: "temurin"
java-version: 23
java-version: 21
- uses: "gradle/actions/dependency-submission@v4"
with:
build-scan-publish: true
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ repositories {
google()
}

kotlin { jvmToolchain(21) }

dependencies {
pluginImplementation(libs.plugins.android.application)
pluginImplementation(libs.plugins.android.library)
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/library-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ group = "dev.sargunv.maplibre-compose"
kotlin {
explicitApi()

jvmToolchain(properties["jvmToolchain"]!!.toString().toInt())

compilerOptions {
allWarningsAsErrors = true
freeCompilerArgs.addAll("-Xexpect-actual-classes", "-Xconsistent-data-class-copy-visibility")
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/util.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

fun Project.getJvmTarget(): JvmTarget {
val target = properties["jvmTarget"]!!.toString().toInt()
return JvmTarget.valueOf("JVM_$target")
}
11 changes: 2 additions & 9 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

plugins {
Expand Down Expand Up @@ -40,19 +39,13 @@ android {

kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
compilerOptions { jvmTarget = project.getJvmTarget() }
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
}
iosArm64()
iosSimulatorArm64()
iosX64()
jvm("desktop") {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
}
jvm("desktop") { compilerOptions { jvmTarget = project.getJvmTarget() } }
js(IR) {
browser { commonWebpackConfig { outputFileName = "app.js" } }
binaries.executable()
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ androidMinSdk=23
androidCompileSdk=35
androidTargetSdk=35
iosDeploymentTarget=12.0
jvmTarget=JVM_11
jvmToolchain=21
jvmTarget=11
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx2048M
kotlin.incremental.wasm=true
Expand Down
11 changes: 2 additions & 9 deletions lib/maplibre-compose-expressions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

plugins {
Expand All @@ -27,20 +26,14 @@ mavenPublishing {

kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
compilerOptions { jvmTarget = project.getJvmTarget() }
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishLibraryVariants("release", "debug")
}
iosArm64()
iosSimulatorArm64()
iosX64()
jvm("desktop") {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
}
jvm("desktop") { compilerOptions { jvmTarget = project.getJvmTarget() } }
js(IR) { browser() }
wasmJs { browser() }

Expand Down
11 changes: 2 additions & 9 deletions lib/maplibre-compose-material3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

plugins {
Expand All @@ -28,20 +27,14 @@ mavenPublishing {

kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
compilerOptions { jvmTarget = project.getJvmTarget() }
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishLibraryVariants("release", "debug")
}
iosArm64()
iosSimulatorArm64()
iosX64()
jvm("desktop") {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
}
jvm("desktop") { compilerOptions { jvmTarget = project.getJvmTarget() } }
js(IR) { browser() }

cocoapods {
Expand Down
11 changes: 2 additions & 9 deletions lib/maplibre-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

plugins {
Expand Down Expand Up @@ -47,20 +46,14 @@ val copyDesktopResources by

kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
compilerOptions { jvmTarget = project.getJvmTarget() }
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishLibraryVariants("release", "debug")
}
iosArm64()
iosSimulatorArm64()
iosX64()
jvm("desktop") {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf(project.properties["jvmTarget"]!!.toString()))
}
}
jvm("desktop") { compilerOptions { jvmTarget = project.getJvmTarget() } }
js(IR) { browser() }

cocoapods {
Expand Down

0 comments on commit cbb5ab3

Please sign in to comment.