Skip to content

Commit 6192c00

Browse files
committed
Fix build with JDK 21
1 parent 615b6fa commit 6192c00

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

buildSrc/src/main/kotlin/com/badoo/marathon/conventions/MarathonConventionsPlugin.kt

+1-8
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MarathonConventionsPlugin : Plugin<Project> {
6464
private fun Project.configureJava(versionCatalog: VersionCatalog) {
6565
extensions.configure<JavaPluginExtension> {
6666
toolchain {
67-
languageVersion.set(JVM_TARGET)
67+
languageVersion.set(JavaLanguageVersion.of(17))
6868
}
6969
withJavadocJar()
7070
withSourcesJar()
@@ -79,9 +79,6 @@ class MarathonConventionsPlugin : Plugin<Project> {
7979

8080
private fun Project.configureKotlin() {
8181
extensions.configure<KotlinJvmProjectExtension> {
82-
jvmToolchain {
83-
languageVersion.set(JVM_TARGET)
84-
}
8582
compilerOptions {
8683
freeCompilerArgs.addAll(
8784
"-Xjvm-default=all",
@@ -208,8 +205,4 @@ class MarathonConventionsPlugin : Plugin<Project> {
208205
val versionSuffix = if (releaseMode.orNull == "RELEASE") "" else "-SNAPSHOT"
209206
return version.get() + versionSuffix
210207
}
211-
212-
companion object {
213-
private val JVM_TARGET = JavaLanguageVersion.of(17)
214-
}
215208
}

sample/app/build.gradle.kts

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ plugins {
44
alias(libs.plugins.marathon)
55
}
66

7+
java {
8+
toolchain {
9+
languageVersion.set(JavaLanguageVersion.of(17))
10+
}
11+
}
12+
713
android {
814
compileSdk = 34
915
namespace = "com.example"
@@ -19,11 +25,6 @@ android {
1925
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2026
}
2127

22-
compileOptions {
23-
sourceCompatibility = JavaVersion.VERSION_17
24-
targetCompatibility = JavaVersion.VERSION_17
25-
}
26-
2728
buildTypes {
2829
getByName("release") {
2930
isMinifyEnabled = false

sample/library/build.gradle.kts

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ plugins {
44
alias(libs.plugins.marathon)
55
}
66

7+
java {
8+
toolchain {
9+
languageVersion.set(JavaLanguageVersion.of(17))
10+
}
11+
}
12+
713
android {
814
compileSdk = 34
915
namespace = "com.example.library"
@@ -14,11 +20,6 @@ android {
1420
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1521
}
1622

17-
compileOptions {
18-
sourceCompatibility = JavaVersion.VERSION_17
19-
targetCompatibility = JavaVersion.VERSION_17
20-
}
21-
2223
lint {
2324
targetSdk = 34
2425
}

0 commit comments

Comments
 (0)