Skip to content

Commit

Permalink
Set proper Java target compatibility (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincianfarini authored Feb 29, 2024
1 parent b3fd5fd commit fcc3aaf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ allprojects {
google()
}
}

val jvmVersion: Provider<String> = providers.gradleProperty("kotlin.jvm.target")

subprojects {
plugins.withType<com.android.build.gradle.BasePlugin>().configureEach {
extensions.findByType<com.android.build.gradle.BaseExtension>()?.apply {
jvmVersion.map { JavaVersion.toVersion(it) }.orNull?.let {
compileOptions {
sourceCompatibility = it
targetCompatibility = it
}
}
}
}
// Apply kotlinOptions.jvmTarget to subprojects
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
if (jvmVersion.isPresent) jvmTarget = jvmVersion.get()
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
kotlin.code.style=official
kotlin.jvm.target=11

GROUP=io.github.kevincianfarini.monarch
VERSION_NAME=0.1.0-SNAPSHOT
Expand Down

0 comments on commit fcc3aaf

Please sign in to comment.