Make sure test.jdk.launcher.args is passed as jvm args to test launcher
This commit is contained in:
parent
02c6531fcb
commit
d7a46451ce
|
@ -81,6 +81,11 @@ public class JavaModulePlugin implements Plugin<Project> {
|
||||||
javaToolchainSpec.getLanguageVersion().set( jdkVersionsConfig.getTestLauncherVersion() );
|
javaToolchainSpec.getLanguageVersion().set( jdkVersionsConfig.getTestLauncherVersion() );
|
||||||
} )
|
} )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final String launcherArgs = jdkVersionsConfig.getTest().getLauncherArgs();
|
||||||
|
if ( launcherArgs != null ) {
|
||||||
|
testTask.jvmArgs( (Object[]) launcherArgs.split( " " ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class JdkVersionConfig {
|
||||||
public static final String DSL_NAME = "jdkVersions";
|
public static final String DSL_NAME = "jdkVersions";
|
||||||
public static final String MAIN_JDK_VERSION = "main.jdk.version";
|
public static final String MAIN_JDK_VERSION = "main.jdk.version";
|
||||||
public static final String TEST_JDK_VERSION = "test.jdk.version";
|
public static final String TEST_JDK_VERSION = "test.jdk.version";
|
||||||
|
public static final String TEST_JDK_LAUNCHER_ARGS = "test.jdk.launcher.args";
|
||||||
|
|
||||||
private final boolean explicit;
|
private final boolean explicit;
|
||||||
private final JavaLanguageVersion baseline;
|
private final JavaLanguageVersion baseline;
|
||||||
|
@ -43,11 +44,12 @@ public class JdkVersionConfig {
|
||||||
JavaLanguageVersion mainReleaseVersion,
|
JavaLanguageVersion mainReleaseVersion,
|
||||||
JavaLanguageVersion testCompileVersion,
|
JavaLanguageVersion testCompileVersion,
|
||||||
JavaLanguageVersion testReleaseVersion,
|
JavaLanguageVersion testReleaseVersion,
|
||||||
JavaLanguageVersion testLauncherVersion) {
|
JavaLanguageVersion testLauncherVersion,
|
||||||
|
String testLauncherArgs) {
|
||||||
this.explicit = explicit;
|
this.explicit = explicit;
|
||||||
this.baseline = baseline;
|
this.baseline = baseline;
|
||||||
this.main = new MainJdks( mainCompileVersion, mainReleaseVersion );
|
this.main = new MainJdks( mainCompileVersion, mainReleaseVersion );
|
||||||
this.test = new TestJdks( testCompileVersion, testReleaseVersion, testLauncherVersion );
|
this.test = new TestJdks( testCompileVersion, testReleaseVersion, testLauncherVersion, testLauncherArgs );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExplicitlyConfigured() {
|
public boolean isExplicitlyConfigured() {
|
||||||
|
@ -110,7 +112,8 @@ public class JdkVersionConfig {
|
||||||
JavaLanguageVersion explicitTestVersion,
|
JavaLanguageVersion explicitTestVersion,
|
||||||
JavaLanguageVersion gradleJdkVersion,
|
JavaLanguageVersion gradleJdkVersion,
|
||||||
JavaLanguageVersion baselineJdkVersion,
|
JavaLanguageVersion baselineJdkVersion,
|
||||||
JavaLanguageVersion maxSupportedJdkVersion) {
|
JavaLanguageVersion maxSupportedJdkVersion,
|
||||||
|
String testLauncherArgs) {
|
||||||
final boolean explicitlyConfigured = explicitMainVersion != null || explicitTestVersion != null;
|
final boolean explicitlyConfigured = explicitMainVersion != null || explicitTestVersion != null;
|
||||||
|
|
||||||
final JavaLanguageVersion mainCompileVersion;
|
final JavaLanguageVersion mainCompileVersion;
|
||||||
|
@ -144,7 +147,8 @@ public class JdkVersionConfig {
|
||||||
mainReleaseVersion,
|
mainReleaseVersion,
|
||||||
testCompileVersion,
|
testCompileVersion,
|
||||||
testReleaseVersion,
|
testReleaseVersion,
|
||||||
testLauncherVersion
|
testLauncherVersion,
|
||||||
|
testLauncherArgs
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -169,7 +173,8 @@ public class JdkVersionConfig {
|
||||||
baselineJdkVersion,
|
baselineJdkVersion,
|
||||||
gradleJdkVersion,
|
gradleJdkVersion,
|
||||||
baselineJdkVersion,
|
baselineJdkVersion,
|
||||||
gradleJdkVersion
|
gradleJdkVersion,
|
||||||
|
testLauncherArgs
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,14 +250,17 @@ public class JdkVersionConfig {
|
||||||
private final JavaLanguageVersion compileVersion;
|
private final JavaLanguageVersion compileVersion;
|
||||||
private final JavaLanguageVersion releaseVersion;
|
private final JavaLanguageVersion releaseVersion;
|
||||||
private final JavaLanguageVersion launcherVersion;
|
private final JavaLanguageVersion launcherVersion;
|
||||||
|
private final String launcherArgs;
|
||||||
|
|
||||||
public TestJdks(
|
public TestJdks(
|
||||||
JavaLanguageVersion compileVersion,
|
JavaLanguageVersion compileVersion,
|
||||||
JavaLanguageVersion releaseVersion,
|
JavaLanguageVersion releaseVersion,
|
||||||
JavaLanguageVersion launcherVersion) {
|
JavaLanguageVersion launcherVersion,
|
||||||
|
String launcherArgs) {
|
||||||
this.compileVersion = compileVersion;
|
this.compileVersion = compileVersion;
|
||||||
this.releaseVersion = releaseVersion;
|
this.releaseVersion = releaseVersion;
|
||||||
this.launcherVersion = launcherVersion;
|
this.launcherVersion = launcherVersion;
|
||||||
|
this.launcherArgs = launcherArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaLanguageVersion getCompiler() {
|
public JavaLanguageVersion getCompiler() {
|
||||||
|
@ -273,6 +281,10 @@ public class JdkVersionConfig {
|
||||||
return launcherVersion;
|
return launcherVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLauncherArgs() {
|
||||||
|
return launcherArgs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[compile: " + compileVersion + ", release:" + releaseVersion + ", launcher: " + launcherVersion + "]";
|
return "[compile: " + compileVersion + ", release:" + releaseVersion + ", launcher: " + launcherVersion + "]";
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.gradle.jvm.toolchain.JavaToolchainSpec;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.MAIN_JDK_VERSION;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.MAIN_JDK_VERSION;
|
||||||
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_LAUNCHER_ARGS;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_VERSION;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_VERSION;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.createVersionConfig;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.createVersionConfig;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.extractVersion;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.extractVersion;
|
||||||
|
@ -51,13 +52,16 @@ public class JdkVersionPlugin implements Plugin<Project> {
|
||||||
final VersionCatalog jdkVersions = versionCatalogs.named( "jdks" );
|
final VersionCatalog jdkVersions = versionCatalogs.named( "jdks" );
|
||||||
final JavaLanguageVersion baselineJdkVersion = getJavaLanguageVersion( jdkVersions, "baseline" );
|
final JavaLanguageVersion baselineJdkVersion = getJavaLanguageVersion( jdkVersions, "baseline" );
|
||||||
final JavaLanguageVersion maxSupportedJdkVersion = getJavaLanguageVersion( jdkVersions, "maxSupportedBytecode" );
|
final JavaLanguageVersion maxSupportedJdkVersion = getJavaLanguageVersion( jdkVersions, "maxSupportedBytecode" );
|
||||||
|
final Object testLauncherArgsObject = project.getProperties().get( TEST_JDK_LAUNCHER_ARGS );
|
||||||
|
final String testLauncherArgs = testLauncherArgsObject == null ? null : testLauncherArgsObject.toString();
|
||||||
|
|
||||||
final JdkVersionConfig jdkVersionConfig = createVersionConfig(
|
final JdkVersionConfig jdkVersionConfig = createVersionConfig(
|
||||||
explicitMainVersion,
|
explicitMainVersion,
|
||||||
explicitTestVersion,
|
explicitTestVersion,
|
||||||
gradleJdkVersion,
|
gradleJdkVersion,
|
||||||
baselineJdkVersion,
|
baselineJdkVersion,
|
||||||
maxSupportedJdkVersion
|
maxSupportedJdkVersion,
|
||||||
|
testLauncherArgs
|
||||||
);
|
);
|
||||||
|
|
||||||
project.getExtensions().add( JdkVersionConfig.DSL_NAME, jdkVersionConfig );
|
project.getExtensions().add( JdkVersionConfig.DSL_NAME, jdkVersionConfig );
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.toolchains;
|
package org.hibernate.orm.toolchains;
|
||||||
|
|
||||||
|
import org.gradle.StartParameter;
|
||||||
import org.gradle.api.JavaVersion;
|
import org.gradle.api.JavaVersion;
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.artifacts.VersionCatalog;
|
import org.gradle.api.artifacts.VersionCatalog;
|
||||||
|
@ -17,6 +18,7 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.MAIN_JDK_VERSION;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.MAIN_JDK_VERSION;
|
||||||
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_LAUNCHER_ARGS;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_VERSION;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.TEST_JDK_VERSION;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.createVersionConfig;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.createVersionConfig;
|
||||||
import static org.hibernate.orm.toolchains.JdkVersionConfig.extractVersion;
|
import static org.hibernate.orm.toolchains.JdkVersionConfig.extractVersion;
|
||||||
|
@ -39,13 +41,17 @@ public class JdkVersionSettingsPlugin implements Plugin<Settings> {
|
||||||
// maxSupportedJdkVersion = getJavaLanguageVersion( jdkVersions, "maxSupportedBytecode" );
|
// maxSupportedJdkVersion = getJavaLanguageVersion( jdkVersions, "maxSupportedBytecode" );
|
||||||
baselineJdkVersion = JavaLanguageVersion.of( "11" );
|
baselineJdkVersion = JavaLanguageVersion.of( "11" );
|
||||||
maxSupportedJdkVersion = JavaLanguageVersion.of( "17" );
|
maxSupportedJdkVersion = JavaLanguageVersion.of( "17" );
|
||||||
|
final StartParameter startParameters = settings.getGradle().getStartParameter();
|
||||||
|
final Object testLauncherArgsObject = startParameters.getProjectProperties().get( TEST_JDK_LAUNCHER_ARGS );
|
||||||
|
final String testLauncherArgs = testLauncherArgsObject == null ? null : testLauncherArgsObject.toString();
|
||||||
|
|
||||||
final JdkVersionConfig jdkVersionConfig = createVersionConfig(
|
final JdkVersionConfig jdkVersionConfig = createVersionConfig(
|
||||||
explicitMainVersion,
|
explicitMainVersion,
|
||||||
explicitTestVersion,
|
explicitTestVersion,
|
||||||
gradleJdkVersion,
|
gradleJdkVersion,
|
||||||
baselineJdkVersion,
|
baselineJdkVersion,
|
||||||
maxSupportedJdkVersion
|
maxSupportedJdkVersion,
|
||||||
|
testLauncherArgs
|
||||||
);
|
);
|
||||||
|
|
||||||
settings.getGradle().getExtensions().add( JdkVersionConfig.DSL_NAME, jdkVersionConfig );
|
settings.getGradle().getExtensions().add( JdkVersionConfig.DSL_NAME, jdkVersionConfig );
|
||||||
|
|
Loading…
Reference in New Issue