X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FSurfaceAreaQuery.java;h=b95c389592a051a011fa0d8e38e62c06d4a3fdd3;hp=9e4c445508fa6774db1e5085755a1666ffecbe7c;hb=e3cc406130b14c020c75e3a169f94ba001bf2128;hpb=380191dd245730b79c399728b4e476d08df0e62f diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 9e4c445508..b95c389592 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -38,6 +38,7 @@ import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PlatformIdentification; import org.tianocore.build.toolchain.ToolChainInfo; import org.tianocore.common.exception.EdkException; +import org.tianocore.common.definitions.EdkDefinitions; import org.w3c.dom.Node; /** @@ -76,8 +77,7 @@ public class SurfaceAreaQuery { // // keep the namep declaration for xmlbeans Xpath query // - private String queryDeclaration = null; - + private String queryDeclaration = null; private StringBuffer normQueryString = new StringBuffer(4096); private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)"); @@ -594,7 +594,7 @@ public class SurfaceAreaQuery { * xpath * @returns null if nothing is there */ - public String[] getLibraryClasses(String usage, String arch) { + public String[] getLibraryClasses(String usage, String arch, String moduleType) { String[] xPath; if (usage == null || usage.equals("")) { xPath = new String[] { "/LibraryClass" }; @@ -611,8 +611,9 @@ public class SurfaceAreaQuery { List libraryClassName = new ArrayList(); for (int i = 0; i < libraryClassList.length; i++) { List archList = libraryClassList[i].getSupArchList(); - - if (arch == null || contains(archList, arch)) { + List moduleTypeList = libraryClassList[i].getSupModuleList(); + if ((arch == null || contains(archList, arch)) + && (moduleType == null || contains(moduleTypeList, moduleType))) { libraryClassName.add(libraryClassList[i].getKeyword()); } } @@ -1491,6 +1492,22 @@ public class SurfaceAreaQuery { return a.getDomNode(); } + public Node[] getFpdUserExtensions() { + String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and not(@Identifier='1') and not(@Identifier='0')]" }; + + Object[] queryResult = get("PlatformSurfaceArea", xPath); + if (queryResult == null || queryResult.length == 0) { + return new Node[0]; + } + + Node[] nodeList = new Node[queryResult.length]; + for (int i = 0; i < queryResult.length; ++i) { + UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[i]; + nodeList[i] = a.getDomNode(); + } + + return nodeList; + } /** * Retrieve FV image option information * @@ -1948,30 +1965,56 @@ public class SurfaceAreaQuery { return new ModuleSADocument.ModuleSA[0]; } + /** - Get name array of PCD in a module. In one module, token space - is same, and token name should not be conflicted. - - @return String[] + Get name array who contains all PCDs in a module according to specified arch. + + @param arch The specified architecture type. + + @return String[] return all PCDs name into array, if no any PCD used by + this module, a String[0] array is returned. **/ - public String[] getModulePcdEntryNameArray() { + public String[] getModulePcdEntryNameArray(String arch) { PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null; - String[] results; - int index; - String[] xPath = new String[] {"/PcdEntry"}; - Object[] returns = get ("PcdCoded", xPath); + java.util.List archList = null; + java.util.List results = new java.util.ArrayList (); + int index; + String[] xPath = new String[] {"/PcdEntry"}; + Object[] returns = get ("PcdCoded", xPath); if (returns == null) { return new String[0]; } - pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns; - results = new String[pcdEntries.length]; + pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns; for (index = 0; index < pcdEntries.length; index ++) { - results[index] = pcdEntries[index].getCName(); + archList = pcdEntries[index].getSupArchList(); + // + // If the ArchList is specified in MSA for this PCD, need check + // current arch whether can support by this PCD. + // + if (archList != null) { + if (archList.contains(arch)) { + results.add(new String(pcdEntries[index].getCName())); + } + } else { + // + // If no ArchList is specificied in MSA for this PCD, that means + // this PCD support all architectures. + // + results.add(new String(pcdEntries[index].getCName())); + } } - return results; + + if (results.size() == 0) { + return new String[0]; + } + + String[] retArray = new String[results.size()]; + results.toArray(retArray); + + return retArray; } /** @@ -1983,15 +2026,8 @@ public class SurfaceAreaQuery { if (list == null || list.size()== 0) { return true; } - Iterator it = list.iterator(); - while (it.hasNext()) { - String s = (String)it.next(); - if (s.equalsIgnoreCase(str)) { - return true; - } - } - return false; + return list.contains(str); } public boolean isHaveTianoR8FlashMap(){