Browse Source

Switching to Apache BSF

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273541 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
7381c1f077
6 changed files with 31 additions and 28 deletions
  1. +3
    -0
      WHATSNEW
  2. +2
    -2
      build.xml
  3. +2
    -6
      docs/manual/OptionalTasks/script.html
  4. +19
    -5
      docs/manual/install.html
  5. +2
    -2
      docs/manual/tasksoverview.html
  6. +3
    -13
      src/main/org/apache/tools/ant/taskdefs/optional/Script.java

+ 3
- 0
WHATSNEW View File

@@ -14,6 +14,9 @@ Changes that could break older environments:
"java -jar ant-bootstrap.jar" instead if you want to run Ant without "java -jar ant-bootstrap.jar" instead if you want to run Ant without
the wrapper script (not recommended). the wrapper script (not recommended).


* The <script> task now requires Apache BSF instead of the older IBM
version. See <http://jakarta.apache.org/bsf/>

Fixed bugs: Fixed bugs:
----------- -----------




+ 2
- 2
build.xml View File

@@ -319,7 +319,7 @@
<available property="jdk1.4+" classname="java.lang.CharSequence"/> <available property="jdk1.4+" classname="java.lang.CharSequence"/>
<available property="kaffe" classname="kaffe.util.NotImplemented"/> <available property="kaffe" classname="kaffe.util.NotImplemented"/>
<available property="bsf.present" <available property="bsf.present"
classname="com.ibm.bsf.BSFManager"
classname="org.apache.bsf.BSFManager"
classpathref="classpath"/> classpathref="classpath"/>
<condition property="netrexx.present"> <condition property="netrexx.present">
<and> <and>
@@ -840,7 +840,7 @@
<selector refid="needs.commons.logging"/> <selector refid="needs.commons.logging"/>
</jar> </jar>


<jar destfile="${build.lib}/${optional.jars.prefix}-bsf.jar"
<jar destfile="${build.lib}/${optional.jars.prefix}-apache-bsf.jar"
basedir="${build.classes}" basedir="${build.classes}"
manifest="${manifest.tmp}"> manifest="${manifest.tmp}">
<selector refid="needs.bsf"/> <selector refid="needs.bsf"/>


+ 2
- 6
docs/manual/OptionalTasks/script.html View File

@@ -10,7 +10,7 @@
<h2><a name="script">Script</a></h2> <h2><a name="script">Script</a></h2>
<h3>Description</h3> <h3>Description</h3>
<p>Execute a script in a <p>Execute a script in a
<a href="http://www-124.ibm.com/developerworks/projects/bsf" target="_top">BSF</a> supported language.</p>
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> supported language.</p>
<p><b>Note:</b> This task depends on external libraries not included in the Ant distribution. <p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p> See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
<p>All items (tasks, targets, etc) of the running project are <p>All items (tasks, targets, etc) of the running project are
@@ -19,10 +19,6 @@ accessible from the script, using either their <code>name</code> or
valid Java identifiers, that is). valid Java identifiers, that is).
The name "project" is a pre-defined reference to the Project, which can be The name "project" is a pre-defined reference to the Project, which can be
used instead of the project name.</p> used instead of the project name.</p>
<p><b>BeanShell users:</b> This task now natively supports the BeanShell
scripting language, using language="beanshell". The BeanShell engine is
still required.
</p>
<p>Scripts can do almost anything a task written in Java could do.</p> <p>Scripts can do almost anything a task written in Java could do.</p>
<h3>Parameters</h3> <h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0"> <table border="1" cellpadding="2" cellspacing="0">
@@ -34,7 +30,7 @@ still required.
<tr> <tr>
<td valign="top">language</td> <td valign="top">language</td>
<td valign="top">The programming language the script is written in. <td valign="top">The programming language the script is written in.
Must be a supported BSF language</td>
Must be a supported Apache BSF language</td>
<td valign="top" align="center">Yes</td> <td valign="top" align="center">Yes</td>
</tr> </tr>
<tr> <tr>


+ 19
- 5
docs/manual/install.html View File

