mirror of https://github.com/apache/lucene.git
speed up javac and error-prone tasks by using less resources (#11927)
* pass jvm args to javac #11925 * Update net.ltgt.errorprone to the latest version so that jvm args are not overwritten, add -XX:+PrintFlagsFinal for debugging * speed up the pure javac case too It does not help to fork additional VMs (although error-prone will do this since it messes with bootstrap classpath), so we avoid forking. Instead it is best to tune org.gradle.jvmargs. * use the flags consistently everywhere (tests and doc) Co-authored-by: Robert Muir <rmuir@apache.org>
This commit is contained in:
parent
02528c6757
commit
b9c51d9a59
|
@ -24,7 +24,7 @@ plugins {
|
|||
id "org.owasp.dependencycheck" version "7.2.0"
|
||||
id 'de.thetaphi.forbiddenapis' version '3.4' apply false
|
||||
id "de.undercouch.download" version "5.2.0" apply false
|
||||
id "net.ltgt.errorprone" version "2.0.2" apply false
|
||||
id "net.ltgt.errorprone" version "3.0.1" apply false
|
||||
id 'com.diffplug.spotless' version "6.5.2" apply false
|
||||
id 'org.barfuin.gradle.jacocolog' version "3.0.0-RC2" apply false
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ systemProp.file.encoding=UTF-8
|
|||
# The heap seems huge but gradle runs out of memory on lower values (don't know why).
|
||||
#
|
||||
# We also open up internal compiler modules for spotless/ google java format.
|
||||
org.gradle.jvmargs=-Xmx3g \\
|
||||
org.gradle.jvmargs=-Xmx3g -XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1 \\
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \\
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \\
|
||||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \\
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
allprojects {
|
||||
def vmOpts = [
|
||||
'-XX:+UseParallelGC',
|
||||
'-XX:TieredStopAtLevel=1'
|
||||
'-XX:TieredStopAtLevel=1',
|
||||
'-XX:ActiveProcessorCount=1'
|
||||
]
|
||||
|
||||
// Inject vm options into custom javadoc rendering. We can't refer
|
||||
|
@ -38,4 +39,11 @@ allprojects {
|
|||
|
||||
jvmArgs += vmOpts
|
||||
}
|
||||
|
||||
// Tweak javac to not be too resource-hungry.
|
||||
// This applies to any JVM when javac runs forked (e.g. error-prone)
|
||||
// Avoiding the fork entirely is best.
|
||||
tasks.withType(JavaCompile) { JavaCompile task ->
|
||||
task.options.forkOptions.jvmArgs += vmOpts
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ allprojects {
|
|||
description: "Number of forked test JVMs"],
|
||||
[propName: 'tests.haltonfailure', value: true, description: "Halt processing on test failure."],
|
||||
[propName: 'tests.jvmargs',
|
||||
value: { -> propertyOrEnvOrDefault("tests.jvmargs", "TEST_JVM_ARGS", "-XX:TieredStopAtLevel=1") },
|
||||
value: { -> propertyOrEnvOrDefault("tests.jvmargs", "TEST_JVM_ARGS", "-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1") },
|
||||
description: "Arguments passed to each forked JVM."],
|
||||
// Other settings.
|
||||
[propName: 'tests.neverUpToDate', value: true,
|
||||
|
|
|
@ -47,7 +47,7 @@ separately from the gradle workers, for example:
|
|||
tests.jvms=3
|
||||
tests.heapsize=512m
|
||||
tests.minheapsize=512m
|
||||
tests.jvmargs=-XX:+UseParallelGC -XX:TieredStopAtLevel=1
|
||||
tests.jvmargs=-XX:+UseParallelGC -XX:TieredStopAtLevel=1 -XX:ActiveProcessorCount=1
|
||||
|
||||
Gradle Daemon
|
||||
-------------
|
||||
|
|
Loading…
Reference in New Issue