Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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