]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
Fixed EDKT532 and EDKT533
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / global / SurfaceAreaQuery.java
index 17f7541e093594c61d767d03efd4f976f7e7e925..acd8182d3b0c9e48053bdc5c6c65cf7058ae29c5 100644 (file)
@@ -23,11 +23,12 @@ import java.util.Stack;
 import java.util.regex.Matcher;\r
 import java.util.regex.Pattern;\r
 \r
-import org.tianocore.ExternsDocument.Externs.Extern;\r
 import org.apache.xmlbeans.XmlObject;\r
 import org.apache.xmlbeans.XmlString;\r
 import org.tianocore.*;\r
+import org.tianocore.ExternsDocument.Externs.Extern;\r
 import org.tianocore.FilenameDocument.Filename;\r
+import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions;\r
 import org.tianocore.MsaHeaderDocument.MsaHeader;\r
 import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r
 import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r
@@ -37,6 +38,7 @@ import org.tianocore.build.id.ModuleIdentification;
 import org.tianocore.build.id.PackageIdentification;\r
 import org.tianocore.build.id.PlatformIdentification;\r
 import org.tianocore.build.toolchain.ToolChainInfo;\r
+import org.tianocore.common.definitions.EdkDefinitions;\r
 import org.tianocore.common.exception.EdkException;\r
 import org.w3c.dom.Node;\r
 \r
@@ -542,6 +544,24 @@ public class SurfaceAreaQuery {
         return null;\r
     }\r
 \r
+    /**\r
+     * Retrieve <ModuleDefinitions>/<BinaryModule>\r
+     *\r
+     * @returns The module type name if elements are found at the known xpath\r
+     * @returns null if nothing is there\r
+     */\r
+    public boolean getBinaryModule() {\r
+        String[] xPath = new String[] { "/" };\r
+\r
+        Object[] returns = get("ModuleDefinitions", xPath);\r
+        if (returns != null && returns.length > 0) {\r
+            ModuleDefinitionsDocument.ModuleDefinitions def = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];\r
+            return def.getBinaryModule();\r
+        }\r
+\r
+        return false;\r
+    }\r
+\r
     /**\r
      * Retrieve PackageDependencies/Package\r
      *\r
@@ -593,7 +613,7 @@ public class SurfaceAreaQuery {
      *          xpath\r
      * @returns null if nothing is there\r
      */\r
