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=17f7541e093594c61d767d03efd4f976f7e7e925;hp=6afeb30f5a5b5b8251e037f6c7cc41eede187556;hb=7432a2144462a36cd8a613a5620963152f03a3f9;hpb=91a1f0d7ac1e62fb578d645c546c9c12e81f5fe2 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 6afeb30f5a..17f7541e09 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -76,8 +76,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("([^/]*)(/|//)([^/]+)"); @@ -492,6 +491,22 @@ public class SurfaceAreaQuery { return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag); } + + public String[][] getMsaBuildOptions(boolean toolChainFamilyFlag) { + String[] xPath; + + if (toolChainFamilyFlag == true) { + xPath = new String[] { + "/Options/Option[not(@ToolChainFamily) and not(@TagName)]", + "/Options/Option[@ToolChainFamily]", }; + } else { + xPath = new String[] { + "/Options/Option[not(@ToolChainFamily) and not(@TagName)]", + "/Options/Option[@TagName]", }; + } + + return getOptions("ModuleBuildOptions", xPath, toolChainFamilyFlag); + } public ToolChainInfo getFpdToolChainInfo() { String[] xPath = new String[] { "/PlatformDefinitions" }; @@ -1932,30 +1947,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())); + } + } + + if (results.size() == 0) { + return new String[0]; } - return results; + + String[] retArray = new String[results.size()]; + results.toArray(retArray); + + return retArray; } /** @@ -1995,6 +2036,32 @@ public class SurfaceAreaQuery { } } + public Node getPeiApriori(String fvName) { + String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='0' and ./FvName='" + fvName + "']" }; + Object[] result = get("PlatformSurfaceArea", xPath); + + if (result == null || result.length == 0) { + return null; + } + + UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0]; + + return a.getDomNode(); + } + + public Node getDxeApriori(String fvName) { + String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='1' and ./FvName='" + fvName + "']" }; + Object[] result = get("PlatformSurfaceArea", xPath); + + if (result == null || result.length == 0) { + return null; + } + + UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0]; + + return a.getDomNode(); + } + public Node getFpdModuleSequence(String fvName) { String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='IMAGES' and @Identifier='1' and ./FvName='" + fvName + "']" }; Object[] result = get("PlatformSurfaceArea", xPath); @@ -2007,4 +2074,25 @@ public class SurfaceAreaQuery { return a.getDomNode(); } + + /** + Get the value of PCD by PCD cName + + @return PcdValue String of PcdComponentName + null If don't find ComponentName Pcd + **/ + public String getPcdValueBycName(String cName){ + String[] xPath = new String[] { "/PcdData" }; + Object[] returns = get("PcdBuildDefinition", xPath); + if (returns == null || returns.length == 0) { + return null; + } + for (int i = 0; i < returns.length; i++) { + PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)returns[i]; + if (pcdData.getCName().equalsIgnoreCase(cName)){ + return pcdData.getValue(); + } + } + return null; + } }