Skip to content

Commit

Permalink
Removing the need for a default JS engine in JDK to call ant tryme. (a…
Browse files Browse the repository at this point in the history
…pache#2594)

* Removing the need for a default JS engine in JDK to call ant tryme.

* Reimplement the merge of the tryme.arg.* properties into tryme.args in java

* Should have a known iteration order; tryme.args is always non-empty, no need to set it.

* Using setNewProperty instead of setProperty.

* Update nbbuild/antsrc/org/netbeans/nbbuild/MergeTrymeArgs.java

Co-authored-by: Jesse Glick <[email protected]>

* Update nbbuild/build.xml

Co-authored-by: Jesse Glick <[email protected]>

Co-authored-by: Matthias Bläsing <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2020
1 parent 6529604 commit 7b3f4ee
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
41 changes: 41 additions & 0 deletions nbbuild/antsrc/org/netbeans/nbbuild/MergeTrymeArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.nbbuild;

import java.util.Map.Entry;
import java.util.TreeMap;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

/**
* Merge the arguments supplied via any {@code tryme.arg.*} properties into the
* property {@code tryme.args}.
*/
public class MergeTrymeArgs extends Task {
public @Override void execute() throws BuildException {
StringBuilder tryMeArgs = new StringBuilder();
for(Entry<String,Object> e: new TreeMap<>(getProject().getProperties()).entrySet()) {
if(e.getKey().startsWith("tryme.arg.")) {
tryMeArgs.append(" ");
tryMeArgs.append(e.getValue());
}
}
getProject().setNewProperty("tryme.args", tryMeArgs.toString());
}
}
16 changes: 2 additions & 14 deletions nbbuild/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1189,22 +1189,10 @@ PKGINST=${pkg.svr4.pkginst}</echo>
description="Try running the IDE interactively.
It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in debug mode"
>
<script language="javascript">
if (typeof Packages !== 'undefined') {
v = '';
i = new Packages.java.util.TreeMap(project.getProperties()).entrySet().iterator()
while (i.hasNext()) {
e = i.next()
if (e.getKey().startsWith('tryme.arg.')) {
v += ' ' + e.getValue()
}
}
project.setNewProperty('tryme.args', v)
}
</script>
<taskdef name="mergetrymeargs" classname="org.netbeans.nbbuild.MergeTrymeArgs" classpath="${nbantext.jar}"/>
<mergetrymeargs/>
<property name="tryme.jdkhome" value="${nbjdk.home}"/>
<property name="tryme.debug.args" value="" />
<property name="tryme.args" value="" />
<property environment="env"/>
<condition property="run.env.display" value="${env.NBDISPLAY}" else="${env.DISPLAY}">
<isset property="env.NBDISPLAY"/>
Expand Down

0 comments on commit 7b3f4ee

Please sign in to comment.