From 39a192b894935771120c1ecf28217b82df478061 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Thu, 25 Jun 2026 21:18:22 -0400 Subject: [PATCH] Share JVM args across test tasks --- build.gradle | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index bbe606cb..282773b3 100644 --- a/build.gradle +++ b/build.gradle @@ -165,6 +165,16 @@ task buildDLJC(type: Exec) { commandLine './buildDLJC' } +def configureTestJvmArgs = { Test testTask -> + if (isJava8) { + testTask.jvmArgs += [ + "-Xbootclasspath/p:${configurations.javacJar.asPath}" + ] + } else { + testTask.jvmArgs += compilerArgsForRunningCF + } +} + test { dependsOn(shadowJar) dependsOn('dist') @@ -178,17 +188,6 @@ test { systemProperties += ["emit.test.debug": 'true'] } - if (isJava8) { - jvmArgs += [ - "-Xbootclasspath/p:${configurations.javacJar.asPath}" - ] - } else { - // Without this, the test throw "java.lang.OutOfMemoryError: Java heap space" - // Corresponding pull request: https://github.com/opprop/checker-framework-inference/pull/263 - forkEvery(1) - jvmArgs += compilerArgsForRunningCF - } - testLogging { // Always run the tests outputs.upToDateWhen { false } @@ -373,11 +372,7 @@ afterEvaluate { systemProperties += ["emit.test.debug": 'true'] } - if (isJava8) { - jvmArgs += [ - "-Xbootclasspath/p:${configurations.javacJar.asPath}" - ] - } + configureTestJvmArgs(delegate) testLogging { // Always run the tests