-    public String[] getLibraryClasses(String usage, String arch) {\r
+    public String[] getLibraryClasses(String usage, String arch, String moduleType) {\r
         String[] xPath;\r
         if (usage == null || usage.equals("")) {\r
             xPath = new String[] { "/LibraryClass" };\r
@@ -610,8 +630,9 @@ public class SurfaceAreaQuery {
         List<String> libraryClassName = new ArrayList<String>();\r
         for (int i = 0; i < libraryClassList.length; i++) {\r
                        List archList = libraryClassList[i].getSupArchList();\r
-\r
-                       if (arch == null || contains(archList, arch)) {\r
+            List moduleTypeList = libraryClassList[i].getSupModuleList();\r
+                       if ((arch == null || contains(archList, arch))\r
+                && (moduleType == null || contains(moduleTypeList, moduleType))) {\r
                 libraryClassName.add(libraryClassList[i].getKeyword());\r
                        }\r
         }\r
@@ -1067,7 +1088,7 @@ public class SurfaceAreaQuery {
                 usageXpath = "/GuidEntry[@Usage='" + arch + "']";\r
                 xPath = new String[] { archXpath, usageXpath };\r
             } else {\r
-                return getProtocolNotifyArray(arch);\r
+                return getGuidEntryArray(arch);\r
             }\r
         }\r
 \r
@@ -1084,6 +1105,234 @@ public class SurfaceAreaQuery {
         return guidList;\r
     }\r
 \r
+    public String[] getEventCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{\r
+                "/CreateEvents/EventTypes[@EventGuidCName]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName]",\r
+            };\r
+        } else {\r
+            xPath = new String[]{\r
+                "/CreateEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",\r
+                "/CreateEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("Events", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            if (returns[i] instanceof EventsDocument.Events.CreateEvents.EventTypes) {\r
+                cnameList[i] = ((EventsDocument.Events.CreateEvents.EventTypes) returns[i]).getEventGuidCName();\r
+            } else {\r
+                cnameList[i] = ((EventsDocument.Events.SignalEvents.EventTypes) returns[i]).getEventGuidCName();\r
+            }\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getHobCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/HobTypes[@HobGuidCName]"};\r
+        } else {\r
+            xPath = new String[]{\r
+                "/HobTypes[@HobGuidCName and not(@SupArchList)]",\r
+                "/HobTypes[@HobGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("Hobs", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((HobsDocument.Hobs.HobTypes) returns[i]).getHobGuidCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getVariableCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/Variable"};\r
+        } else {\r
+            xPath = new String[]{"/Variable[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("Variables", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((VariablesDocument.Variables.Variable) returns[i]).getGuidCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getSystemTableCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/SystemTableCNames"};\r
+        } else {\r
+            xPath = new String[]{\r
+                "/SystemTableCNames[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("SystemTables", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((SystemTablesDocument.SystemTables.SystemTableCNames) returns[i]).getSystemTableCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getDataHubCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/DataHubRecord"};\r
+        } else {\r
+            xPath = new String[]{"/DataHubRecord[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("DataHubs", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((DataHubsDocument.DataHubs.DataHubRecord) returns[i]).getDataHubCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getHiiPackageCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/HiiPackage"};\r
+        } else {\r
+            xPath = new String[]{"/HiiPackage[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("HiiPackages", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((HiiPackagesDocument.HiiPackages.HiiPackage) returns[i]).getHiiCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getCNameArray(String arch) {\r
+        List<String> cnameList = new ArrayList<String>(100);\r
+        String[] result = null;\r
+        // \r
+        // "/Guids/GuidCNames/GuidCName",\r
+        // \r
+        result = getGuidEntryArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Protocols/Protocol/ProtocolCName",\r
+        // \r
+        result = getProtocolArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        //  "/Protocols/ProtocolNotify/ProtocolNotifyCName",\r
+        // \r
+        result = getProtocolNotifyArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Events/CreateEvents/EventTypes[@EventGuidCName]",\r
+        // "/Events/SignalEvents/EventTypes[@EventGuidCName]",\r
+        // \r
+        result = getEventCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        // "/Hobs/HobTypes[@HobGuidCName]",\r
+        // \r
+        result = getHobCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/PPIs/Ppi/PpiCName",\r
+        //\r
+        result = getPpiArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/PPIs/PpiNotify/PpiNotifyCName",\r
+        // \r
+        result = getPpiNotifyArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Variables/Variable/GuidC_Name",\r
+        // \r
+        result = getVariableCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/SystemTables/SystemTableCNames/SystemTableCName",\r
+        // \r
+        result = getSystemTableCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        //  "/DataHubs/DataHubRecord/DataHubCName",\r
+        // \r
+        result = getDataHubCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        // "/HiiPackages/HiiPackage/HiiCName",\r
+        // \r
+        result = getHiiPackageCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+\r
+        return cnameList.toArray(new String[cnameList.size()]);\r
+    }\r
+\r
     /**\r
      * Retrieve Library instance information\r
      *\r
@@ -1490,6 +1739,22 @@ public class SurfaceAreaQuery {
         return a.getDomNode();\r
     }\r
 \r
+    public Node[] getFpdUserExtensions() {\r
+        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and not(@Identifier='1') and not(@Identifier='0')]" };\r
+\r
+        Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
+        if (queryResult == null || queryResult.length == 0) {\r
+            return new Node[0];\r
+        }\r
+\r
+        Node[] nodeList = new Node[queryResult.length];\r
+        for (int i = 0; i < queryResult.length; ++i) {\r
+            UserExtensionsDocument.UserExtensions a =  (UserExtensionsDocument.UserExtensions)queryResult[i];\r
+            nodeList[i] = a.getDomNode();\r
+        }\r
+\r
+        return nodeList;\r
+    }\r
     /**\r
      * Retrieve FV image option information\r
      *\r
@@ -2008,15 +2273,8 @@ public class SurfaceAreaQuery {
                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
-            if (s.equalsIgnoreCase(str)) {\r
-                return true;\r
-            }\r
-        }\r
 \r
-        return false;\r
+        return list.contains(str);\r
     }\r
 \r
        public boolean isHaveTianoR8FlashMap(){\r