]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
1, Make exception string friendly, readable.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / fpd / FpdParserTask.java
index b61ad065f137e6b6b5fd1cf6f293f0b2d173ce58..23be3307e15294e1a729d4c56891436aa411eabd 100644 (file)
@@ -25,7 +25,6 @@ import java.util.LinkedHashSet;
 import java.util.Map;\r
 import java.util.Set;\r
 import java.util.Vector;\r
-import java.util.TreeMap;\r
 \r
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.Task;\r
@@ -39,9 +38,8 @@ import org.tianocore.build.global.SurfaceAreaQuery;
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.tianocore.build.id.ModuleIdentification;\r
 import org.tianocore.build.id.PlatformIdentification;\r
-import org.tianocore.build.pcd.action.ActionMessage;\r
-import org.tianocore.build.pcd.action.CollectPCDAction;\r
-import org.tianocore.build.pcd.exception.EntityException;\r
+import org.tianocore.pcd.action.ActionMessage;\r
+import org.tianocore.build.pcd.action.PlatformPcdPreprocessActionForBuilding;\r
 import org.tianocore.build.toolchain.ToolChainAttribute;\r
 import org.tianocore.build.toolchain.ToolChainElement;\r
 import org.tianocore.build.toolchain.ToolChainMap;\r
@@ -99,11 +97,6 @@ public class FpdParserTask extends Task {
     ///\r
     private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();\r
 \r
-    ///\r
-    /// Mapping from sequence number to FV names\r
-    ///\r
-    private Map<String, Set<String>> sequences = new TreeMap<String, Set<String>>();\r
-\r
     ///\r
     /// FpdParserTask can specify some ANT properties. \r
     ///\r
@@ -153,10 +146,6 @@ public class FpdParserTask extends Task {
         //\r
         isUnified = OutputManager.getInstance().prepareBuildDir(getProject());\r
         \r
-        //\r
-        // Generate FDF (Flash Definition File) file\r
-        //\r
-\r
         //\r
         // For every Target and ToolChain\r
         //\r
@@ -184,7 +173,7 @@ public class FpdParserTask extends Task {
         //\r
         // Gen build.xml\r
         //\r
-        PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, sequences, isUnified);\r
+        PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, isUnified);\r
         fileGenerator.genBuildFile();\r
         \r
         //\r
@@ -221,9 +210,9 @@ public class FpdParserTask extends Task {
                 getProject().setProperty(globalVariables[j][0], globalVariables[j][1]);\r
             }\r
 \r
-            getProject().setProperty("FV_FILENAME", validFv[i].toUpperCase());\r
+            getProject().setProperty("FV_FILENAME", validFv[i]);\r
             \r
-            File fvFile = new File(getProject().replaceProperties( getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i].toUpperCase() + ".inf"));\r
+            File fvFile = new File(getProject().replaceProperties( getProject().getProperty("FV_DIR") + File.separatorChar + validFv[i] + ".inf"));\r
             fvFile.getParentFile().mkdirs();\r
 \r
             try {\r
@@ -296,7 +285,7 @@ public class FpdParserTask extends Task {
                 //\r
                 // Files\r
                 //\r
-                Set<FpdModuleIdentification> filesSet = fvs.get(validFv[i].toUpperCase());\r
+                Set<FpdModuleIdentification> filesSet = fvs.get(validFv[i]);\r
                 if (filesSet != null) {\r
                     FpdModuleIdentification[] files = filesSet.toArray(new FpdModuleIdentification[filesSet.size()]);\r
                     bw.write("[files]");\r
@@ -311,7 +300,6 @@ public class FpdParserTask extends Task {
                 bw.close();\r
                 fw.close();\r
             } catch (Exception e) {\r
-                e.printStackTrace();\r
                 throw new BuildException("Generate FV file [" + fvFile.getPath() + "] failed. \n" + e.getMessage());\r
             }\r
         }\r
@@ -345,7 +333,7 @@ public class FpdParserTask extends Task {
             Map<String, XmlObject> map = new HashMap<String, XmlObject>();\r
             map.put("PlatformSurfaceArea", doc);\r
             SurfaceAreaQuery.setDoc(map);\r
-            SurfaceAreaQuery.getFpdUserExtension();\r
+\r
             //\r
             // Initialize\r
             //\r
@@ -387,14 +375,9 @@ public class FpdParserTask extends Task {
             //\r
             // Pcd Collection. Call CollectPCDAction to collect pcd info.\r
             //\r
-            try {\r
-                CollectPCDAction ca = new CollectPCDAction();\r
-                ca.perform(GlobalData.getWorkspacePath(),platformId.getFpdFile().getPath(),ActionMessage.NULL_MESSAGE_LEVEL);\r
-            } catch (Exception e){\r
-                throw new BuildException(e.getMessage());\r
-            }\r
+            PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();\r
+            ca.perform(platformId.getFpdFile().getPath(), ActionMessage.NULL_MESSAGE_LEVEL);\r
         } catch (Exception e) {\r
-            e.printStackTrace();\r
             throw new BuildException("Load FPD file [" + fpdFile.getPath() + "] error. \n" + e.getMessage());\r
         }\r
     }\r
@@ -429,8 +412,7 @@ public class FpdParserTask extends Task {
             SurfaceAreaQuery.pop();\r
 \r
             fpdModuleId.setFvBinding(fvBinding);\r
-            String fvSequence = fpdModuleId.getSequence();\r
-            updateFvs(fvSequence, fvBinding, fpdModuleId);\r
+            updateFvs(fvBinding, fpdModuleId);\r
             \r
             //\r
             // Prepare for out put file name\r
@@ -502,9 +484,11 @@ public class FpdParserTask extends Task {
       @param fvName current FV name\r
       @param moduleName current module identification\r
     **/\r
-    private void updateFvs(String fvSequence, String fvName, FpdModuleIdentification fpdModuleId) {\r
-        String upcaseFvName = fvName.toUpperCase();\r
-        String[] fvNameArray = upcaseFvName.split("[, \t]+");\r
+    private void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {\r
+        if (fvName == null || fvName.trim().length() == 0) {\r
+            fvName = "NULL";\r
+        }\r
+        String[] fvNameArray = fvName.split("[, \t]+");\r
         for (int i = 0; i < fvNameArray.length; i++) {\r
             //\r
             // Put module to corresponding fvName\r
@@ -518,19 +502,6 @@ public class FpdParserTask extends Task {
                 set.add(fpdModuleId);\r
                 fvs.put(fvNameArray[i], set);\r
             }\r
-            \r
-            //\r
-            // Put fvName to corresponding fvSequence\r
-            //\r
-            if (sequences.containsKey(fvSequence)) {\r
-                Set<String> set = sequences.get(fvSequence);\r
-                set.add(fvNameArray[i]);\r
-            }\r
-            else {\r
-                Set<String> set = new LinkedHashSet<String>();\r
-                set.add(fvNameArray[i]);\r
-                sequences.put(fvSequence, set);\r
-            }\r
         }\r
     }\r
 \r