]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / ProcessorDef.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/ProcessorDef.java
new file mode 100644 (file)
index 0000000..38faf42
--- /dev/null
@@ -0,0 +1,714 @@
+/*\r
+ * \r
+ * Copyright 2002-2004 The Ant-Contrib project\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks;\r
+import java.io.BufferedReader;\r
+import java.io.File;\r
+import java.io.FileReader;\r
+import java.io.IOException;\r
+import java.lang.reflect.Method;\r
+import java.util.Vector;\r
+import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
+import net.sf.antcontrib.cpptasks.compiler.Processor;\r
+import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;\r
+import net.sf.antcontrib.cpptasks.types.CommandLineArgument;\r
+import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.DirectoryScanner;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.types.DataType;\r
+import org.apache.tools.ant.types.Environment;\r
+import org.apache.tools.ant.types.Reference;\r
+/**\r
+ * An abstract compiler/linker definition.\r
+ * \r
+ * @author Curt Arnold\r
+ */\r
+public abstract class ProcessorDef extends DataType {\r
+    /**\r
+     * Returns the equivalent Boolean object for the specified value\r
+     * \r
+     * Equivalent to Boolean.valueOf in JDK 1.4\r
+     * \r
+     * @param val\r
+     *            boolean value\r
+     * @return Boolean.TRUE or Boolean.FALSE\r
+     */\r
+    protected static Boolean booleanValueOf(boolean val) {\r
+        if (val) {\r
+            return Boolean.TRUE;\r
+        }\r
+        return Boolean.FALSE;\r
+    }\r
+    /**\r
+     * if true, targets will be built for debugging\r
+     */\r
+    private Boolean debug;\r
+    private Environment env = null;\r
+    /**\r
+     * Reference for "extends" processor definition\r
+     */\r
+    private Reference extendsRef = null;\r
+    /**\r
+     * Name of property that must be present or definition will be ignored. May\r
+     * be null.\r
+     */\r
+    private String ifProp;\r
+    /**\r
+     * if true, processor definition inherits values from containing <cc>\r
+     * element\r
+     */\r
+    private boolean inherit;\r
+    private Boolean libtool = null;\r
+    protected boolean newEnvironment = false;\r
+    /**\r
+     * Processor.\r
+     */\r
+    private Processor processor;\r
+    /**\r
+     * Collection of <compilerarg>or <linkerarg>contained by definition\r
+     */\r
+    private final Vector processorArgs = new Vector();\r
+    /**\r
+     * Collection of <compilerparam>or <linkerparam>contained by definition\r
+     */\r
+    private final Vector processorParams = new Vector();\r
+    /**\r
+     * if true, all targets will be unconditionally rebuilt\r
+     */\r
+    private Boolean rebuild;\r
+    /**\r
+     * Collection of <fileset>contained by definition\r
+     */\r
+    private final Vector srcSets = new Vector();\r
+    /**\r
+     * Name of property that if present will cause definition to be ignored.\r
+     * May be null.\r
+     */\r
+    private String unlessProp;\r
+    /**\r
+     * Constructor\r
+     *  \r
+     */\r
+    protected ProcessorDef() throws NullPointerException {\r
+        inherit = true;\r
+    }\r
+    /**\r
+     * Adds a <compilerarg>or <linkerarg>\r
+     * \r
+     * @param arg\r
+     *            command line argument, must not be null\r
+     * @throws NullPointerException\r
+     *             if arg is null\r
+     * @throws BuildException\r
+     *             if this definition is a reference\r
+     */\r
+    protected void addConfiguredProcessorArg(CommandLineArgument arg)\r
+            throws NullPointerException, BuildException {\r
+        if (arg == null) {\r
+            throw new NullPointerException("arg");\r
+        }\r
+        if (isReference()) {\r
+            throw noChildrenAllowed();\r
+        }\r
+        if(arg.getFile() == null ) {\r
+            processorArgs.addElement(arg);\r
+        }\r
+        else {\r
+            loadFile(arg.getFile());\r
+        }\r
+    }\r
+    /**\r
+     * Add a <compilerarg>or <linkerarg> if specify the file attribute\r
+     * \r
+     * @param arg\r
+     *            command line argument, must not be null\r
+     * @throws BuildException\r
+     *             if the specify file not exist\r
+     */\r
+    protected void loadFile(File file)\r
+        throws BuildException {\r
+        FileReader fileReader;\r
+        BufferedReader in;\r
+        String str;\r
+        if (! file.exists()){\r
+            throw new BuildException("The file " + file + " is not existed");\r
+        }\r
+        try {\r
+            fileReader = new FileReader(file);\r
+            in = new BufferedReader(fileReader);\r
+            while ( (str = in.readLine()) != null ){                \r
+                if(str.trim() == ""){\r
+                    continue ;\r
+                }\r
+                str = getProject().replaceProperties(str);\r
+                CommandLineArgument newarg = new CommandLineArgument();\r
+                newarg.setValue(str.trim());\r
+                processorArgs.addElement(newarg);\r
+            }\r
+        }\r
+        catch(Exception e){\r
+            throw new BuildException(e.getMessage());\r
+        }\r
+    }\r
+    /**\r
+     * Adds a <compilerarg>or <linkerarg>\r
+     * \r
+     * @param arg\r
+     *            command line argument, must not be null\r
+     * @throws NullPointerException\r
+     *             if arg is null\r
+     * @throws BuildException\r
+     *             if this definition is a reference\r
+     */\r
+    protected void addConfiguredProcessorParam(ProcessorParam param)\r
+            throws NullPointerException, BuildException {\r
+        if (param == null) {\r
+            throw new NullPointerException("param");\r
+        }\r
+        if (isReference()) {\r
+            throw noChildrenAllowed();\r
+        }\r
+        processorParams.addElement(param);\r
+    }\r
+    /**\r
+     * Add an environment variable to the launched process.\r
+     */\r
+    public void addEnv(Environment.Variable var) {\r
+        if (env == null) {\r
+            env = new Environment();\r
+        }\r
+        env.addVariable(var);\r
+    }\r
+    /**\r
+     * Adds a source file set.\r
+     * \r
+     * Files in these set will be processed by this configuration and will not\r
+     * participate in the auction.\r
+     * \r
+     * @param srcSet\r
+     *            Fileset identifying files that should be processed by this\r
+     *            processor\r
+     * @throws BuildException\r
+     *             if processor definition is a reference\r
+     */\r
+    public void addFileset(ConditionalFileSet srcSet) throws BuildException {\r
+        if (isReference()) {\r
+            throw noChildrenAllowed();\r
+        }\r
+        srcSet.setProject(getProject());\r
+        srcSets.addElement(srcSet);\r
+    }\r
+    /**\r
+     * Creates a configuration\r
+     * \r
+     * @param baseDef\r
+     *            reference to def from containing <cc>element, may be null\r
+     * @return configuration\r
+     *  \r
+     */\r
+    public ProcessorConfiguration createConfiguration(CCTask task,\r
+            LinkType linkType, ProcessorDef baseDef, TargetDef targetPlatform) {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).createConfiguration(task, linkType,\r
+                    baseDef, targetPlatform);\r
+        }\r
+        ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);\r
+        Processor proc = getProcessor();\r
+        return proc.createConfiguration(task, linkType, defaultProviders, this, targetPlatform);\r
+    }\r
+    /**\r
+     * Prepares list of processor arguments ( <compilerarg>, <linkerarg>) that\r
+     * are active for the current project settings.\r
+     * \r
+     * @return active compiler arguments\r
+     */\r
+    public CommandLineArgument[] getActiveProcessorArgs() {\r
+       Project p = getProject();\r
+        if (p == null) {\r
+            throw new java.lang.IllegalStateException("project must be set");\r
+        }\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getActiveProcessorArgs();\r
+        }\r
+        Vector activeArgs = new Vector(processorArgs.size());\r
+        for (int i = 0; i < processorArgs.size(); i++) {\r
+            CommandLineArgument arg = (CommandLineArgument) processorArgs\r
+                    .elementAt(i);\r
+            if (arg.isActive(p)) {\r
+                activeArgs.addElement(arg);\r
+            }\r
+        }\r
+        CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()];\r
+        activeArgs.copyInto(array);\r
+        return array;\r
+    }\r
+    /**\r
+     * Prepares list of processor arguments ( <compilerarg>, <linkerarg>) that\r
+     * are active for the current project settings.\r
+     * \r
+     * @return active compiler arguments\r
+     */\r
+    public ProcessorParam[] getActiveProcessorParams() {\r
+       Project p = getProject();\r
+        if (p == null) {\r
+            throw new java.lang.IllegalStateException("project must be set");\r
+        }\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getActiveProcessorParams();\r
+        }\r
+        Vector activeParams = new Vector(processorParams.size());\r
+        for (int i = 0; i < processorParams.size(); i++) {\r
+            ProcessorParam param = (ProcessorParam) processorParams\r
+                    .elementAt(i);\r
+            if (param.isActive(p)) {\r
+                activeParams.addElement(param);\r
+            }\r
+        }\r
+        ProcessorParam[] array = new ProcessorParam[activeParams.size()];\r
+        activeParams.copyInto(array);\r
+        return array;\r
+    }\r
+    /**\r
+     * Gets boolean indicating debug build\r
+     * \r
+     * @param defaultProviders\r
+     *            array of ProcessorDef's in descending priority\r
+     * @param index\r
+     *            index to first element in array that should be considered\r
+     * @return if true, built targets for debugging\r
+     */\r
+    public boolean getDebug(ProcessorDef[] defaultProviders, int index) {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getDebug(defaultProviders, index);\r
+        }\r
+        if (debug != null) {\r
+            return debug.booleanValue();\r
+        } else {\r
+            if (defaultProviders != null && index < defaultProviders.length) {\r
+                return defaultProviders[index].getDebug(defaultProviders,\r
+                        index + 1);\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    /**\r
+     * Creates an chain of objects which provide default values in descending\r
+     * order of significance.\r
+     * \r
+     * @param baseDef\r
+     *            corresponding ProcessorDef from CCTask, will be last element\r
+     *            in array unless inherit = false\r
+     * @return default provider array\r
+     *  \r
+     */\r
+    protected final ProcessorDef[] getDefaultProviders(ProcessorDef baseDef) {\r
+        ProcessorDef extendsDef = getExtends();\r
+        Vector chain = new Vector();\r
+        while (extendsDef != null && !chain.contains(extendsDef)) {\r
+            chain.addElement(extendsDef);\r
+            extendsDef = extendsDef.getExtends();\r
+        }\r
+        if (baseDef != null && getInherit()) {\r
+            chain.addElement(baseDef);\r
+        }\r
+        ProcessorDef[] defaultProviders = new ProcessorDef[chain.size()];\r
+        chain.copyInto(defaultProviders);\r
+        return defaultProviders;\r
+    }\r
+    /**\r
+     * Gets the ProcessorDef specified by the extends attribute\r
+     * \r
+     * @return Base ProcessorDef, null if extends is not specified\r
+     * @throws BuildException\r
+     *             if reference is not same type object\r
+     */\r
+    public ProcessorDef getExtends() throws BuildException {\r
+        if (extendsRef != null) {\r
+            Object obj = extendsRef.getReferencedObject(getProject());\r
+            if (!getClass().isInstance(obj)) {\r
+                throw new BuildException("Referenced object "\r
+                        + extendsRef.getRefId() + " not correct type, is "\r
+                        + obj.getClass().getName() + " should be "\r
+                        + getClass().getName());\r
+            }\r
+            return (ProcessorDef) obj;\r
+        }\r
+        return null;\r
+    }\r
+    /**\r
+     * Gets the inherit attribute. If the inherit value is true, this processor\r
+     * definition will inherit default values from the containing <cc>element.\r
+     * \r
+     * @return if true then properties from the containing <cc>element are\r
+     *         used.\r
+     */\r
+    public final boolean getInherit() {\r
+        return inherit;\r
+    }\r
+    public boolean getLibtool() {\r
+        if (libtool != null) {\r
+            return libtool.booleanValue();\r
+        }\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getLibtool();\r
+        }\r
+        ProcessorDef extendsDef = getExtends();\r
+        if (extendsDef != null) {\r
+            return extendsDef.getLibtool();\r
+        }\r
+        return false;\r
+    }\r
+    /**\r
+     * Obtains the appropriate processor (compiler, linker)\r
+     * \r
+     * @return processor\r
+     */\r
+    protected Processor getProcessor() {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getProcessor();\r
+        }\r
+        //\r
+        //   if a processor has not been explicitly set\r
+        //      then may be set by an extended definition\r
+        if (processor == null) {\r
+            ProcessorDef extendsDef = getExtends();\r
+            if (extendsDef != null) {\r
+                return extendsDef.getProcessor();\r
+            }\r
+        }\r
+        return processor;\r
+    }\r
+    /**\r
+     * Gets a boolean value indicating whether all targets must be rebuilt\r
+     * regardless of dependency analysis.\r
+     * \r
+     * @param defaultProviders\r
+     *            array of ProcessorDef's in descending priority\r
+     * @param index\r
+     *            index to first element in array that should be considered\r
+     * @return true if all targets should be rebuilt.\r
+     */\r
+    public boolean getRebuild(ProcessorDef[] defaultProviders, int index) {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getRebuild(defaultProviders, index);\r
+        }\r
+        if (rebuild != null) {\r
+            return rebuild.booleanValue();\r
+        } else {\r
+            if (defaultProviders != null && index < defaultProviders.length) {\r
+                return defaultProviders[index].getRebuild(defaultProviders,\r
+                        index + 1);\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    /**\r
+     * Returns true if the processor definition contains embedded file set\r
+     * definitions\r
+     * \r
+     * @return true if processor definition contains embedded filesets\r
+     */\r
+    public boolean hasFileSets() {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).hasFileSets();\r
+        }\r
+        return srcSets.size() > 0;\r
+    }\r
+    /**\r
+     * Determine if this def should be used.\r
+     * \r
+     * Definition will be active if the "if" variable (if specified) is set and\r
+     * the "unless" variable (if specified) is not set and that all reference\r
+     * or extended definitions are active\r
+     * \r
+     * @return true if processor is active\r
+     * @throws IllegalStateException\r
+     *             if not properly initialized\r
+     * @throws BuildException\r
+     *             if "if" or "unless" variable contains suspicious values\r
+     *             "false" or "no" which indicates possible confusion\r
+     */\r
+    public boolean isActive() throws BuildException, IllegalStateException {\r
+        Project project = getProject();\r
+        if (!CUtil.isActive(project, ifProp, unlessProp)) {\r
+            return false;\r
+        }\r
+        if (isReference()) {\r
+            if (!((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).isActive()) {\r
+                return false;\r
+            }\r
+        }\r
+        //\r
+        //  walk through any extended definitions\r
+        //\r
+        ProcessorDef[] defaultProviders = getDefaultProviders(null);\r
+        for (int i = 0; i < defaultProviders.length; i++) {\r
+            if (!defaultProviders[i].isActive()) {\r
+                return false;\r
+            }\r
+        }\r
+        return true;\r
+    }\r
+    /**\r
+     * Sets the class name for the adapter. Use the "name" attribute when the\r
+     * tool is supported.\r
+     * \r
+     * @param className\r
+     *            full class name\r
+     *  \r
+     */\r
+    public void setClassname(String className) throws BuildException {\r
+        Object proc = null;\r
+        try {\r
+            Class implClass = ProcessorDef.class.getClassLoader().loadClass(\r
+                    className);\r
+            try {\r
+                Method getInstance = implClass.getMethod("getInstance",\r
+                        new Class[0]);\r
+                proc = getInstance.invoke(null, new Object[0]);\r
+            } catch (Exception ex) {\r
+                proc = implClass.newInstance();\r
+            }\r
+        } catch (Exception ex) {\r
+            throw new BuildException(ex);\r
+        }\r
+        setProcessor((Processor) proc);\r
+    }\r
+    /**\r
+     * If set true, all targets will be built for debugging.\r
+     * \r
+     * @param debug\r
+     *            true if targets should be built for debugging\r
+     * @throws BuildException\r
+     *             if processor definition is a reference\r
+     */\r
+    public void setDebug(boolean debug) throws BuildException {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        this.debug = booleanValueOf(debug);\r
+    }\r
+    /**\r
+     * Sets a description of the current data type.\r
+     */\r
+    public void setDescription(String desc) {\r
+        super.setDescription(desc);\r
+    }\r
+    /**\r
+     * Specifies that this element extends the element with id attribute with a\r
+     * matching value. The configuration will be constructed from the settings\r
+     * of this element, element referenced by extends, and the containing cc\r
+     * element.\r
+     * \r
+     * @param extendsRef\r
+     *            Reference to the extended processor definition.\r
+     * @throws BuildException\r
+     *             if this processor definition is a reference\r
+     */\r
+    public void setExtends(Reference extendsRef) throws BuildException {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        this.extendsRef = extendsRef;\r
+    }\r
+    /**\r
+     * Sets an id that can be used to reference this element.\r
+     * \r
+     * @param id\r
+     *            id\r
+     */\r
+    public void setId(String id) {\r
+        //\r
+        //  this is actually accomplished by a different\r
+        //     mechanism, but we can document it\r
+        //\r
+    }\r
+    /**\r
+     * Sets the property name for the 'if' condition.\r
+     * \r
+     * The configuration will be ignored unless the property is defined.\r
+     * \r
+     * The value of the property is insignificant, but values that would imply\r
+     * misinterpretation ("false", "no") will throw an exception when\r
+     * evaluated.\r
+     * \r
+     * @param propName\r
+     *            name of property\r
+     */\r
+    public void setIf(String propName) {\r
+        ifProp = propName;\r
+    }\r
+    /**\r
+     * If inherit has the default value of true, defines, includes and other\r
+     * settings from the containing <cc>element will be inherited.\r
+     * \r
+     * @param inherit\r
+     *            new value\r
+     * @throws BuildException\r
+     *             if processor definition is a reference\r
+     */\r
+    public void setInherit(boolean inherit) throws BuildException {\r
+        if (isReference()) {\r
+            throw super.tooManyAttributes();\r
+        }\r
+        this.inherit = inherit;\r
+    }\r
+    /**\r
+     * Set use of libtool.\r
+     * \r
+     * If set to true, the "libtool " will be prepended to the command line\r
+     * \r
+     * @param libtool\r
+     *            If true, use libtool.\r
+     */\r
+    public void setLibtool(boolean libtool) {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        this.libtool = booleanValueOf(libtool);\r
+    }\r
+    /**\r
+     * Do not propagate old environment when new environment variables are\r
+     * specified.\r
+     */\r
+    public void setNewenvironment(boolean newenv) {\r
+        newEnvironment = newenv;\r
+    }\r
+    /**\r
+     * Sets the processor\r
+     * \r
+     * @param processor\r
+     *            processor, may not be null.\r
+     * @throws BuildException\r
+     *             if ProcessorDef is a reference\r
+     * @throws NullPointerException\r
+     *             if processor is null\r
+     */\r
+    protected void setProcessor(Processor processor) throws BuildException,\r
+            NullPointerException {\r
+        if (processor == null) {\r
+            throw new NullPointerException("processor");\r
+        }\r
+        if (isReference()) {\r
+            throw super.tooManyAttributes();\r
+        }\r
+        if (env == null && !newEnvironment) {\r
+            this.processor = processor;\r
+        } else {\r
+            this.processor = processor.changeEnvironment(newEnvironment, env);\r
+        }\r
+    }\r
+    /**\r
+     * If set true, all targets will be unconditionally rebuilt.\r
+     * \r
+     * @param rebuild\r
+     *            if true, rebuild all targets.\r
+     * @throws BuildException\r
+     *             if processor definition is a reference\r
+     */\r
+    public void setRebuild(boolean rebuild) throws BuildException {\r
+        if (isReference()) {\r
+            throw tooManyAttributes();\r
+        }\r
+        this.rebuild = booleanValueOf(rebuild);\r
+    }\r
+    /**\r
+     * Specifies that this element should behave as if the content of the\r
+     * element with the matching id attribute was inserted at this location. If\r
+     * specified, no other attributes or child content should be specified,\r
+     * other than "if", "unless" and "description".\r
+     * \r
+     * @param ref\r
+     *            Reference to other element\r
+     *  \r
+     */\r
+    public void setRefid(org.apache.tools.ant.types.Reference ref) {\r
+        super.setRefid(ref);\r
+    }\r
+    /**\r
+     * Set the property name for the 'unless' condition.\r
+     * \r
+     * If named property is set, the configuration will be ignored.\r
+     * \r
+     * The value of the property is insignificant, but values that would imply\r
+     * misinterpretation ("false", "no") of the behavior will throw an\r
+     * exception when evaluated.\r
+     * \r
+     * @param propName\r
+     *            name of property\r
+     */\r
+    public void setUnless(String propName) {\r
+        unlessProp = propName;\r
+    }\r
+    /**\r
+     * This method calls the FileVistor's visit function for every file in the\r
+     * processors definition\r
+     * \r
+     * @param visitor\r
+     *            object whose visit method is called for every file\r
+     */\r
+    public void visitFiles(FileVisitor visitor) {\r
+       Project p = getProject();\r
+        if (p == null) {\r
+            throw new java.lang.IllegalStateException(\r
+                    "project must be set before this call");\r
+        }\r
+        if (isReference()) {\r
+            ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef"))\r
+                    .visitFiles(visitor);\r
+        }\r
+        //\r
+        //   if this processor extends another,\r
+        //      visit its files first\r
+        //\r
+        ProcessorDef extendsDef = getExtends();\r
+        if (extendsDef != null) {\r
+            extendsDef.visitFiles(visitor);\r
+        }\r
+        for (int i = 0; i < srcSets.size(); i++) {\r
+            ConditionalFileSet srcSet = (ConditionalFileSet) srcSets\r
+                    .elementAt(i);\r
+            if (srcSet.isActive()) {\r
+                // Find matching source files\r
+                DirectoryScanner scanner = srcSet.getDirectoryScanner(p);\r
+                // Check each source file - see if it needs compilation\r
+                String[] fileNames = scanner.getIncludedFiles();\r
+                File parentDir = scanner.getBasedir();\r
+                for (int j = 0; j < fileNames.length; j++) {\r
+                    String currentFile = fileNames[j];\r
+                    visitor.visit(parentDir, currentFile);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    public Vector getSrcSets() {\r
+        if (isReference()) {\r
+            return ((ProcessorDef) getCheckedRef(ProcessorDef.class,\r
+                    "ProcessorDef")).getSrcSets();\r
+        }\r
+        return srcSets;\r
+    }\r
+}\r