diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a64a3f..ee363db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,6 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - name: Build the JAR uses: gradle/gradle-build-action@v3 with: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index df5fd10..cb25d39 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -25,11 +25,6 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - name: Run Detekt uses: gradle/gradle-build-action@v3 with: diff --git a/build.gradle.kts b/build.gradle.kts index 52fe6b8..84bea6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,6 +7,8 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +val javaLanguageVersion: String by project + plugins { alias(libs.plugins.compose) alias(libs.plugins.compose.compiler) @@ -77,10 +79,15 @@ tasks.named("dependencyUpdates") { } java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + toolchain { + languageVersion = JavaLanguageVersion.of(javaLanguageVersion) + vendor = JvmVendorSpec.ADOPTIUM + } } +val maxKotlinJvmTarget = runCatching { JvmTarget.fromTarget(javaLanguageVersion) } + .getOrDefault(enumValues().max()) + tasks.withType { val customCompilerArgs = listOf( "-opt-in=androidx.compose.ui.ExperimentalComposeUiApi" @@ -90,7 +97,7 @@ tasks.withType { allWarningsAsErrors = true apiVersion = KotlinVersion.KOTLIN_1_8 freeCompilerArgs.addAll(customCompilerArgs) - jvmTarget = JvmTarget.JVM_17 + jvmTarget = maxKotlinJvmTarget } } @@ -102,6 +109,8 @@ detekt { } tasks.withType().configureEach { + jvmTarget = maxKotlinJvmTarget.target + reports { xml.required.set(false) html.required.set(false) diff --git a/gradle.properties b/gradle.properties index 569c058..f7b212b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,6 @@ org.gradle.configuration-cache = true org.gradle.kotlin.dsl.allWarningsAsErrors = true org.gradle.parallel = true +javaLanguageVersion = 21 + kotlin.code.style = official