⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subant.java

📁 Use the links below to download a source distribution of Ant from one of our mirrors. It is good pra
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        } finally {            ant = null;        }    }    /**     * This method builds the file name to use in conjunction with directories.     *     * <p>Defaults to "build.xml".     * If <code>genericantfile</code> is set, this attribute is ignored.</p>     *     * @param  antfile the short build file name. Defaults to "build.xml".     */    public void setAntfile(String antfile) {        this.antfile = antfile;    }    /**     * This method builds a file path to use in conjunction with directories.     *     * <p>Use <code>genericantfile</code>, in order to run the same build file     * with different basedirs.</p>     * If this attribute is set, <code>antfile</code> is ignored.     *     * @param afile (path of the generic ant file, absolute or relative to     *               project base directory)     * */    public void setGenericAntfile(File afile) {        this.genericantfile = afile;    }    /**     * Sets whether to fail with a build exception on error, or go on.     *     * @param  failOnError the new value for this boolean flag.     */    public void setFailonerror(boolean failOnError) {        this.failOnError = failOnError;    }    /**     * The target to call on the different sub-builds. Set to "" to execute     * the default target.     * @param target the target     * <p>     */    //     REVISIT: Defaults to the target name that contains this task if not specified.    public void setTarget(String target) {        this.subTarget = target;    }    /**     * Add a target to this Ant invocation.     * @param t the <code>TargetElement</code> to add.     * @since Ant 1.7     */    public void addConfiguredTarget(TargetElement t) {        String name = t.getName();        if ("".equals(name)) {            throw new BuildException("target name must not be empty");        }        targets.add(t);    }    /**     * Enable/ disable verbose log messages showing when each sub-build path is entered/ exited.     * The default value is "false".     * @param on true to enable verbose mode, false otherwise (default).     */    public void setVerbose(boolean on) {        this.verbose = on;    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * <code>output</code> attribute.     *     * @param  s the filename to write the output to.     */    public void setOutput(String s) {        this.output = s;    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * <code>inheritall</code> attribute.     *     * @param  b the new value for this boolean flag.     */    public void setInheritall(boolean b) {        this.inheritAll = b;    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * <code>inheritrefs</code> attribute.     *     * @param  b the new value for this boolean flag.     */    public void setInheritrefs(boolean b) {        this.inheritRefs = b;    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * nested <code>&lt;property&gt;</code> element.     *     * @param  p the property to pass on explicitly to the sub-build.     */    public void addProperty(Property p) {        properties.addElement(p);    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * nested <code>&lt;reference&gt;</code> element.     *     * @param  r the reference to pass on explicitly to the sub-build.     */    public void addReference(Ant.Reference r) {        references.addElement(r);    }    /**     * Corresponds to <code>&lt;ant&gt;</code>'s     * nested <code>&lt;propertyset&gt;</code> element.     * @param ps the propertset     */    public void addPropertyset(PropertySet ps) {        propertySets.addElement(ps);    }    /**     * Adds a directory set to the implicit build path.     * <p>     * <em>Note that the directories will be added to the build path     * in no particular order, so if order is significant, one should     * use a file list instead!</em>     *     * @param  set the directory set to add.     */    public void addDirset(DirSet set) {        add(set);    }    /**     * Adds a file set to the implicit build path.     * <p>     * <em>Note that the directories will be added to the build path     * in no particular order, so if order is significant, one should     * use a file list instead!</em>     *     * @param  set the file set to add.     */    public void addFileset(FileSet set) {        add(set);    }    /**     * Adds an ordered file list to the implicit build path.     * <p>     * <em>Note that contrary to file and directory sets, file lists     * can reference non-existent files or directories!</em>     *     * @param  list the file list to add.     */    public void addFilelist(FileList list) {        add(list);    }    /**     * Adds a resource collection to the implicit build path.     *     * @param  rc the resource collection to add.     * @since Ant 1.7     */    public void add(ResourceCollection rc) {        getBuildpath().add(rc);    }    /**     * Set the buildpath to be used to find sub-projects.     *     * @param  s an Ant Path object containing the buildpath.     */    public void setBuildpath(Path s) {        getBuildpath().append(s);    }    /**     * Creates a nested build path, and add it to the implicit build path.     *     * @return the newly created nested build path.     */    public Path createBuildpath() {        return getBuildpath().createPath();    }    /**     * Creates a nested <code>&lt;buildpathelement&gt;</code>,     * and add it to the implicit build path.     *     * @return the newly created nested build path element.     */    public Path.PathElement createBuildpathElement() {        return getBuildpath().createPathElement();    }    /**     * Gets the implicit build path, creating it if <code>null</code>.     *     * @return the implicit build path.     */    private Path getBuildpath() {        if (buildpath == null) {            buildpath = new Path(getProject());        }        return buildpath;    }    /**     * Buildpath to use, by reference.     *     * @param  r a reference to an Ant Path object containing the buildpath.     */    public void setBuildpathRef(Reference r) {        createBuildpath().setRefid(r);    }    /**     * Creates the &lt;ant&gt; task configured to run a specific target.     *     * @param directory : if not null the directory where the build should run     *     * @return the ant task, configured with the explicit properties and     *         references necessary to run the sub-build.     */    private Ant createAntTask(File directory) {        Ant antTask = new Ant(this);        antTask.init();        if (subTarget != null && subTarget.length() > 0) {            antTask.setTarget(subTarget);        }        if (output != null) {            antTask.setOutput(output);        }        if (directory != null) {            antTask.setDir(directory);        }        antTask.setInheritAll(inheritAll);        for (Enumeration i = properties.elements(); i.hasMoreElements();) {            copyProperty(antTask.createProperty(), (Property) i.nextElement());        }        for (Enumeration i = propertySets.elements(); i.hasMoreElements();) {            antTask.addPropertyset((PropertySet) i.nextElement());        }        antTask.setInheritRefs(inheritRefs);        for (Enumeration i = references.elements(); i.hasMoreElements();) {            antTask.addReference((Ant.Reference) i.nextElement());        }        return antTask;    }    /**     * Assigns an Ant property to another.     *     * @param  to the destination property whose content is modified.     * @param  from the source property whose content is copied.     */    private static void copyProperty(Property to, Property from) {        to.setName(from.getName());        if (from.getValue() != null) {            to.setValue(from.getValue());        }        if (from.getFile() != null) {            to.setFile(from.getFile());        }        if (from.getResource() != null) {            to.setResource(from.getResource());        }        if (from.getPrefix() != null) {            to.setPrefix(from.getPrefix());        }        if (from.getRefid() != null) {            to.setRefid(from.getRefid());        }        if (from.getEnvironment() != null) {            to.setEnvironment(from.getEnvironment());        }        if (from.getClasspath() != null) {            to.setClasspath(from.getClasspath());        }    }} // END class SubAnt

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -