HHH-14315 Force JVM options when using toolchains

Apparently Gradle won't just use the same options as in its own JVM.

Signed-off-by: Yoann Rodière <yoann@hibernate.org>
This commit is contained in:
Yoann Rodière 2020-11-09 12:09:02 +01:00 committed by Sanne Grinovero
parent 9616e24c80
commit 85b84ef6bd
4 changed files with 25 additions and 2 deletions

View File

@ -141,6 +141,11 @@ task aggregateJavadocs(type: Javadoc) {
}
options.addStringOption( 'Xdoclint:none', '-quiet' )
if ( gradle.ext.javaToolchainEnabled ) {
options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString().
split( ' ' ).toList().findAll( { !it.isEmpty() } ) )
}
}
if ( gradle.ext.javaToolchainEnabled ) {

View File

@ -1,5 +1,8 @@
# Keep system properties in sync with test system properties (java-module.gradle)!
# Keep all these properties in sync unless you know what you are doing!
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
toolchain.compiler.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
toolchain.javadoc.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
toolchain.launcher.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8
# JDK auto-detection is not quite ready yet in Gradle 6.7.
# On Fedora in particular, if you have the package java-1.8.0-openjdk-headless-1.8.0.265.b01-1.fc32.x86_64 installed,

View File

@ -160,6 +160,14 @@ else {
}
}
// Configure JVM Options
tasks.withType( JavaCompile ).configureEach {
options.forkOptions.jvmArgs.addAll( getProperty( 'toolchain.compiler.jvmargs' ).toString().split( ' ' ) )
}
tasks.withType( Javadoc ).configureEach {
options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString().split( ' ' ).toList().findAll( { !it.isEmpty() } ) )
}
// Display version of Java tools
tasks.withType( JavaCompile ).configureEach {
doFirst {
@ -219,6 +227,10 @@ if ( gradle.ext.javaToolchainEnabled ) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = gradle.ext.javaVersions.test.launcher
}
// Configure JVM Options
jvmArgs.addAll( getProperty( 'toolchain.launcher.jvmargs' ).toString().split( ' ' ) )
// Display version of Java tools
doFirst {
logger.lifecycle "Testing with '${javaLauncher.get().metadata.installationPath}'"

View File

@ -259,7 +259,10 @@ task testJavassist(type: Test) {
languageVersion = gradle.ext.javaVersions.test.launcher
}
// Display version of Java tools
// Configure JVM Options
jvmArgs.addAll( getProperty( 'toolchain.launcher.jvmargs' ).toString().split( ' ' ) )
// Display version of Java tools
doFirst {
logger.lifecycle "Testing javassist with '${javaLauncher.get().metadata.installationPath}'"
}