import org.tianocore.build.id.PlatformIdentification;\r
import org.tianocore.build.toolchain.ToolChainInfo;\r
import org.tianocore.common.exception.EdkException;\r
+import org.tianocore.common.definitions.EdkDefinitions;\r
import org.w3c.dom.Node;\r
\r
/**\r
//\r
// keep the namep declaration for xmlbeans Xpath query\r
//\r
- private String queryDeclaration = null;\r
-\r
+ private String queryDeclaration = null; \r
private StringBuffer normQueryString = new StringBuffer(4096);\r
private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");\r
\r
* 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
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
return new ModuleSADocument.ModuleSA[0];\r
\r
}\r
+ \r
/**\r
- Get name array of PCD in a module. In one module, token space\r
- is same, and token name should not be conflicted.\r
-\r
- @return String[]\r
+ Get name array who contains all PCDs in a module according to specified arch.\r
+ \r
+ @param arch The specified architecture type.\r
+ \r
+ @return String[] return all PCDs name into array, if no any PCD used by\r
+ this module, a String[0] array is returned.\r
**/\r
- public String[] getModulePcdEntryNameArray() {\r
+ public String[] getModulePcdEntryNameArray(String arch) {\r
PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;\r
- String[] results;\r
- int index;\r
- String[] xPath = new String[] {"/PcdEntry"};\r
- Object[] returns = get ("PcdCoded", xPath);\r
+ java.util.List archList = null;\r
+ java.util.List<String> results = new java.util.ArrayList<String> ();\r
+ int index;\r
+ String[] xPath = new String[] {"/PcdEntry"};\r
+ Object[] returns = get ("PcdCoded", xPath);\r
\r
if (returns == null) {\r
return new String[0];\r
}\r
\r
- pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r
- results = new String[pcdEntries.length];\r
+ pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r
\r
for (index = 0; index < pcdEntries.length; index ++) {\r
- results[index] = pcdEntries[index].getCName();\r
+ archList = pcdEntries[index].getSupArchList();\r
+ //\r
+ // If the ArchList is specified in MSA for this PCD, need check\r
+ // current arch whether can support by this PCD.\r
+ // \r
+ if (archList != null) {\r
+ if (archList.contains(arch)) {\r
+ results.add(new String(pcdEntries[index].getCName()));\r
+ }\r
+ } else {\r
+ //\r
+ // If no ArchList is specificied in MSA for this PCD, that means\r
+ // this PCD support all architectures.\r
+ // \r
+ results.add(new String(pcdEntries[index].getCName()));\r
+ }\r
}\r
- return results;\r
+\r
+ if (results.size() == 0) {\r
+ return new String[0];\r
+ }\r
+\r
+ String[] retArray = new String[results.size()];\r
+ results.toArray(retArray);\r
+\r
+ return retArray; \r
}\r
\r
/**\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
- 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
}\r
}\r
\r
+ public Node getPeiApriori(String fvName) {\r
+ String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='0' and ./FvName='" + fvName + "']" };\r
+ Object[] result = get("PlatformSurfaceArea", xPath);\r
+ \r
+ if (result == null || result.length == 0) {\r
+ return null;\r
+ }\r
+ \r
+ UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0];\r
+ \r
+ return a.getDomNode();\r
+ }\r
+ \r
+ public Node getDxeApriori(String fvName) {\r
+ String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='1' and ./FvName='" + fvName + "']" };\r
+ Object[] result = get("PlatformSurfaceArea", xPath);\r
+ \r
+ if (result == null || result.length == 0) {\r
+ return null;\r
+ }\r
+ \r
+ UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)result[0];\r
+ \r
+ return a.getDomNode();\r
+ }\r
+ \r
public Node getFpdModuleSequence(String fvName) {\r
String[] xPath = new String[] { "/BuildOptions/UserExtensions[@UserID='IMAGES' and @Identifier='1' and ./FvName='" + fvName + "']" };\r
Object[] result = get("PlatformSurfaceArea", xPath);\r