]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Adjust some code format and clear some unused codes.
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Aug 2006 08:36:45 +0000 (08:36 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Aug 2006 08:36:45 +0000 (08:36 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1273 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
Tools/Source/GenBuild/org/tianocore/build/FileProcess.java
Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
Tools/Source/GenBuild/org/tianocore/build/global/OutputManager.java

index 15f975901b73c2c5d9630e8f5582432bef633e57..bb8ecf33cca435644933c583a6be0ba8a72e178f 100644 (file)
@@ -21,14 +21,12 @@ import javax.xml.namespace.QName;
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Project;\r
 import org.apache.xmlbeans.XmlCursor;\r
-import org.apache.xmlbeans.XmlObject;\r
 import org.tianocore.BuildOptionsDocument;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.SurfaceAreaQuery;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.w3c.dom.Document;\r
 import org.w3c.dom.Element;\r
-import org.w3c.dom.Node;\r
 \r
 /** \r
   <p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>\r
@@ -54,11 +52,6 @@ import org.w3c.dom.Node;
 **/\r
 public class FfsProcess {\r
 \r
-    ///\r
-    /// Xml Document Node for corresponding FFS layout\r
-    ///\r
-    private Node ffs;\r
-    \r
     private BuildOptionsDocument.BuildOptions.Ffs ffsXmlObject;\r
 \r
     ///\r
@@ -133,18 +126,7 @@ public class FfsProcess {
     **/\r
     public boolean initSections(String buildType, Project project, FpdModuleIdentification fpdModuleId) throws BuildException {\r
         //\r
-        // Firstly, try to find in ModuleSA\r
-        //\r
-//        BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getModuleFfs();\r
-//        for (int i = 0; i < ffsArray.length; i++) {\r
-//            if (isMatch(ffsArray[i].getFfsKey(), buildType)) {\r
-//                ffsXmlObject = ffsArray[i];\r
-//                return true;\r
-//            }\r
-//        }\r
-        \r
-        //\r
-        // secondly, try to sections defined in PLATFORM level\r
+        // Try to find Ffs layout from FPD file\r
         //\r
         SurfaceAreaQuery.push(GlobalData.getFpdBuildOptions());\r
         BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getFpdFfs();\r
@@ -162,16 +144,11 @@ public class FfsProcess {
         //\r
         if (buildType == null) {\r
             System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");\r
-            }\r
-        else {\r
+        } else {\r
             throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!");            \r
         }\r
 \r
-        if (ffs == null) {\r
-            return false;\r
-        } else {\r
-            return true;\r
-        }\r
+        return false;\r
     }\r
     \r
     /**\r
@@ -185,43 +162,36 @@ public class FfsProcess {
     **/\r
     public String[] getGenSectionElements(Document document, String basename, String guid, String targetFilename) {\r
         this.basename = basename;\r
-        if (ffs == null && ffsXmlObject == null) {\r
+        if (ffsXmlObject == null) {\r
             return new String[0];\r
         }\r
         Vector<String> sectionList = new Vector<String>();\r
         XmlCursor cursor = null;\r
         try {\r
-            if (ffsXmlObject == null) {\r
-                cursor = XmlObject.Factory.parse(ffs).newCursor();\r
-            }\r
-            else {\r
-                cursor = ffsXmlObject.newCursor();\r
-            }\r
+            cursor = ffsXmlObject.newCursor();\r
         } catch (Exception e) {\r
             return null;\r
         }\r
         int mode = MODE_NONE;\r
-        Element root = document.createElement("genffsfile");\r
-        root.setAttribute("outputDir", "${BIN_DIR}");\r
-        root.setAttribute("moduleType", "${MODULE_TYPE}");\r
-        root.setAttribute("BaseName", basename);\r
-        root.setAttribute("fileGuid", guid);\r
-        if (ffsXmlObject == null) {\r
-            cursor.toFirstChild();\r
-        }\r
+        Element genffsfileEle = document.createElement("genffsfile");\r
+        genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");\r
+        genffsfileEle.setAttribute("moduleType", "${MODULE_TYPE}");\r
+        genffsfileEle.setAttribute("BaseName", basename);\r
+        genffsfileEle.setAttribute("fileGuid", guid);\r
+\r
         if (cursor.toFirstChild()) {\r
             do {\r
                 if (cursor.getName().getLocalPart().equalsIgnoreCase("Attribute")) {\r
                     String name = cursor.getAttributeText(new QName("Name"));\r
                     String value = cursor.getAttributeText(new QName("Value"));\r
-                    root.setAttribute(changeAttributeName(name), value);\r
+                    genffsfileEle.setAttribute(changeAttributeName(name), value);\r
                 } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {\r
                     cursor.push();\r
-                    dealSection(mode, document, root, cursor, sectionList);\r
+                    dealSection(mode, document, genffsfileEle, cursor, sectionList);\r
                     cursor.pop();\r
                 } else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {\r
                     cursor.push();\r
-                    dealSections(mode, document, root, cursor, sectionList);\r
+                    dealSections(mode, document, genffsfileEle, cursor, sectionList);\r
                     cursor.pop();\r
                 }\r
             } while (cursor.toNextSibling());\r
@@ -246,7 +216,7 @@ public class FfsProcess {
         targetEle.appendChild(fileEle);\r
         outofdateEle.appendChild(targetEle);\r
         Element sequentialEle = document.createElement("sequential");\r
-        sequentialEle.appendChild(root);\r
+        sequentialEle.appendChild(genffsfileEle);\r
         outofdateEle.appendChild(sequentialEle);\r
         ffsNode = outofdateEle;\r
         return result;\r
index 32b94d8225fbd63f2756eaa98660106c285d16e9..dcc52094ecc9703a1bb0a679c3119ab3f44351b8 100644 (file)
@@ -156,18 +156,12 @@ public class FileProcess {
       @param root Root node\r
     **/\r
     public synchronized void parseFile(String filename, Node root) throws BuildException {\r
-        boolean flag = false;\r
         for (int i = 0; i < fileTypes.length; i++) {\r
             if (filename.endsWith(fileTypes[i][0])) {\r
-                flag = true;\r
                 parseFile(filename, fileTypes[i][2], root);\r
+                return ;\r
             }\r
         }\r
-        /*\r
-        if (!flag) {\r
-            throw new BuildException("File [" + filename + "] is not known from its suffix.");\r
-        }\r
-        */\r
     }\r
 \r
     /**\r
index 2617f06bdd6961f87bfe1ebbdbb2ceae2c0bda94..d236c5b5bb586df335950045a0554e798e9dfae6 100644 (file)
@@ -113,23 +113,18 @@ public class FrameworkBuildTask extends Task{
         File buildFile = null;\r
         if (msaFiles.size() > 1) {\r
             throw new BuildException("Having more than one MSA file in a directory is not allowed!");\r
-        }\r
-        else if (msaFiles.size() == 1 && activePlatform == null) {\r
+        } else if (msaFiles.size() == 1 && activePlatform == null) {\r
             throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");\r
-        }\r
-        else if (msaFiles.size() == 1 && activePlatform != null) {\r
+        } else if (msaFiles.size() == 1 && activePlatform != null) {\r
             //\r
             // Build the single module\r
             //\r
             buildFile = msaFiles.toArray(new File[1])[0];\r
-        }\r
-        else if (activePlatform != null) {\r
+        } else if (activePlatform != null) {\r
             buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
-        }\r
-        else if (fpdFiles.size() == 1) {\r
+        } else if (fpdFiles.size() == 1) {\r
             buildFile = fpdFiles.toArray(new File[1])[0];\r
-        }\r
-        else if (fpdFiles.size() > 1) {\r
+        } else if (fpdFiles.size() > 1) {\r
             buildFile = intercommuniteWithUser();\r
         }\r
         //\r
@@ -191,20 +186,16 @@ public class FrameworkBuildTask extends Task{
 \r
     private File intercommuniteWithUser(){\r
         File file = null;\r
-        if (fpdFiles.size() + msaFiles.size() > 1) {\r
-            File[] allFiles = new File[fpdFiles.size() + msaFiles.size()];\r
+        if (fpdFiles.size() > 1) {\r
+            File[] allFiles = new File[fpdFiles.size()];\r
             int index = 0;\r
             Iterator<File> iter = fpdFiles.iterator();\r
             while (iter.hasNext()) {\r
                 allFiles[index] = iter.next();\r
                 index++;\r
             }\r
-            iter = msaFiles.iterator();\r
-            while (iter.hasNext()) {\r
-                allFiles[index] = iter.next();\r
-                index++;\r
-            }\r
-            System.out.println("Finding " + allFiles.length + " FPD and MSA files: ");\r
+\r
+            System.out.println("Finding " + allFiles.length + " FPD files: ");\r
             for (int i = 0; i < allFiles.length; i++) {\r
                 System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName());\r
             }\r
@@ -234,13 +225,9 @@ public class FrameworkBuildTask extends Task{
                     flag = true;\r
                 }\r
             } while (flag);\r
-        }\r
-        else if (fpdFiles.size() == 1) {\r
+        } else if (fpdFiles.size() == 1) {\r
             file = fpdFiles.toArray(new File[1])[0];\r
         }\r
-        else if (msaFiles.size() == 1) {\r
-            file = msaFiles.toArray(new File[1])[0];\r
-        }\r
         return file;\r
     }\r
     \r
@@ -248,8 +235,7 @@ public class FrameworkBuildTask extends Task{
     public void setType(String type) {\r
         if (type.equalsIgnoreCase("clean") || type.equalsIgnoreCase("cleanall")) {\r
             this.type = type.toLowerCase();\r
-        }\r
-        else {\r
+        } else {\r
             this.type = "all";\r
         }\r
     }\r
@@ -265,22 +251,19 @@ public class FrameworkBuildTask extends Task{
             String str = getValue("TARGET", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addTargets("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addTargets(str);\r
             }\r
             str = getValue("TOOL_CHAIN_TAG", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addTagnames("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addTagnames(str);\r
             }\r
             str = getValue("TARGET_ARCH", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addArchs("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addArchs(str);\r
             }\r
             GlobalData.setToolChainEnvInfo(envToolChainInfo);\r
index f7deb19e8fc548774408d0a89255f525509544d2..adc419c72a43ac1dcad3ce5f22e26daac3ec235a 100644 (file)
@@ -89,11 +89,8 @@ public class GenBuildTask extends Ant {
     ///\r
     File msaFile;\r
 \r
-    ///\r
-    ///\r
-    ///\r
-    private String type = "all"; // = "build";\r
-\r
+    private String type = "all"; \r
+    \r
     ///\r
     /// Module's Identification.\r
     ///\r
@@ -123,8 +120,7 @@ public class GenBuildTask extends Ant {
         GenBuildLogger logger = new GenBuildLogger(getProject());\r
         EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));\r
         EdkLog.setLogger(logger);\r
-        // remove !!\r
-        try {\r
+\r
         pushProperties();\r
         //\r
         // Enable all specified properties\r
@@ -152,8 +148,7 @@ public class GenBuildTask extends Ant {
             Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);\r
             SurfaceAreaQuery.setDoc(doc);\r
             moduleId = SurfaceAreaQuery.getMsaHeader();\r
-        }\r
-        else {\r
+        } else {\r
             Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);\r
             SurfaceAreaQuery.setDoc(doc);\r
             moduleId = SurfaceAreaQuery.getMsaHeader();\r
@@ -161,8 +156,7 @@ public class GenBuildTask extends Ant {
         String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null);\r
         if (producedLibraryClasses.length == 0) {\r
             moduleId.setLibrary(false);\r
-        }\r
-        else {\r
+        } else {\r
             moduleId.setLibrary(true);\r
         }\r
 \r
@@ -174,8 +168,7 @@ public class GenBuildTask extends Ant {
             // Single Module build\r
             //\r
             prepareSingleModuleBuild();\r
-        }\r
-        else {\r
+        } else {\r
             //\r
             // Platform build. Restore the platform related info\r
             //\r
@@ -191,8 +184,8 @@ public class GenBuildTask extends Ant {
         }\r
 \r
         //\r
-        // If single module : intersection MSA supported ARCHs and tools def!!\r
-        // else, get arch from pass down\r
+        // If single module : get arch from pass down, otherwise intersection MSA \r
+        // supported ARCHs and tools def\r
         //\r
         Set<String> archListSupByToolChain = new LinkedHashSet<String>();\r
         String[] archs = GlobalData.getToolChainInfo().getArchs();\r
@@ -211,9 +204,8 @@ public class GenBuildTask extends Ant {
                     archSet.add(fpdArchList[i]);\r
                 }\r
             }\r
-        }\r
-        else {\r
-            archSet = archListSupByToolChain;\r
+        } else {\r
+            archSet = archListSupByToolChain; \r
         }\r
 \r
         String[] archList = archSet.toArray(new String[archSet.size()]);\r
@@ -296,20 +288,16 @@ public class GenBuildTask extends Ant {
 \r
                     if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {\r
                         applyBuild(targetList[i], toolchainList[j], fpdModuleId);\r
-                    }\r
-                    else if (type.equalsIgnoreCase("clean")) {\r
+                    } else if (type.equalsIgnoreCase("clean")) {\r
                         applyClean(fpdModuleId);\r
-                    }\r
-                    else if (type.equalsIgnoreCase("cleanall")) {\r
+                    } else if (type.equalsIgnoreCase("cleanall")) {\r
                         applyCleanall(fpdModuleId);\r
                     }\r
                 }\r
             }\r
         }\r
+        \r
         popProperties();\r
-        }catch (Exception e){\r
-            throw new BuildException(e.getMessage());\r
-        }\r
     }\r
 \r
     /**\r
@@ -331,7 +319,7 @@ public class GenBuildTask extends Ant {
         moduleId.setPackage(packageId);\r
 \r
         //\r
-        // Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)\r
+        // Read ACTIVE_PLATFORM's FPD file \r
         //\r
         String filename = getProject().getProperty("PLATFORM_FILE");\r
 \r
@@ -342,7 +330,7 @@ public class GenBuildTask extends Ant {
         PlatformIdentification platformId = GlobalData.getPlatform(filename);\r
 \r
         //\r
-        // Read FPD file\r
+        // Read FPD file (Call FpdParserTask's method)\r
         //\r
         FpdParserTask fpdParser = new FpdParserTask();\r
         fpdParser.setProject(getProject());\r
@@ -360,6 +348,8 @@ public class GenBuildTask extends Ant {
 \r
     /**\r
       Set Module-Related information to properties.\r
+      \r
+      @param arch current build ARCH\r
     **/\r
     private void setModuleCommonProperties(String arch) {\r
         //\r
@@ -381,8 +371,7 @@ public class GenBuildTask extends Ant {
         String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();\r
         if (baseName == null) {\r
             getProject().setProperty("BASE_NAME", moduleId.getName());\r
-        }\r
-        else {\r
+        } else {\r
             getProject().setProperty("BASE_NAME", baseName);\r
         }\r
         getProject().setProperty("GUID", moduleId.getGuid());\r
@@ -423,8 +412,7 @@ public class GenBuildTask extends Ant {
         //\r
         if (arch.equalsIgnoreCase("EBC")) {\r
             getProject().setProperty("ENTRYPOINT", "EfiStart");\r
-        }\r
-        else {\r
+        } else {\r
             getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");\r
         }\r
 \r
@@ -462,8 +450,7 @@ public class GenBuildTask extends Ant {
             String extName = GlobalData.getCommandSetting(key, fpdModuleId);\r
             if ( extName != null && ! extName.equalsIgnoreCase("")) {\r
                 getProject().setProperty(cmd[m] + "_EXT", extName);\r
-            }\r
-            else {\r
+            } else {\r
                 getProject().setProperty(cmd[m] + "_EXT", "");\r
             }\r
 \r
@@ -483,8 +470,7 @@ public class GenBuildTask extends Ant {
             String spath = GlobalData.getCommandSetting(key, fpdModuleId);\r
             if (spath != null) {\r
                 getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));\r
-            }\r
-            else {\r
+            } else {\r
                 getProject().setProperty(cmd[m] + "_SPATH", "");\r
             }\r
 \r
@@ -495,8 +481,7 @@ public class GenBuildTask extends Ant {
             String dpath = GlobalData.getCommandSetting(key, fpdModuleId);\r
             if (dpath != null) {\r
                 getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));\r
-            }\r
-            else {\r
+            } else {\r
                 getProject().setProperty(cmd[m] + "_DPATH", "");\r
             }\r
         }\r
@@ -543,7 +528,7 @@ public class GenBuildTask extends Ant {
         this.type = type;\r
     }\r
 \r
-    private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException{\r
+    private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws BuildException{\r
         //\r
         // AutoGen\r
         //\r
@@ -555,8 +540,13 @@ public class GenBuildTask extends Ant {
         //\r
         // Get compiler flags\r
         //\r
-        getCompilerFlags(buildTarget, buildTagname, fpdModuleId);\r
-\r
+        try {\r
+            getCompilerFlags(buildTarget, buildTagname, fpdModuleId);\r
+        }\r
+        catch (EdkException ee) {\r
+            throw new BuildException(ee.getMessage());\r
+        }\r
+        \r
         //\r
         // Prepare LIBS\r
         //\r
@@ -573,12 +563,10 @@ public class GenBuildTask extends Ant {
         //\r
         if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
             GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml");\r
-            Ant ant = new Ant();\r
-            ant.setProject(getProject());\r
-            ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-            ant.setInheritAll(true);\r
-            ant.init();\r
-            ant.execute();\r
+            \r
+            String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+            antCall(antFilename, null);\r
+            \r
             return ;\r
         }\r
 \r
@@ -594,12 +582,8 @@ public class GenBuildTask extends Ant {
         //\r
         // Ant call ${BASE_NAME}_build.xml\r
         //\r
-        Ant ant = new Ant();\r
-        ant.setProject(getProject());\r
-        ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-        ant.setInheritAll(true);\r
-        ant.init();\r
-        ant.execute();\r
+        String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+        antCall(antFilename, null);\r
     }\r
 \r
     private void applyClean(FpdModuleIdentification fpdModuleId){\r
@@ -609,27 +593,15 @@ public class GenBuildTask extends Ant {
         //\r
         if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
             GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
-            Ant ant = new Ant();\r
-            ant.setProject(getProject());\r
-            ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-            ant.setTarget("clean");\r
-            ant.setInheritAll(true);\r
-            ant.init();\r
-            ant.execute();\r
+            \r
+            String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+            antCall(antFilename, "clean");\r
+            \r
             return ;\r
         }\r
 \r
-        Ant ant = new Ant();\r
-        ant.setProject(getProject());\r
-        ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-        ant.setTarget("clean");\r
-        ant.setInheritAll(true);\r
-        ant.init();\r
-        ant.execute();\r
-\r
-        //\r
-        // Delete current module's DEST_DIR_OUTPUT\r
-        // TBD\r
+        String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+        antCall(antFilename, "clean");\r
     }\r
 \r
     private void applyCleanall(FpdModuleIdentification fpdModuleId){\r
@@ -639,32 +611,30 @@ public class GenBuildTask extends Ant {
         //\r
         if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
             GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
-            Ant ant = new Ant();\r
-            ant.setProject(getProject());\r
-            ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-            ant.setTarget("cleanall");\r
-            ant.setInheritAll(true);\r
-            ant.init();\r
-            ant.execute();\r
+\r
+            String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+            antCall(antFilename, "cleanall");\r
+            \r
             return ;\r
         }\r
+        \r
+        String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+        antCall(antFilename, "cleanall");\r
+    }\r
 \r
+    private void antCall(String antFilename, String target) {\r
         Ant ant = new Ant();\r
         ant.setProject(getProject());\r
-        ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
-        ant.setTarget("cleanall");\r
+        ant.setAntfile(antFilename);\r
+        if (target != null) {\r
+            ant.setTarget(target);\r
+        }\r
         ant.setInheritAll(true);\r
         ant.init();\r
         ant.execute();\r
-\r
-        //\r
-        // Delete current module's DEST_DIR_OUTPUT\r
-        // TBD\r
     }\r
 \r
 \r
-\r
-\r
     /**\r
       Separate the string and instore in set.\r
 \r
index 80682b2e4661fb25cb281d93ea9661b6158abe76..6130ee2be4b4197d3766c44d912b66d377a78ccd 100644 (file)
@@ -82,9 +82,6 @@ public class FpdParserTask extends Task {
 \r
     private PlatformIdentification platformId;\r
 \r
-    ///\r
-    ///\r
-    ///\r
     private String type;\r
 \r
     ///\r
@@ -127,7 +124,10 @@ public class FpdParserTask extends Task {
      Surface area is not valid.\r
     **/\r
     public void execute() throws BuildException {\r
-        // Remove !!\r
+        //\r
+        // If fpdFile is not specified, \r
+        // then try to get FPD file by platformName\r
+        //\r
         if ( fpdFile == null) {\r
             if (platformName == null) {\r
                 throw new BuildException("FpdParserTask parameter error. Please specify either the platform name or FPD file!");\r
@@ -150,9 +150,9 @@ public class FpdParserTask extends Task {
         // For every Target and ToolChain\r
         //\r
         String[] targetList = GlobalData.getToolChainInfo().getTargets();\r
-        for (int i = 0; i < targetList.length; i++){\r
+        for (int i = 0; i < targetList.length; i++) {\r
             String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();\r
-            for(int j = 0; j < toolchainList.length; j++){\r
+            for(int j = 0; j < toolchainList.length; j++) {\r
                 //\r
                 // Prepare FV_DIR\r
                 //\r
@@ -187,8 +187,6 @@ public class FpdParserTask extends Task {
         ant.setInheritAll(true);\r
         ant.init();\r
         ant.execute();\r
-\r
-//        GlobalData.log.info("Fpd build end. ");\r
     }\r
 \r
     /**\r
@@ -409,7 +407,6 @@ public class FpdParserTask extends Task {
             //\r
             SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
             String fvBinding = SurfaceAreaQuery.getModuleFvBindingKeyword();\r
-            SurfaceAreaQuery.pop();\r
 \r
             fpdModuleId.setFvBinding(fvBinding);\r
             updateFvs(fvBinding, fpdModuleId);\r
@@ -418,9 +415,9 @@ public class FpdParserTask extends Task {
             // Prepare for out put file name\r
             //\r
             ModuleIdentification moduleId = fpdModuleId.getModule();\r
-            SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
+\r
             String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();\r
-            SurfaceAreaQuery.pop();\r
+            \r
             if (baseName == null) {\r
                 baseName = moduleId.getName();\r
             }\r
@@ -431,7 +428,6 @@ public class FpdParserTask extends Task {
             //\r
             // parse module build options, if any\r
             //\r
-            SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
             GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));\r
             GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));\r
             SurfaceAreaQuery.pop();\r
@@ -496,8 +492,7 @@ public class FpdParserTask extends Task {
             if (fvs.containsKey(fvNameArray[i])) {\r
                 Set<FpdModuleIdentification> set = fvs.get(fvNameArray[i]);\r
                 set.add(fpdModuleId);\r
-            }\r
-            else {\r
+            } else {\r
                 Set<FpdModuleIdentification> set = new LinkedHashSet<FpdModuleIdentification>();\r
                 set.add(fpdModuleId);\r
                 fvs.put(fvNameArray[i], set);\r
@@ -573,6 +568,4 @@ public class FpdParserTask extends Task {
     public void setType(String type) {\r
         this.type = type;\r
     }\r
-\r
-\r
 }\r
index e6a1002da3b711bbd0384b719b07a8e9e07bc680..a20f17bc1626129c6509f83475da1bfaaaeed0fb 100644 (file)
@@ -39,6 +39,11 @@ import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;\r
 import org.w3c.dom.NodeList;\r
 \r
+/**\r
+  class PlatformBuildFileGenerator is used to generate ${PLATFORM}_build.xml file. \r
+\r
+  @since GenBuild 1.0\r
+**/\r
 public class PlatformBuildFileGenerator {\r
 \r
     private String platformName;\r
index 89c85ed8c26d54d28b1eec37975c4bb37321e756..9778eaf8a042104db28a157d0206e85adec4e55a 100644 (file)
@@ -175,7 +175,7 @@ public class GlobalData {
             //\r
             // validate FrameworkDatabaseFile\r
             //\r
-            if (! db.validate()) {\r
+            if (!db.validate()) {\r
                 throw new BuildException("Framework Database file [" + dbFile.getPath() + "] format is invalid!");\r
             }\r
             //\r
@@ -201,14 +201,14 @@ public class GlobalData {
                 while (iter.hasNext()) {\r
                     String fileName = iter.next().getStringValue();\r
                     File fpdFile = new File(workspaceDir + File.separatorChar + fileName);\r
-                    if ( ! fpdFile.exists() ) {\r
+                    if ( !fpdFile.exists() ) {\r
                         throw new BuildException("Platform file [" + fpdFile.getPath() + "] not exists. ");\r
                     }\r
                     XmlObject fpdDoc = XmlObject.Factory.parse(fpdFile);\r
                     //\r
                     // Verify FPD file, if is invalid, throw Exception\r
                     //\r
-                    if (! fpdDoc.validate()) {\r
+                    if (!fpdDoc.validate()) {\r
                         throw new BuildException("Framework Platform Surface Area file [" + fpdFile.getPath() + "] format is invalid!");\r
                     }\r
                     //\r
@@ -259,8 +259,7 @@ public class GlobalData {
         }\r
         if (msaFile == null){\r
             throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");\r
-        }\r
-        else {\r
+        } else {\r
             return msaFile;\r
         }\r
     }\r
@@ -285,8 +284,7 @@ public class GlobalData {
         }\r
         if (packageId == null){\r
             throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");\r
-        }\r
-        else {\r
+        } else {\r
             return packageId;\r
         }\r
     }\r
@@ -320,16 +318,14 @@ public class GlobalData {
     }\r
 \r
     /**\r
-      Query overrided module surface area information. If current is Package\r
-      or Platform build, also include the information from FPD file.\r
+      Query module surface area information.\r
 \r
       <p>Note that surface area parsing is incremental. That means the method will\r
-      only parse the MSA and MBD files if necessary. </p>\r
-\r
-      @param moduleName the base name of the module\r
-      @return the overrided module surface area information\r
-      @throws BuildException\r
-              MSA or MBD is not valid\r
+      only parse the MSA files if necessary. </p>\r
+    \r
+      @param fpdModuleId Module ID with arch\r
+      @return ModuleSA info and MSA info for fpdModuleId\r
+      @throws BuildException Can't find MSA\r
     **/\r
     public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws BuildException {\r
         if (parsedModules.containsKey(fpdModuleId)) {\r
@@ -387,7 +383,7 @@ public class GlobalData {
     }\r
 \r
     public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws BuildException {\r
-        if (! msaFile.exists()) {\r
+        if (!msaFile.exists()) {\r
             throw new BuildException("Module Surface Area file [" + msaFile.getPath() + "] can't be found!");\r
         }\r
         try {\r
@@ -395,7 +391,7 @@ public class GlobalData {
             //\r
             // Validate File if they accord with XML Schema\r
             //\r
-            if ( ! doc.validate()){\r
+            if ( !doc.validate()){\r
                 throw new BuildException("Module Surface Area file [" + msaFile.getPath() + "] format is invalid!");\r
             }\r
             //\r
@@ -438,16 +434,12 @@ public class GlobalData {
         GlobalData.fpdDynamicPcds = fpdDynamicPcds;\r
     }\r
 \r
-    //////////////////////////////////////////////\r
-    //////////////////////////////////////////////\r
-\r
     public static Set<ModuleIdentification> getModules(PackageIdentification packageId){\r
         Spd spd = spdTable.get(packageId);\r
         if (spd == null ) {\r
             Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();\r
             return dummy;\r
-        }\r
-        else {\r
+        } else {\r
             return spd.getModules();\r
         }\r
     }\r
@@ -611,10 +603,7 @@ public class GlobalData {
     }\r
 \r
     public synchronized static ModuleIdentification refreshModuleIdentification(ModuleIdentification moduleId) throws BuildException {\r
-//        System.out.println("1");\r
-//        System.out.println("##" + moduleId.getGuid());\r
         PackageIdentification packageId = getPackageForModule(moduleId);\r
-//        System.out.println("" + packageId.getGuid());\r
         moduleId.setPackage(packageId);\r
         Spd spd = spdTable.get(packageId);\r
         if (spd == null) {\r
@@ -637,7 +626,16 @@ public class GlobalData {
     public synchronized static Set<PackageIdentification> getPackageList(){\r
         return packageList;\r
     }\r
-    ///// remove!!\r
+\r
+    /**\r
+      BUGBUG: It is a walk around method. If do not clone, can't query info with\r
+      XPath correctly. \r
+      \r
+      @param object XmlObject\r
+      @param deep flag for deep clone\r
+      @return XmlObject after clone\r
+      @throws BuildException parse original XmlObject error. \r
+    **/\r
     private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws BuildException {\r
         if ( object == null) {\r
             return null;\r
index 773fe3e94922b395e06c1fade0e6712af65704b7..3c146f0246b6f50c867b29d4016ddce03f75824f 100644 (file)
@@ -86,7 +86,6 @@ public class OutputManager {
       @param type the module build type (MODULE or UNIFIED)\r
     **/\r
     public void update(Project project) {\r
-//        GlobalData.log.info("" + userdir + ":" + type);\r
         //\r
         // Default mode is UNIFIED. \r
         //\r
@@ -183,6 +182,7 @@ public class OutputManager {
                 buildDir = GlobalData.getWorkspacePath() + File.separatorChar + userdir;\r
             }\r
         }\r
+        \r
         //\r
         // Set to property\r
         //\r