Skip to content

Update the build.gradle.kts to be more strict with the javaVersion requirement #8032

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

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ println("untilBuild: $untilBuildInput")
println("javaVersion: $javaVersion")
println("group: $group")

var jvmVersion = JvmTarget.JVM_17
if (javaVersion == "21") {
var jvmVersion: JvmTarget
if (javaVersion == "17") {
jvmVersion = JvmTarget.JVM_17
} else if (javaVersion == "21") {
jvmVersion = JvmTarget.JVM_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
kotlin {
compilerOptions {
Expand All @@ -71,9 +75,13 @@ kotlin {
}
}

var javaCompatibilityVersion = JavaVersion.VERSION_17
if (javaVersion == "21") {
var javaCompatibilityVersion: JavaVersion
if (javaVersion == "17") {
javaCompatibilityVersion = JavaVersion.VERSION_17
} else if (javaVersion == "21") {
javaCompatibilityVersion = JavaVersion.VERSION_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
java {
sourceCompatibility = javaCompatibilityVersion
Expand Down
16 changes: 12 additions & 4 deletions flutter-idea/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ val untilBuildInput = providers.gradleProperty("untilBuild").get()
val javaVersion = providers.gradleProperty("javaVersion").get()
group = "io.flutter"

var jvmVersion = JvmTarget.JVM_17
if (javaVersion == "21") {
var jvmVersion: JvmTarget
if (javaVersion == "17") {
jvmVersion = JvmTarget.JVM_17
} else if (javaVersion == "21") {
jvmVersion = JvmTarget.JVM_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
kotlin {
compilerOptions {
Expand All @@ -49,9 +53,13 @@ kotlin {
}
}

var javaCompatibilityVersion = JavaVersion.VERSION_17
if (javaVersion == "21") {
var javaCompatibilityVersion: JavaVersion
if (javaVersion == "17") {
javaCompatibilityVersion = JavaVersion.VERSION_17
} else if (javaVersion == "21") {
javaCompatibilityVersion = JavaVersion.VERSION_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
java {
sourceCompatibility = javaCompatibilityVersion
Expand Down
16 changes: 12 additions & 4 deletions flutter-studio/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ val untilBuildInput = providers.gradleProperty("untilBuild").get()
val javaVersion = providers.gradleProperty("javaVersion").get()
group = "io.flutter"

var jvmVersion = JvmTarget.JVM_17
if (javaVersion == "21") {
var jvmVersion: JvmTarget
if (javaVersion == "17") {
jvmVersion = JvmTarget.JVM_17
} else if (javaVersion == "21") {
jvmVersion = JvmTarget.JVM_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
kotlin {
compilerOptions {
Expand All @@ -50,9 +54,13 @@ kotlin {
}
}

var javaCompatibilityVersion = JavaVersion.VERSION_17
if (javaVersion == "21") {
var javaCompatibilityVersion: JavaVersion
if (javaVersion == "17") {
javaCompatibilityVersion = JavaVersion.VERSION_17
} else if (javaVersion == "21") {
javaCompatibilityVersion = JavaVersion.VERSION_21
} else {
throw IllegalArgumentException("javaVersion must be defined in the product matrix as either \"17\" or \"21\", but is not for $ideaVersion")
}
java {
sourceCompatibility = javaCompatibilityVersion
Expand Down