]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
Fixed EDKT163. Added code to assign "arch" to null when no "SupArchList" is specified...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / global / SurfaceAreaQuery.java
index 235c604eb3c391ab68495842378ed767341e7f4c..dbcc12772ceb16e566076a44bcd214bacb6a3c1c 100644 (file)
@@ -397,7 +397,6 @@ public class SurfaceAreaQuery {
         String toolchainFamily = null;\r
         List<String> archList = null;\r
         String cmd = null;\r
-        String targetName = null;\r
         String optionName = null;\r
 \r
         Object[] returns = get(from, xPath);\r
@@ -598,9 +597,8 @@ public class SurfaceAreaQuery {
      *          xpath\r
      * @returns null if nothing is there\r
      */\r
-    public static String[] getLibraryClasses(String usage) {\r
+    public static String[] getLibraryClasses(String usage, String arch) {\r
         String[] xPath;\r
-\r
         if (usage == null || usage.equals("")) {\r
             xPath = new String[] { "/LibraryClass" };\r
         } else {\r
@@ -613,11 +611,19 @@ public class SurfaceAreaQuery {
         }\r
 \r
         LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;\r
-        String[] libraryClassName = new String[libraryClassList.length];\r
+        List<String> libraryClassName = new ArrayList<String>();\r
         for (int i = 0; i < libraryClassList.length; i++) {\r
-            libraryClassName[i] = libraryClassList[i].getKeyword();\r
+                       List archList = libraryClassList[i].getSupArchList();\r
+                       \r
+                       if (arch == null || contains(archList, arch)) {\r
+                libraryClassName.add(libraryClassList[i].getKeyword());\r
+                       }\r
         }\r
-        return libraryClassName;\r
+               String[] libraryArray = new String[libraryClassName.size()];\r
+               for (int i = 0; i < libraryClassName.size(); i++) {\r
+                       libraryArray[i] = libraryClassName.get(i);\r
+               }\r
+        return libraryArray;\r
     }\r
 \r
     /**\r
@@ -1298,24 +1304,24 @@ public class SurfaceAreaQuery {
                 ObjectMap.put("Libraries", moduleSA.getLibraries());\r
             }\r
             if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {\r
-                ObjectMap.put("PcdBuildDefinition", moduleSA\r
-                        .getPcdBuildDefinition());\r
+                ObjectMap.put("PcdBuildDefinition", moduleSA.getPcdBuildDefinition());\r
             }\r
-            if (((ModuleSADocument.ModuleSA) result[i])\r
-                    .getModuleSaBuildOptions() != null) {\r
-                ObjectMap.put("ModuleSaBuildOptions", moduleSA\r
-                        .getModuleSaBuildOptions());\r
+            if (((ModuleSADocument.ModuleSA) result[i]).getModuleSaBuildOptions() != null) {\r
+                ObjectMap.put("ModuleSaBuildOptions", moduleSA.getModuleSaBuildOptions());\r
             }\r
 \r
             //\r
             // Get Fpd SA Module attribute and create FpdMoudleIdentification.\r
             //\r
-            arch = moduleSA.getSupArchList().toString();\r
+            if (moduleSA.isSetSupArchList()) {\r
+                arch = moduleSA.getSupArchList().toString();\r
+            } else {\r
+                arch = null;\r
+            }\r
 \r
             // TBD\r
             fvBinding = null;\r
-            saVersion = ((ModuleSADocument.ModuleSA) result[i])\r
-                    .getModuleVersion();\r
+            saVersion = ((ModuleSADocument.ModuleSA) result[i]).getModuleVersion();\r
 \r
             saGuid = moduleSA.getModuleGuid();\r
             pkgGuid = moduleSA.getPackageGuid();\r
@@ -1325,10 +1331,8 @@ public class SurfaceAreaQuery {
             // Create Module Identification which have class member of package\r
             // identification.\r
             //\r
-            PackageIdentification pkgId = new PackageIdentification(null,\r
-                    pkgGuid, pkgVersion);\r
-            ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r
-                    saVersion);\r
+            PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion);\r
+            ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion);\r
 \r
             saId.setPackage(pkgId);\r
 \r
@@ -1336,21 +1340,24 @@ public class SurfaceAreaQuery {
             // Create FpdModule Identification which have class member of module\r
             // identification\r
             //\r
-            if (arch != null) {\r
-                String[] archList = arch.split(" ");\r
-                for (int j = 0; j < archList.length; j++) {\r
-                    FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId,    archList[j]);\r
-        \r
-                    if (fvBinding != null) {\r
-                        fpdSaId.setFvBinding(fvBinding);\r
-                    }\r
-        \r
-                    //\r
-                    // Put element to Map<FpdModuleIdentification, Map<String,\r
-                    // Object>>.\r
-                    //\r
-                    fpdModuleMap.put(fpdSaId, ObjectMap);\r
+            String[] archList = new String[0];\r
+            if (arch == null || arch.trim().length() == 0) {\r
+                archList = GlobalData.getToolChainInfo().getArchs();\r
+            } else {\r
+                archList = arch.split(" ");\r
+            }\r
+            for (int j = 0; j < archList.length; j++) {\r
+                FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]);\r
+    \r
+                if (fvBinding != null) {\r
+                    fpdSaId.setFvBinding(fvBinding);\r
                 }\r
+    \r
+                //\r
+                // Put element to Map<FpdModuleIdentification, Map<String,\r
+                // Object>>.\r
+                //\r
+                fpdModuleMap.put(fpdSaId, ObjectMap);\r
             }\r
         }\r
         return fpdModuleMap;\r
@@ -1378,8 +1385,20 @@ public class SurfaceAreaQuery {
         return result;\r
     }\r
     \r
-    public static Node getFpdUserExtension() {\r
-        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore']" }; \r
+    public static Node getFpdUserExtensionPreBuild() {\r
+        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" }; \r
+\r
+        Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
+        if (queryResult == null || queryResult.length == 0) {\r
+            return null;\r
+        }\r
+        UserExtensionsDocument.UserExtensions a =  (UserExtensionsDocument.UserExtensions)queryResult[0];\r
+        \r
+        return a.getDomNode();\r
+    }\r
+    \r
+    public static Node getFpdUserExtensionPostBuild() {\r
+        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" }; \r
 \r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
         if (queryResult == null || queryResult.length == 0) {\r
@@ -1401,7 +1420,7 @@ public class SurfaceAreaQuery {
      */\r
     public static String[][] getFpdOptions(String fvName) {\r
            String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"\r
-                      + fvName.toUpperCase() + "']/FvImageOptions" };\r
+                      + fvName + "']/FvImageOptions" };\r
            Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
            if (queryResult == null) {\r
                  return new String[0][];\r
@@ -1469,7 +1488,7 @@ public class SurfaceAreaQuery {
      */\r
     public static String[][] getFpdAttributes(String fvName) {\r
         String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"\r
-                         + fvName.toUpperCase() + "']/FvImageOptions" };\r
+                         + fvName + "']/FvImageOptions" };\r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
         if (queryResult == null) {\r
              return new String[0][];\r
@@ -1539,7 +1558,7 @@ public class SurfaceAreaQuery {
      * @returns empty list if nothing is there\r
      */\r
     public static String[][] getFpdComponents(String fvName) {\r
-        String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName.toUpperCase() + "']/FvImageOptions" };\r
+        String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" };\r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
         if (queryResult == null) {\r
             return new String[0][];\r
@@ -1751,7 +1770,7 @@ public class SurfaceAreaQuery {
             String[] guidPair = new String[2];\r
             guidPair[0] = entry.getCName();\r
             guidPair[1] = entry.getGuidValue();\r
-            guidDeclMap.put(entry.getName(), guidPair);\r
+            guidDeclMap.put(entry.getCName(), guidPair);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
             EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[0]);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[1]);\r
@@ -1782,7 +1801,7 @@ public class SurfaceAreaQuery {
 \r
             protocolPair[0] = entry.getCName();\r
             protocolPair[1] = entry.getGuidValue();\r
-            protoclMap.put(entry.getName(), protocolPair);\r
+            protoclMap.put(entry.getCName(), protocolPair);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
             EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[0]);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[1]);\r
@@ -1817,7 +1836,7 @@ public class SurfaceAreaQuery {
             String[] ppiPair = new String[2];\r
             ppiPair[0] = entry.getCName();\r
             ppiPair[1] = entry.getGuidValue();\r
-            ppiMap.put(entry.getName(), ppiPair);\r
+            ppiMap.put(entry.getCName(), ppiPair);\r
         }\r
         return ppiMap;\r
     }\r
@@ -1885,6 +1904,9 @@ public class SurfaceAreaQuery {
      @return boolean\r
      **/\r
     public static boolean contains(List list, String str) {\r
+               if (list == null || list.size()== 0) {\r
+                       return true;\r
+               }\r
         Iterator it = list.iterator();\r
         while (it.hasNext()) {\r
             String s = (String)it.next();\r
@@ -1895,4 +1917,21 @@ public class SurfaceAreaQuery {
 \r
         return false;\r
     }\r
+\r
+       public static boolean isHaveTianoR8FlashMap(){\r
+        String[]            xPath       = new String[] {"/"};\r
+        Object[]         returns     = get ("Externs", xPath);\r
+\r
+        if (returns == null) {\r
+            return false;\r
+        }\r
+\r
+               ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0];\r
+               \r
+               if (ext.getTianoR8FlashMapH()){\r
+                       return true;\r
+           }else {\r
+                       return false;\r
+               }\r
+       }\r
 }\r