You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/08/23 06:08:30 UTC

[camel-quarkus] branch main updated: perf-regression: workaround hyperfoil-maven-plugin issue with JDK 17 #4016

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 629cf9eea9 perf-regression: workaround hyperfoil-maven-plugin issue with JDK 17 #4016
629cf9eea9 is described below

commit 629cf9eea97dfd27c7779c75f0694fe37748121b
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 22 14:19:44 2022 +0200

    perf-regression: workaround hyperfoil-maven-plugin issue with JDK 17 #4016
---
 .../quarkus/performance/regression/MvnwCmdHelper.java  | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
index 9568de574c..e1fb18f23d 100644
--- a/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
+++ b/tooling/perf-regression/src/main/java/org/apache/camel/quarkus/performance/regression/MvnwCmdHelper.java
@@ -21,16 +21,21 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
+import java.util.Map;
 
 import org.apache.commons.exec.CommandLine;
 import org.apache.commons.exec.DefaultExecutor;
 import org.apache.commons.exec.PumpStreamHandler;
+import org.apache.commons.exec.environment.EnvironmentUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.commons.io.output.TeeOutputStream;
+import org.jboss.logging.Logger;
 
 public class MvnwCmdHelper {
 
+    private static final Logger LOGGER = Logger.getLogger(MvnwCmdHelper.class);
+
     public static String execute(Path cqVersionUnderTestFolder, String args) {
 
         ByteArrayOutputStream stdoutAndStderrMemoryStream = null;
@@ -61,7 +66,18 @@ public class MvnwCmdHelper {
             executor.setStreamHandler(psh);
             executor.setWorkingDirectory(cqVersionUnderTestFolder.toFile());
 
-            int exitValue = executor.execute(cmd);
+            Map<String, String> environment = EnvironmentUtils.getProcEnvironment();
+
+            String newMavenOpts = "MAVEN_OPTS=--add-opens java.base/java.lang=ALL-UNNAMED";
+            if (environment.containsKey("MAVEN_OPTS")) {
+                String currentMavenOpts = environment.get("MAVEN_OPTS");
+                LOGGER.debugf("MAVEN_OPTS is already set up in the main process with value: %s", currentMavenOpts);
+                newMavenOpts = "MAVEN_OPTS=" + currentMavenOpts + " --add-opens java.base/java.lang=ALL-UNNAMED";
+            }
+            LOGGER.debugf("Setting MAVEN_OPTS in child process with value: %s", newMavenOpts);
+            EnvironmentUtils.addVariableToEnvironment(environment, newMavenOpts);
+
+            int exitValue = executor.execute(cmd, environment);
             String outAndErr = stdoutAndStderrMemoryStream.toString(StandardCharsets.UTF_8);
             if (exitValue != 0) {
                 throw new RuntimeException("The command '" + cmd + "' has returned exitValue " + exitValue