Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "lint errors not sowing in AS" issue #343

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Loading