]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
Because Pcd entity, exception and some action package are shared by Building tools...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / fpd / FpdParserTask.java
index 3788d239c735667334deb243d0a3fbbc12aa1c84..bd87b6e0f2ce41e0f134abf52a1010fa4a82a37e 100644 (file)
@@ -39,9 +39,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.pcd.action.ActionMessage;\r
 import org.tianocore.build.pcd.action.CollectPCDAction;\r
-import org.tianocore.build.pcd.exception.EntityException;\r
 import org.tianocore.build.toolchain.ToolChainAttribute;\r
 import org.tianocore.build.toolchain.ToolChainElement;\r
 import org.tianocore.build.toolchain.ToolChainMap;\r
@@ -139,7 +138,7 @@ public class FpdParserTask extends Task {
             if (platformName == null) {\r
                 throw new BuildException("FpdParserTask parameter error. Please specify platform name or FPD file. ");\r
             }\r
-            platformId = GlobalData.getPlatform(platformName);\r
+            platformId = GlobalData.getPlatformByName(platformName);\r
             fpdFile = platformId.getFpdFile();\r
         }\r
         \r
@@ -148,16 +147,6 @@ public class FpdParserTask extends Task {
         //\r
         parseFpdFile();\r
         \r
-        //\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
-        \r
         //\r
         // Prepare BUILD_DIR\r
         //\r
@@ -231,9 +220,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
@@ -306,7 +295,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
@@ -321,7 +310,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
@@ -355,13 +343,14 @@ public class FpdParserTask extends Task {
             Map<String, XmlObject> map = new HashMap<String, XmlObject>();\r
             map.put("PlatformSurfaceArea", doc);\r
             SurfaceAreaQuery.setDoc(map);\r
-            \r
+\r
             //\r
             // Initialize\r
             //\r
             platformId = SurfaceAreaQuery.getFpdHeader();\r
             platformId.setFpdFile(fpdFile);\r
             getProject().setProperty("PLATFORM", platformId.getName());\r
+            getProject().setProperty("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/"));\r
             getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));\r
             getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));\r
 \r
@@ -392,8 +381,17 @@ public class FpdParserTask extends Task {
             parseToolChainOptions();\r
 \r
             SurfaceAreaQuery.setDoc(map);\r
+            \r
+            //\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
         } catch (Exception e) {\r
-            e.printStackTrace();\r
             throw new BuildException("Load FPD file [" + fpdFile.getPath() + "] error. \n" + e.getMessage());\r
         }\r
     }\r
@@ -502,8 +500,10 @@ public class FpdParserTask extends Task {
       @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
+        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