From d8d57e3a2f5b135dc1bb0f9a2191cc3bd7ee0474 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Mon, 16 Aug 2021 18:50:57 +0200 Subject: [PATCH] [build scripts] better logging, use argFile to avoid too long command line problems on win GitOrigin-RevId: 742c4218b79c1bf20f894519d1d4fb95d4aca503 --- .../intellij/build/impl/TestingTasksImpl.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy index e2e1caae426c..9ea8ae4eef3a 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy @@ -30,6 +30,7 @@ import org.junit.Test import java.lang.annotation.Annotation import java.lang.reflect.Method import java.lang.reflect.Modifier +import java.nio.charset.Charset import java.nio.file.Files import java.nio.file.Paths import java.util.function.Predicate @@ -459,7 +460,7 @@ class TestingTasksImpl extends TestingTasks { } } catch (Throwable e) { - e.printStackTrace() + context.messages.error("Failed to process $qName", e) } }) } @@ -477,8 +478,6 @@ class TestingTasksImpl extends TestingTasks { String suiteName, String methodName) { List args = new ArrayList<>() - String jvmExecutablePath = options.customJrePath != null ? "$options.customJrePath" : context.paths.jdkHome - args.add(jvmExecutablePath + "/bin/java") args.add("-classpath") List classpath = new ArrayList<>(bootstrapClasspath) if (!isBootstrapSuiteDefault() || isRunningInBatchMode()) { @@ -500,7 +499,9 @@ class TestingTasksImpl extends TestingTasks { if (methodName != null) { args.add(methodName) } - def builder = new ProcessBuilder(args) + File argFile = CommandLineWrapperUtil.createArgumentFile(args, Charset.defaultCharset()) + def builder = new ProcessBuilder((options.customJrePath != null ? "$options.customJrePath" : context.paths.jdkHome) + "/bin/java", + '@' + argFile.getAbsolutePath()) builder.environment().putAll(envVariables) final Process exec = builder.start() new Thread(createInputReader(exec.getErrorStream(), System.err), "Read forked error output").start()