Skip to content

Commit 0445540

Browse files
WIP
1 parent 4e90643 commit 0445540

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

build.gradle.kts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,23 @@ allprojects {
1212
}
1313
}
1414

15-
tasks.withType<JavaCompile>().configureEach {
16-
sourceCompatibility = "11"
17-
targetCompatibility = "11"
15+
val jvmVersion: Provider<String> = providers.gradleProperty("kotlin.jvm.target")
16+
17+
subprojects {
18+
plugins.withType<com.android.build.gradle.BasePlugin>().configureEach {
19+
extensions.findByType<com.android.build.gradle.BaseExtension>()?.apply {
20+
jvmVersion.map { JavaVersion.toVersion(it) }.orNull?.let {
21+
compileOptions {
22+
sourceCompatibility = it
23+
targetCompatibility = it
24+
}
25+
}
26+
}
27+
}
28+
// Apply kotlinOptions.jvmTarget to subprojects
29+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
30+
kotlinOptions {
31+
if (jvmVersion.isPresent) jvmTarget = jvmVersion.get()
32+
}
33+
}
1834
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
kotlin.code.style=official
2+
kotlin.jvm.target=11
23

34
GROUP=io.github.kevincianfarini.monarch
45
VERSION_NAME=0.1.0-SNAPSHOT

0 commit comments

Comments
 (0)