You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2020/04/20 08:29:17 UTC

[netbeans] branch master updated: [NETBEANS-4127] Adjust maven profiler to provide jvmargs as separate options

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

skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new a46fa29  [NETBEANS-4127] Adjust maven profiler to provide jvmargs as separate options
     new e752764  Merge pull request #2068 from errael/master
a46fa29 is described below

commit a46fa29c84f56cfb51c0645d921054a0bb238670
Author: Ernie Rael <er...@raelity.com>
AuthorDate: Tue Apr 7 22:42:35 2020 +0100

    [NETBEANS-4127] Adjust maven profiler to provide jvmargs as separate options
---
 .../modules/maven/newproject/MavenWizardIterator.java |  4 ++--
 .../modules/maven/profiler/RunCheckerImpl.java        | 19 ++++++++++++++++---
 .../profiler/nbimpl/actions/ProfilerLauncher.java     | 10 ++++++++--
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/java/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java b/java/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
index a940cfc..387ad1a 100644
--- a/java/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
+++ b/java/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
@@ -93,13 +93,13 @@ public class MavenWizardIterator implements WizardDescriptor.BackgroundInstantia
     @TemplateRegistration(folder=ArchetypeWizards.TEMPLATE_FOLDER, position = 925, displayName = "#LBL_Maven_FXML_Archetype", iconBase = "org/netbeans/modules/maven/resources/jaricon.png", description = "javafx.html")
     @Messages("LBL_Maven_FXML_Archetype=FXML JavaFX Maven Archetype (Gluon)")
     public static WizardDescriptor.InstantiatingIterator<?> openJFXFML() {
-       return definedFXArchetype("com.raelity.jfx", "javafx-archetype-fxml-netbeans", "0.0.3", LBL_Maven_FXML_Archetype());
+       return definedFXArchetype("com.raelity.jfx", "javafx-archetype-fxml-netbeans", "0.0.4", LBL_Maven_FXML_Archetype());
     }
 
     @TemplateRegistration(folder=ArchetypeWizards.TEMPLATE_FOLDER, position = 926, displayName = "#LBL_Maven_Simple_Archetype", iconBase = "org/netbeans/modules/maven/resources/jaricon.png", description = "javafx.html")
     @Messages("LBL_Maven_Simple_Archetype=Simple JavaFX Maven Archetype (Gluon)")
     public static WizardDescriptor.InstantiatingIterator<?> openJFXSimple() {
-       return definedFXArchetype("com.raelity.jfx", "javafx-archetype-simple-netbeans", "0.0.3", LBL_Maven_Simple_Archetype());
+       return definedFXArchetype("com.raelity.jfx", "javafx-archetype-simple-netbeans", "0.0.4", LBL_Maven_Simple_Archetype());
     }
 
     private static WizardDescriptor.InstantiatingIterator<?> definedFXArchetype(String g, String a, String v, String name) {
diff --git a/profiler/maven.profiler/src/org/netbeans/modules/maven/profiler/RunCheckerImpl.java b/profiler/maven.profiler/src/org/netbeans/modules/maven/profiler/RunCheckerImpl.java
index 5320783..19dee4f 100644
--- a/profiler/maven.profiler/src/org/netbeans/modules/maven/profiler/RunCheckerImpl.java
+++ b/profiler/maven.profiler/src/org/netbeans/modules/maven/profiler/RunCheckerImpl.java
@@ -112,18 +112,31 @@ public class RunCheckerImpl implements LateBoundPrerequisitesChecker {
             
             session.setAttribute("mvn-run-checker.config", config);
              
+            final String agentArg = sProps.get("agent.jvmargs"); // NOI18N
+            final String internalProfilerArgs = sProps.get("profiler.info.jvmargs") // NOI18N
+                                + " " + agentArg; // NOI18N 
+
+            final String prefixPublicArgs = "profiler.jvmargs"; // NOI18N
+            config.setProperty(prefixPublicArgs+".all",internalProfilerArgs); // NOI18N
             for (Map.Entry<? extends String, ? extends String> entry : config.getProperties().entrySet()) {
                 if (entry.getKey().equals(VM_ARGS)) {
                     String value = entry.getValue();
                     int index = value.indexOf(PROFILER_ARGS);
                     if(index > -1) {
-                        String agentArg = sProps.get("agent.jvmargs");
-                        value = value.replace(PROFILER_ARGS, sProps.get("profiler.info.jvmargs") // NOI18N
-                                + " " + agentArg); // NOI18N
+                        value = value.replace(PROFILER_ARGS, internalProfilerArgs);
                         config.setProperty(entry.getKey(), value);
                     }
                 }
             }
+            // Make the profiler jvm args available as individual arguments.
+            // Note: this assumes ordering doesn't matter.
+            int idxArg = 0;
+            for(Map.Entry<String, String> entry : sProps.entrySet()) {
+                if(entry.getKey().startsWith("profiler.netbeansBindings.jvmarg.")) { // NOI18N
+                    ++idxArg;
+                    config.setProperty(prefixPublicArgs+".arg"+idxArg, entry.getValue()); // NOI18N
+                }
+            }
             final ProfilerLauncher.Session s = session;
             // Attach profiler engine (in separate thread) to profiled process
             if (!NetBeansProfiler.getDefaultNB().startEx(s.getProfilingSettings(), s.getSessionSettings(), new AtomicBoolean())) {
diff --git a/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/actions/ProfilerLauncher.java b/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/actions/ProfilerLauncher.java
index 37fc1d1..fe4ebb7 100644
--- a/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/actions/ProfilerLauncher.java
+++ b/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/actions/ProfilerLauncher.java
@@ -69,6 +69,7 @@ public class ProfilerLauncher {
     
     final private static String AGENT_ARGS = "agent.jvmargs"; // NOI18N
     final private static String LINUX_THREAD_TIMER_KEY = "-XX:+UseLinuxPosixThreadCPUClocks"; // NOI18N
+    final private static String ARGS_PREFIX = "profiler.netbeansBindings.jvmarg"; // NOI18N
     
     public static final class Command {
         private final String command;
@@ -541,6 +542,7 @@ public class ProfilerLauncher {
         }
         assert agentArgs != null;
         props.put(AGENT_ARGS, agentArgs);
+        props.put(ARGS_PREFIX + ".agent", agentArgs); // NOI18N
 
         if (Platform.isLinux() && javaVersion.equals(CommonConstants.JDK_16_STRING)) {
             activateLinuxPosixThreadTime(pSettings, props);
@@ -608,8 +610,12 @@ public class ProfilerLauncher {
                     heapDumpPath = "\"" + heapDumpPath + "\"";//NOI18N
                 }
 
-                oomArgsBuffer.append(" -XX:+HeapDumpOnOutOfMemoryError"); // NOI18N
-                oomArgsBuffer.append(" -XX:HeapDumpPath=").append(heapDumpPath).append(" "); // NOI18N
+                final String oom = "-XX:+HeapDumpOnOutOfMemoryError";
+                final String path = "-XX:HeapDumpPath=" + heapDumpPath;
+                oomArgsBuffer.append(" ").append(oom); // NOI18N
+                oomArgsBuffer.append(" ").append(path).append(" "); // NOI18N
+                props.put(ARGS_PREFIX + ".outOfMemory", oom); // NOI18N
+                props.put(ARGS_PREFIX + ".heapDumpPath", path); // NOI18N
 
                 ProfilerLogger.log("Profiler.OutOfMemoryDetection: Enabled"); // NOI18N
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists