Skip to content

Commit

Permalink
chore(gradle): Align JVM args mapping code with GradleInspector
Browse files Browse the repository at this point in the history
Simplify code a bit by working with a map, and also replace a deprecated
JVM argument.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Feb 17, 2024
1 parent 550f922 commit 2fe4915
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/package-managers/gradle/src/main/kotlin/Gradle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ class Gradle(
// Gradle's default maximum heap is 512 MiB which is too low for bigger projects,
// see https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory.
// Set the value to empirically determined 8 GiB if no value is set in "~/.gradle/gradle.properties".
val jvmArgs = gradleProperties.find { (key, _) ->
key == "org.gradle.jvmargs"
}?.second?.splitOnWhitespace().orEmpty().mapTo(mutableListOf()) { it.unquote() }
val jvmArgs = gradleProperties.toMap().get("org.gradle.jvmargs").orEmpty()

Check notice on line 196 in plugins/package-managers/gradle/src/main/kotlin/Gradle.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Explicit 'get' or 'set' call

Should be replaced with indexing
.replace("MaxPermSize", "MaxMetaspaceSize") // Replace a deprecated JVM argument.
.splitOnWhitespace()
.mapTo(mutableListOf()) { it.unquote() }

if (jvmArgs.none { it.contains(JAVA_MAX_HEAP_SIZE_OPTION, ignoreCase = true) }) {
jvmArgs += "$JAVA_MAX_HEAP_SIZE_OPTION$JAVA_MAX_HEAP_SIZE_VALUE"
Expand Down

0 comments on commit 2fe4915

Please sign in to comment.