[build scripts] better logging, use argFile to avoid too long command line problems on win

GitOrigin-RevId: 742c4218b79c1bf20f894519d1d4fb95d4aca503
This commit is contained in:
Anna Kozlova
2021-08-16 18:54:07 +00:00
committed by intellij-monorepo-bot
parent 80fd13103d
commit d8d57e3a2f
@@ -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<String> args = new ArrayList<>()
String jvmExecutablePath = options.customJrePath != null ? "$options.customJrePath" : context.paths.jdkHome
args.add(jvmExecutablePath + "/bin/java")
args.add("-classpath")
List<String> 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()