/** * Adds any source resource. * @since Ant 1.7.1 * @param resource source of script */ public void add(ResourceCollection resource) { helper.add(resource); } }
/** * The script text. * * @param text a component of the script text to be added. */ public void addText(String text) { helper.addText(text); }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return helper.createClasspath(); }
/** * Initialize the script runner. Calls this before running the system */ protected void initScriptRunner() { if (runner != null) { return; } helper.setProjectComponent(this); runner = helper.getScriptRunner(); } /**
if (helper.getLanguage() == null) { throw new BuildException( "scriptdef requires a language attribute to specify the script language"); if (helper.getSrc() == null && helper.getEncoding() != null) { throw new BuildException( "scriptdef requires a src attribute if the encoding is set"); helper.setClassLoader(createLoader());
/** * Initialize on demand. * * @throws BuildException * if something goes wrong */ private void init() throws BuildException { if (runner != null) { return; } runner = helper.getScriptRunner(); }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return getClassPathDelegate().createClasspath(); }
/** * Get a script runner. */ private ScriptRunnerBase getRunner() { return new ScriptRunnerCreator(projectComponent.getProject()).createRunner( manager, language, generateClassLoader()); }
/** * Create and set text on a script. * @return the created or reused script runner. */ public ScriptRunnerBase getScriptRunner() { ScriptRunnerBase runner = getRunner(); runner.setCompiled(compiled); if (encoding != null) { // set it first, because runner.setSrc() loads immediately the file runner.setEncoding(encoding); } if (srcFile != null) { runner.setSrc(srcFile); } if (text != null) { runner.addText(text); } if (resources != null) { runner.loadResources(resources); } if (setBeans) { runner.bindToComponent(projectComponent); } else { runner.bindToComponentMinimum(projectComponent); } return runner; }
/** * Initialize. * * @exception BuildException if something goes wrong */ private void init() throws BuildException { if (runner != null) { return; } runner = helper.getScriptRunner(); }
/** * Set the classpath to be used when searching for classes and resources. * * @param classpath an Ant Path object containing the search path. */ public void setClasspath(Path classpath) { getClassPathDelegate().setClasspath(classpath); }
/** * Set the script text. * * @param text a component of the script text to be added. */ public void addText(String text) { helper.addText(text); }
/** * Run the script using the helper object. * * @exception BuildException if something goes wrong with the build */ public void execute() throws BuildException { helper.getScriptRunner().executeScript("ANT"); }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return helper.createClasspath(); }
/** * Set the classpath by reference. * * @param r a Reference to a Path instance to be used as the classpath * value. */ public void setClasspathRef(Reference r) { getClassPathDelegate().setClasspathref(r); }
/** * The script text. * * @param text a component of the script text to be added. */ public void addText(String text) { helper.addText(text); }
/** * Executes the script. * This is called by the script instance to execute the script for this * definition. * * @param attributes collection of attributes * @param elements a list of nested element values. * @param instance the script instance; can be null */ public void executeScript(Map<String, String> attributes, Map<String, List<Object>> elements, ScriptDefBase instance) { ScriptRunnerBase runner = helper.getScriptRunner(); runner.addBean("attributes", attributes); runner.addBean("elements", elements); runner.addBean("project", getProject()); if (instance != null) { runner.addBean("self", instance); } runner.executeScript("scriptdef_" + name); }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return helper.createClasspath(); }
/** * The script text. * * @param text a component of the script text to be added. */ public void addText(String text) { helper.addText(text); }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return helper.createClasspath(); }