@@ -320,23 +320,27 @@ Installing Ant / Optional Tasks</a> section above.</p>
<tr> <tr>
<td >bsf.jar</td> <td >bsf.jar</td>
<td>script task</td> <td>script task</td>
<td><a href="http://oss.software.ibm.com/developerworks/projects/bsf" target="_top">
oss.software.ibm.com/developerworks/projects/bsf</a></td>
<td><a href="http://jakarta.apache.org/bsf/" target="_top">http://jakarta.apache.org/bsf/</a></td>
</tr> </tr>
<tr> <tr>
<td>netrexx.jar</td> <td>netrexx.jar</td>
<td>netrexx task</td>
<td>netrexx task, Rexx with the script task</td>
<td><a href="http://www2.hursley.ibm.com/netrexx" target="_top"> <td><a href="http://www2.hursley.ibm.com/netrexx" target="_top">
www2.hursley.ibm.com/netrexx</a></td> www2.hursley.ibm.com/netrexx</a></td>
</tr> </tr>
<tr> <tr>
<td>js.jar</td> <td>js.jar</td>
<td>javascript with script task</td>
<td>Javascript with script task</td>
<td><a href="http://www.mozilla.org/rhino/" target="_top">www.mozilla.org/rhino</a></td> <td><a href="http://www.mozilla.org/rhino/" target="_top">www.mozilla.org/rhino</a></td>
</tr> </tr>
<tr>
<td>jython.jar</td>
<td>Python with script task</td>
<td><a href="http://jython.sourceforge.net/" target="_top">jython.sourceforge.net</a></td>
</tr>
<tr> <tr>
<td>jpython.jar</td> <td>jpython.jar</td>
<td>python with script task</td>
<td>Python with script task <b>deprecated, jython is the prefered engine</b></td>
<td><a href="http://www.jpython.org/" target="_top">www.jpython.org</a></td> <td><a href="http://www.jpython.org/" target="_top">www.jpython.org</a></td>
</tr> </tr>
<tr> <tr>
@@ -349,6 +353,16 @@ Installing Ant / Optional Tasks</a> section above.</p>
<td>BeanShell with script task</td> <td>BeanShell with script task</td>
<td><a href="http://www.beanshell.org" target="_top">www.beanshell.org</a></td> <td><a href="http://www.beanshell.org" target="_top">www.beanshell.org</a></td>
</tr> </tr>
<tr>
<td>jruby.jar</td>
<td>Ruby with script task</td>
<td><a href="http://jruby.sourceforge.net/" target="_top">jruby.sourceforge.net</a></td>
</tr>
<tr>
<td>judo.jar</td>
<td>Judoscript with script task</td>
<td><a href="http://www.judoscript.com/index.html" target="_top">www.judoscript.com/index.html</a></td>
</tr>
<tr> <tr>
<td>netcomponents.jar</td> <td>netcomponents.jar</td>
<td>ftp and telnet tasks</td> <td>ftp and telnet tasks</td>


+ 2
- 2
docs/manual/tasksoverview.html View File

@@ -723,8 +723,8 @@ documentation.</p>
<tr valign="top"> <tr valign="top">
<td nowrap><a href="OptionalTasks/script.html">Script</a></td> <td nowrap><a href="OptionalTasks/script.html">Script</a></td>
<td><p>Executes a script in a <td><p>Executes a script in a
<a href="http://oss.software.ibm.com/developerworks/opensource/bsf/"
target="_top">BSF</a>-supported language.</p></td>
<a href="http://jakarta.apache.org/bsf/"
target="_top">Apache BSF</a>-supported language.</p></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">


+ 3
- 13
src/main/org/apache/tools/ant/taskdefs/optional/Script.java View File

@@ -53,13 +53,13 @@
*/ */
package org.apache.tools.ant.taskdefs.optional; package org.apache.tools.ant.taskdefs.optional;


import com.ibm.bsf.BSFException;
import com.ibm.bsf.BSFManager;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.bsf.BSFException;
import org.apache.bsf.BSFManager;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


@@ -74,16 +74,6 @@ public class Script extends Task {
private String script = ""; private String script = "";
private Hashtable beans = new Hashtable(); private Hashtable beans = new Hashtable();


// Register BeanShell ourselves, since BSF does not
// natively support it (yet).
// This "hack" can be removed once BSF has been
// modified to support BeanShell or more dynamic
// registration.
static {
BSFManager.registerScriptingEngine( "beanshell",
"bsh.util.BeanShellBSFEngine", new String [] { "bsh" } );
}

/** /**
* Add a list of named objects to the list to be exported to the script * Add a list of named objects to the list to be exported to the script
*/ */
@@ -99,7 +89,7 @@ public class Script extends Task {
} }


if (isValid) { if (isValid) {
beans.put(key, dictionary.get(key));
beans.put(key, dictionary.get(key));
} }
} }
} }


Loading…
Cancel
Save