Skip to content

Commit

Permalink
use jdk17 for lint module
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartvick committed Mar 1, 2024
1 parent a1b6705 commit 1ea71d3
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,25 @@ allprojects {
}

subprojects {
val javaVersion = JavaVersion.VERSION_18

val libJavaVersion = JavaVersion.VERSION_18
val lintJavaVersion = JavaVersion.VERSION_17

/**
* We explicitly target JDK 17 for the lint module in order to be compatible with current Android Studio JRE version (JBR17),
* as lint checks compiled with JDK 18 are failing to be run by the code inspector.
*
* We should be able to update back to JDK 18 once AS ships with JBR21 (likely IDEA 2024.1):
* https://github.com/JetBrains/JetBrainsRuntime?tab=readme-ov-file#releases-based-on-jdk-21
*/
fun Project.javaVersion(): JavaVersion {
return if (name == "formula-lint") {
logger.lifecycle("")
lintJavaVersion
} else {
libJavaVersion
}
}

tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
dokkaSourceSets.named("main") {
Expand All @@ -50,8 +68,8 @@ subprojects {
compileSdk = 34

compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
sourceCompatibility = libJavaVersion
targetCompatibility = libJavaVersion
}
}

Expand Down Expand Up @@ -89,13 +107,13 @@ subprojects {
}

tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
sourceCompatibility = project.javaVersion().toString()
targetCompatibility = project.javaVersion().toString()
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = javaVersion.toString()
jvmTarget = project.javaVersion().toString()
}
}
}
Expand Down

0 comments on commit 1ea71d3

Please sign in to comment.