Browse Source

support the groovy language for the script and scriptdef tasks

Add groovy to the BSF supported tasks
Change the script names to remove <> to allow current Groovy implementation
to work


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276076 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
d3f02f3fad
3 changed files with 15 additions and 2 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/Script.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
  3. +13
    -0
      src/main/org/apache/tools/ant/util/ScriptRunner.java

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

@@ -58,7 +58,7 @@ public class Script extends Task {
runner.addBean("project", getProject());
runner.addBean("self", this);

runner.executeScript("<ANT>");
runner.executeScript("ANT");
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java View File

@@ -314,7 +314,7 @@ public class ScriptDef extends DefBase {
runner.addBean("attributes", attributes);
runner.addBean("elements", elements);
runner.addBean("project", getProject());
runner.executeScript("scriptdef <" + name + ">");
runner.executeScript("scriptdef_" + name);
}




+ 13
- 0
src/main/org/apache/tools/ant/util/ScriptRunner.java View File

@@ -33,6 +33,19 @@ import java.util.Iterator;
* @author Conor MacNeill
*/
public class ScriptRunner {

// Register Groovy ourselves, since BSF does not
// natively support it (yet).
// This "hack" can be removed once BSF has been
// modified to support Groovy or more dynamic
// registration.
static {
BSFManager.registerScriptingEngine(
"groovy",
"org.codehaus.groovy.bsf.GroovyEngine",
new String[] {"groovy", "gy"});
}

/** Script language */
private String language;



Loading…
Cancel
Save