Remove static from SurfaceAreaQuery.java for preparing parallel build.(1)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1428 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-09-01 09:28:15 +00:00
parent c74c7a4302
commit 83fba80256
10 changed files with 217 additions and 216 deletions

View File

@ -84,6 +84,12 @@ public class FfsProcess {
/// ///
public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions; public static final String[][] sectionExt = EdkDefinitions.SectionTypeExtensions;
private SurfaceAreaQuery saq = null;
public FfsProcess(SurfaceAreaQuery saq) {
this.saq = saq;
}
/** /**
search in the type, if componentType is listed in type, return true; search in the type, if componentType is listed in type, return true;
otherwise return false. otherwise return false.
@ -115,9 +121,9 @@ public class FfsProcess {
// //
// Try to find Ffs layout from FPD file // Try to find Ffs layout from FPD file
// //
SurfaceAreaQuery.push(GlobalData.getFpdBuildOptions()); saq.push(GlobalData.getFpdBuildOptions());
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getFpdFfs(); BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = saq.getFpdFfs();
SurfaceAreaQuery.pop(); saq.pop();
for (int i = 0; i < ffsArray.length; i++) { for (int i = 0; i < ffsArray.length; i++) {
if (isMatch(ffsArray[i].getFfsKey(), buildType)) { if (isMatch(ffsArray[i].getFfsKey(), buildType)) {
ffsXmlObject = ffsArray[i]; ffsXmlObject = ffsArray[i];

View File

@ -109,6 +109,8 @@ public class GenBuildTask extends Ant {
private boolean isSingleModuleBuild = false; private boolean isSingleModuleBuild = false;
private SurfaceAreaQuery saq = null;
/** /**
Public construct method. It is necessary for ANT task. Public construct method. It is necessary for ANT task.
**/ **/
@ -154,14 +156,14 @@ public class GenBuildTask extends Ant {
moduleId = new ModuleIdentification(moduleGuid, moduleVersion); moduleId = new ModuleIdentification(moduleGuid, moduleVersion);
moduleId.setPackage(packageId); moduleId.setPackage(packageId);
Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId); Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);
SurfaceAreaQuery.setDoc(doc); saq = new SurfaceAreaQuery(doc);
moduleId = SurfaceAreaQuery.getMsaHeader(); moduleId = saq.getMsaHeader();
} else { } else {
Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile); Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);
SurfaceAreaQuery.setDoc(doc); saq = new SurfaceAreaQuery(doc);
moduleId = SurfaceAreaQuery.getMsaHeader(); moduleId = saq.getMsaHeader();
} }
String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null); String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
if (producedLibraryClasses.length == 0) { if (producedLibraryClasses.length == 0) {
moduleId.setLibrary(false); moduleId.setLibrary(false);
} else { } else {
@ -221,7 +223,7 @@ public class GenBuildTask extends Ant {
// //
// Judge if arch is all supported by current module. If not, throw Exception. // Judge if arch is all supported by current module. If not, throw Exception.
// //
List moduleSupportedArchs = SurfaceAreaQuery.getModuleSupportedArchs(); List moduleSupportedArchs = saq.getModuleSupportedArchs();
if (moduleSupportedArchs != null) { if (moduleSupportedArchs != null) {
for (int k = 0; k < archList.length; k++) { for (int k = 0; k < archList.length; k++) {
if ( ! moduleSupportedArchs.contains(archList[k])) { if ( ! moduleSupportedArchs.contains(archList[k])) {
@ -277,7 +279,7 @@ public class GenBuildTask extends Ant {
System.out.println("Build " + moduleId + " start >>>"); System.out.println("Build " + moduleId + " start >>>");
System.out.println("Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]); System.out.println("Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);
SurfaceAreaQuery.setDoc(GlobalData.getDoc(fpdModuleId)); saq.push(GlobalData.getDoc(fpdModuleId));
// //
// Prepare for all other common properties // Prepare for all other common properties
@ -377,7 +379,7 @@ public class GenBuildTask extends Ant {
// MODULE_DIR, MODULE_RELATIVE_DIR // MODULE_DIR, MODULE_RELATIVE_DIR
// //
PropertyManager.setProperty("MODULE", moduleId.getName()); PropertyManager.setProperty("MODULE", moduleId.getName());
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename(); String baseName = saq.getModuleOutputFileBasename();
if (baseName == null) { if (baseName == null) {
PropertyManager.setProperty("BASE_NAME", moduleId.getName()); PropertyManager.setProperty("BASE_NAME", moduleId.getName());
} else { } else {
@ -539,13 +541,11 @@ public class GenBuildTask extends Ant {
private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws BuildException{ private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws BuildException{
// //
// AutoGen // Call AutoGen to generate AutoGen.c and AutoGen.h
// //
AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq);
AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());
autogen.genAutogen(); autogen.genAutogen();
// //
// Get compiler flags // Get compiler flags
// //
@ -559,7 +559,7 @@ public class GenBuildTask extends Ant {
// //
// Prepare LIBS // Prepare LIBS
// //
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch()); ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
String propertyLibs = ""; String propertyLibs = "";
for (int i = 0; i < libinstances.length; i++) { for (int i = 0; i < libinstances.length; i++) {
propertyLibs += " " + getProject().getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib"; propertyLibs += " " + getProject().getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib";
@ -588,8 +588,8 @@ public class GenBuildTask extends Ant {
// Generate ${BASE_NAME}_build.xml // Generate ${BASE_NAME}_build.xml
// TBD // TBD
// //
String ffsKeyword = SurfaceAreaQuery.getModuleFfsKeyword(); String ffsKeyword = saq.getModuleFfsKeyword();
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes); ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes, saq);
String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml"; String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
fileGenerator.genBuildFile(buildFilename); fileGenerator.genBuildFile(buildFilename);
@ -721,7 +721,7 @@ public class GenBuildTask extends Ant {
// //
// Packages in PackageDenpendencies // Packages in PackageDenpendencies
// //
PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch()); PackageIdentification[] packageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
for (int i = 0; i < packageDependencies.length; i++) { for (int i = 0; i < packageDependencies.length; i++) {
GlobalData.refreshPackageIdentification(packageDependencies[i]); GlobalData.refreshPackageIdentification(packageDependencies[i]);
File packageFile = packageDependencies[i].getSpdFile(); File packageFile = packageDependencies[i].getSpdFile();
@ -732,17 +732,17 @@ public class GenBuildTask extends Ant {
// //
// All Dependency Library Instance's PackageDependencies // All Dependency Library Instance's PackageDependencies
// //
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch()); ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
for (int i = 0; i < libinstances.length; i++) { for (int i = 0; i < libinstances.length; i++) {
SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch())); saq.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch()); PackageIdentification[] libraryPackageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
for (int j = 0; j < libraryPackageDependencies.length; j++) { for (int j = 0; j < libraryPackageDependencies.length; j++) {
GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]); GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);
File packageFile = libraryPackageDependencies[j].getSpdFile(); File packageFile = libraryPackageDependencies[j].getSpdFile();
includes.add(packageFile.getParent() + File.separatorChar + "Include"); includes.add(packageFile.getParent() + File.separatorChar + "Include");
includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch)); includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));
} }
SurfaceAreaQuery.pop(); saq.pop();
} }

View File

@ -65,11 +65,14 @@ public class ModuleBuildFileGenerator {
private String[] includes; private String[] includes;
public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId, String[] includes) { private SurfaceAreaQuery saq = null;
public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId, String[] includes, SurfaceAreaQuery saq) {
this.project = project; this.project = project;
this.fpdModuleId = fpdModuleId; this.fpdModuleId = fpdModuleId;
this.ffsKeyword = ffsKeyword; this.ffsKeyword = ffsKeyword;
this.includes = includes; this.includes = includes;
this.saq = saq;
} }
/** /**
@ -88,7 +91,7 @@ public class ModuleBuildFileGenerator {
Error throws during BaseName_build.xml generating. Error throws during BaseName_build.xml generating.
**/ **/
public void genBuildFile(String buildFilename) throws BuildException { public void genBuildFile(String buildFilename) throws BuildException {
FfsProcess fp = new FfsProcess(); FfsProcess fp = new FfsProcess(saq);
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try { try {
DocumentBuilder dombuilder = domfac.newDocumentBuilder(); DocumentBuilder dombuilder = domfac.newDocumentBuilder();
@ -293,7 +296,7 @@ public class ModuleBuildFileGenerator {
@param root Root element for current @param root Root element for current
**/ **/
private void applyLibraryInstance(Document document, Node root) { private void applyLibraryInstance(Document document, Node root) {
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch()); ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
for (int i = 0; i < libinstances.length; i++) { for (int i = 0; i < libinstances.length; i++) {
// //
// Put package file path to module identification // Put package file path to module identification
@ -341,7 +344,7 @@ public class ModuleBuildFileGenerator {
// //
// sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir // sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir
// //
String[][] sourceFiles = SurfaceAreaQuery.getSourceFiles(fpdModuleId.getArch()); String[][] sourceFiles = saq.getSourceFiles(fpdModuleId.getArch());
FileProcess fileProcess = new FileProcess(); FileProcess fileProcess = new FileProcess();
fileProcess.init(project, includes, document); fileProcess.init(project, includes, document);

View File

@ -116,6 +116,7 @@ public class AutoGen {
private List<String> setVirtalAddList = new ArrayList<String>(); private List<String> setVirtalAddList = new ArrayList<String>();
private List<String> exitBootServiceList = new ArrayList<String>(); private List<String> exitBootServiceList = new ArrayList<String>();
private SurfaceAreaQuery saq = null;
/** /**
Construct function Construct function
@ -131,12 +132,12 @@ public class AutoGen {
@param arch @param arch
Target architecture. Target architecture.
**/ **/
public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch) { public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq) {
this.outputPath = outputPath; this.outputPath = outputPath;
this.moduleId = moduleId; this.moduleId = moduleId;
this.arch = arch; this.arch = arch;
this.fvDir = fvDir; this.fvDir = fvDir;
this.saq = saq;
} }
/** /**
@ -314,7 +315,7 @@ public class AutoGen {
// be got from module surface area instead of hard code by it's // be got from module surface area instead of hard code by it's
// moduleType. // moduleType.
// //
moduleType = SurfaceAreaQuery.getModuleType(); moduleType = saq.getModuleType();
// //
// Add "extern int __make_me_compile_correctly;" at begin of // Add "extern int __make_me_compile_correctly;" at begin of
@ -325,7 +326,7 @@ public class AutoGen {
// //
// Put EFI_SPECIFICATION_VERSION, and EDK_RELEASE_VERSION. // Put EFI_SPECIFICATION_VERSION, and EDK_RELEASE_VERSION.
// //
String[] specList = SurfaceAreaQuery.getExternSpecificaiton(); String[] specList = saq.getExternSpecificaiton();
for (int i = 0; i < specList.length; i++) { for (int i = 0; i < specList.length; i++) {
fileBuffer.append(CommonDefinition.DEFINE + specList[i] fileBuffer.append(CommonDefinition.DEFINE + specList[i]
+ "\r\n"); + "\r\n");
@ -335,8 +336,7 @@ public class AutoGen {
// //
// PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery // PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery
// .getDependencePkg(this.arch); // .getDependencePkg(this.arch);
PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery PackageIdentification[] consumedPkgIdList = saq.getDependencePkg(this.arch);
.getDependencePkg(this.arch);
if (consumedPkgIdList != null) { if (consumedPkgIdList != null) {
headerFileList = depPkgToAutogenH(consumedPkgIdList, moduleType); headerFileList = depPkgToAutogenH(consumedPkgIdList, moduleType);
item = headerFileList.iterator(); item = headerFileList.iterator();
@ -348,8 +348,7 @@ public class AutoGen {
// //
// Write library class's related *.h file to autogen.h. // Write library class's related *.h file to autogen.h.
// //
String[] libClassList = SurfaceAreaQuery String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED,this.arch);
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED,this.arch);
if (libClassList != null) { if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList); libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator(); item = libClassIncludeH.iterator();
@ -358,8 +357,7 @@ public class AutoGen {
} }
} }
libClassList = SurfaceAreaQuery libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
if (libClassList != null) { if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList); libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator(); item = libClassIncludeH.iterator();
@ -373,7 +371,7 @@ public class AutoGen {
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
// {DEST_DIR_DRBUG}/FlashMap.h // {DEST_DIR_DRBUG}/FlashMap.h
// //
if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) { if (saq.isHaveTianoR8FlashMap()) {
fileBuffer.append(CommonDefinition.INCLUDE); fileBuffer.append(CommonDefinition.INCLUDE);
fileBuffer.append(" <"); fileBuffer.append(" <");
fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n"); fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");
@ -427,7 +425,7 @@ public class AutoGen {
// process <Externs> it should be set the DOC as the Native MSA info. // process <Externs> it should be set the DOC as the Native MSA info.
// //
Map<String, XmlObject> doc = GlobalData.getNativeMsa(this.moduleId); Map<String, XmlObject> doc = GlobalData.getNativeMsa(this.moduleId);
SurfaceAreaQuery.push(doc); saq.push(doc);
// //
// Write <Extern> // Write <Extern>
// DriverBinding/ComponentName/DriverConfiguration/DriverDialog // DriverBinding/ComponentName/DriverConfiguration/DriverDialog
@ -445,24 +443,23 @@ public class AutoGen {
// //
// Write EntryPoint to autgoGen.c // Write EntryPoint to autgoGen.c
// //
String[] entryPointList = SurfaceAreaQuery.getModuleEntryPointArray(); String[] entryPointList = saq.getModuleEntryPointArray();
String[] unloadImageList = SurfaceAreaQuery.getModuleUnloadImageArray(); String[] unloadImageList = saq.getModuleUnloadImageArray();
EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList),
CommonDefinition.remDupString(unloadImageList), CommonDefinition.remDupString(unloadImageList),
fileBuffer); fileBuffer);
pcdDriverType = SurfaceAreaQuery.getPcdDriverType(); pcdDriverType = saq.getPcdDriverType();
// //
// Restore the DOC which include the FPD module info. // Restore the DOC which include the FPD module info.
// //
SurfaceAreaQuery.pop(); saq.pop();
// //
// Write Guid to autogen.c // Write Guid to autogen.c
// //
String guid = CommonDefinition.formatGuidName(SurfaceAreaQuery String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());
.getModuleGuid());
fileBuffer fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {"); .append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");
@ -490,7 +487,7 @@ public class AutoGen {
// //
// Get module dependent Package identification. // Get module dependent Package identification.
// //
PackageIdentification[] packages = SurfaceAreaQuery.getDependencePkg(this.arch); PackageIdentification[] packages = saq.getDependencePkg(this.arch);
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
if (!this.mDepPkgList.contains(packages[i])) { if (!this.mDepPkgList.contains(packages[i])) {
this.mDepPkgList.add(packages[i]); this.mDepPkgList.add(packages[i]);
@ -572,7 +569,7 @@ public class AutoGen {
// be get from module surface area instead of hard code. // be get from module surface area instead of hard code.
// //
fileBuffer.append(CommonDefinition.AUTOGENHBEGIN); fileBuffer.append(CommonDefinition.AUTOGENHBEGIN);
String[] specList = SurfaceAreaQuery.getExternSpecificaiton(); String[] specList = saq.getExternSpecificaiton();
for (int i = 0; i < specList.length; i++) { for (int i = 0; i < specList.length; i++) {
fileBuffer.append(CommonDefinition.DEFINE + specList[i] fileBuffer.append(CommonDefinition.DEFINE + specList[i]
+ "\r\n"); + "\r\n");
@ -583,8 +580,8 @@ public class AutoGen {
// //
// Write consumed package's mdouleInfo related *.h file to autogen.h. // Write consumed package's mdouleInfo related *.h file to autogen.h.
// //
moduleType = SurfaceAreaQuery.getModuleType(); moduleType = saq.getModuleType();
PackageIdentification[] cosumedPkglist = SurfaceAreaQuery PackageIdentification[] cosumedPkglist = saq
.getDependencePkg(this.arch); .getDependencePkg(this.arch);
headerFileList = depPkgToAutogenH(cosumedPkglist, moduleType); headerFileList = depPkgToAutogenH(cosumedPkglist, moduleType);
item = headerFileList.iterator(); item = headerFileList.iterator();
@ -594,7 +591,7 @@ public class AutoGen {
// //
// Write library class's related *.h file to autogen.h // Write library class's related *.h file to autogen.h
// //
String[] libClassList = SurfaceAreaQuery String[] libClassList = saq
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch); .getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);
if (libClassList != null) { if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList); libClassIncludeH = LibraryClassToAutogenH(libClassList);
@ -604,7 +601,7 @@ public class AutoGen {
} }
} }
libClassList = SurfaceAreaQuery libClassList = saq
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch); .getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
if (libClassList != null) { if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList); libClassIncludeH = LibraryClassToAutogenH(libClassList);
@ -619,7 +616,7 @@ public class AutoGen {
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
// {DEST_DIR_DRBUG}/FlashMap.h // {DEST_DIR_DRBUG}/FlashMap.h
// //
if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) { if (saq.isHaveTianoR8FlashMap()) {
fileBuffer.append(CommonDefinition.INCLUDE); fileBuffer.append(CommonDefinition.INCLUDE);
fileBuffer.append(" <"); fileBuffer.append(" <");
fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n"); fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");
@ -672,7 +669,7 @@ public class AutoGen {
this.myPcdAutogen = new PCDAutoGenAction(moduleId, this.myPcdAutogen = new PCDAutoGenAction(moduleId,
arch, arch,
true, true,
SurfaceAreaQuery.getModulePcdEntryNameArray(), saq.getModulePcdEntryNameArray(),
pcdDriverType); pcdDriverType);
try { try {
this.myPcdAutogen.execute(); this.myPcdAutogen.execute();
@ -713,7 +710,7 @@ public class AutoGen {
// //
for (int i = 0; i < libClassList.length; i++) { for (int i = 0; i < libClassList.length; i++) {
includeName = GlobalData.getLibraryClassHeaderFiles( includeName = GlobalData.getLibraryClassHeaderFiles(
SurfaceAreaQuery.getDependencePkg(this.arch), saq.getDependencePkg(this.arch),
libClassList[i]); libClassList[i]);
if (includeName == null) { if (includeName == null) {
throw new AutoGenException("Can not find library class [" throw new AutoGenException("Can not find library class ["
@ -785,7 +782,7 @@ public class AutoGen {
void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer) void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer)
throws BuildException { throws BuildException {
String typeStr = SurfaceAreaQuery.getModuleType(); String typeStr = saq.getModuleType();
int unloadImageCount = 0; int unloadImageCount = 0;
int entryPointCount = 0; int entryPointCount = 0;
@ -1250,12 +1247,12 @@ public class AutoGen {
// then add those PPI ,and PPI Notify name to list. // then add those PPI ,and PPI Notify name to list.
// //
String[] ppiList = SurfaceAreaQuery.getPpiArray(this.arch); String[] ppiList = saq.getPpiArray(this.arch);
for (int i = 0; i < ppiList.length; i++) { for (int i = 0; i < ppiList.length; i++) {
this.mPpiList.add(ppiList[i]); this.mPpiList.add(ppiList[i]);
} }
String[] ppiNotifyList = SurfaceAreaQuery.getPpiNotifyArray(this.arch); String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);
for (int i = 0; i < ppiNotifyList.length; i++) { for (int i = 0; i < ppiNotifyList.length; i++) {
this.mPpiList.add(ppiNotifyList[i]); this.mPpiList.add(ppiNotifyList[i]);
} }
@ -1299,7 +1296,7 @@ public class AutoGen {
void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws BuildException { void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws BuildException {
String[] cNameGuid = null; String[] cNameGuid = null;
String[] protocolList = SurfaceAreaQuery.getProtocolArray(this.arch); String[] protocolList = saq.getProtocolArray(this.arch);
// //
// Add result to Autogen global list. // Add result to Autogen global list.
@ -1308,7 +1305,7 @@ public class AutoGen {
this.mProtocolList.add(protocolList[i]); this.mProtocolList.add(protocolList[i]);
} }
String[] protocolNotifyList = SurfaceAreaQuery String[] protocolNotifyList = saq
.getProtocolNotifyArray(this.arch); .getProtocolNotifyArray(this.arch);
for (int i = 0; i < protocolNotifyList.length; i++) { for (int i = 0; i < protocolNotifyList.length; i++) {
@ -1356,7 +1353,7 @@ public class AutoGen {
String[] cNameGuid = null; String[] cNameGuid = null;
String guidKeyWord = null; String guidKeyWord = null;
String[] guidList = SurfaceAreaQuery.getGuidEntryArray(this.arch); String[] guidList = saq.getGuidEntryArray(this.arch);
for (int i = 0; i < guidList.length; i++) { for (int i = 0; i < guidList.length; i++) {
this.mGuidList.add(guidList[i]); this.mGuidList.add(guidList[i]);
@ -1673,7 +1670,7 @@ public class AutoGen {
// 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC // 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC
// //
String[] drvBindList = SurfaceAreaQuery.getDriverBindingArray(); String[] drvBindList = saq.getDriverBindingArray();
// //
// If component name protocol,component configuration protocol, // If component name protocol,component configuration protocol,
@ -1684,9 +1681,9 @@ public class AutoGen {
return; return;
} }
String[] compNamList = SurfaceAreaQuery.getComponentNameArray(); String[] compNamList = saq.getComponentNameArray();
String[] compConfList = SurfaceAreaQuery.getDriverConfigArray(); String[] compConfList = saq.getDriverConfigArray();
String[] compDiagList = SurfaceAreaQuery.getDriverDiagArray(); String[] compDiagList = saq.getDriverDiagArray();
int BitMask = 0; int BitMask = 0;
@ -1826,8 +1823,8 @@ public class AutoGen {
// <ExitBootServiceCallBack> and add to setVirtualAddList // <ExitBootServiceCallBack> and add to setVirtualAddList
// exitBootServiceList. // exitBootServiceList.
// //
String[] setVirtuals = SurfaceAreaQuery.getSetVirtualAddressMapCallBackArray(); String[] setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
String[] exitBoots = SurfaceAreaQuery.getExitBootServicesCallBackArray(); String[] exitBoots = saq.getExitBootServicesCallBackArray();
if (setVirtuals != null) { if (setVirtuals != null) {
for (int j = 0; j < setVirtuals.length; j++) { for (int j = 0; j < setVirtuals.length; j++) {
this.setVirtalAddList.add(setVirtuals[j]); this.setVirtalAddList.add(setVirtuals[j]);
@ -1915,8 +1912,7 @@ public class AutoGen {
String[] setVirtuals = null; String[] setVirtuals = null;
String[] exitBoots = null; String[] exitBoots = null;
ModuleIdentification[] libraryIdList = SurfaceAreaQuery ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
.getLibraryInstance(this.arch);
try { try {
if (libraryIdList != null) { if (libraryIdList != null) {
// //
@ -1943,21 +1939,17 @@ public class AutoGen {
// //
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch); Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
SurfaceAreaQuery.push(libDoc); saq.push(libDoc);
// //
// Get <PPis>, <Protocols>, <Guids> list of this library // Get <PPis>, <Protocols>, <Guids> list of this library
// instance. // instance.
// //
String[] ppiList = SurfaceAreaQuery.getPpiArray(this.arch); String[] ppiList = saq.getPpiArray(this.arch);
String[] ppiNotifyList = SurfaceAreaQuery String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);
.getPpiNotifyArray(this.arch); String[] protocolList = saq.getProtocolArray(this.arch);
String[] protocolList = SurfaceAreaQuery String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);
.getProtocolArray(this.arch); String[] guidList = saq.getGuidEntryArray(this.arch);
String[] protocolNotifyList = SurfaceAreaQuery PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);
.getProtocolNotifyArray(this.arch);
String[] guidList = SurfaceAreaQuery
.getGuidEntryArray(this.arch);
PackageIdentification[] pkgList = SurfaceAreaQuery.getDependencePkg(this.arch);
// //
// Add those ppi, protocol, guid in global ppi, // Add those ppi, protocol, guid in global ppi,
@ -1993,17 +1985,15 @@ public class AutoGen {
// If not yet parse this library instance's constructor // If not yet parse this library instance's constructor
// element,parse it. // element,parse it.
// //
libConstructName = SurfaceAreaQuery libConstructName = saq.getLibConstructorName();
.getLibConstructorName(); libDestructName = saq.getLibDestructorName();
libDestructName = SurfaceAreaQuery
.getLibDestructorName();
// //
// Collect SetVirtualAddressMapCallBack and // Collect SetVirtualAddressMapCallBack and
// ExitBootServiceCallBack. // ExitBootServiceCallBack.
// //
setVirtuals = SurfaceAreaQuery.getSetVirtualAddressMapCallBackArray(); setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
exitBoots = SurfaceAreaQuery.getExitBootServicesCallBackArray(); exitBoots = saq.getExitBootServicesCallBackArray();
if (setVirtuals != null) { if (setVirtuals != null) {
for (int j = 0; j < setVirtuals.length; j++) { for (int j = 0; j < setVirtuals.length; j++) {
this.setVirtalAddList.add(setVirtuals[j]); this.setVirtalAddList.add(setVirtuals[j]);
@ -2014,7 +2004,7 @@ public class AutoGen {
this.exitBootServiceList.add(exitBoots[k]); this.exitBootServiceList.add(exitBoots[k]);
} }
} }
SurfaceAreaQuery.pop(); saq.pop();
// //
// Add dependent library instance constructor function. // Add dependent library instance constructor function.
// //

View File

@ -65,16 +65,15 @@ public class AutogenLibOrder {
// Add libraryInstance in to libInstanceList. // Add libraryInstance in to libInstanceList.
// //
Map<String, XmlObject> libDoc = GlobalData.getDoc(libraryList[i], arch); Map<String, XmlObject> libDoc = GlobalData.getDoc(libraryList[i], arch);
SurfaceAreaQuery.push(libDoc); SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc);
libInstanceNode = new LibraryInstanceNode (libraryList[i],SurfaceAreaQuery.getLibConstructorName(), SurfaceAreaQuery.getLibDestructorName()); libInstanceNode = new LibraryInstanceNode (libraryList[i],saq.getLibConstructorName(), saq.getLibDestructorName());
libInstanceList.add(libInstanceNode); libInstanceList.add(libInstanceNode);
// //
// Add library instance and consumed library class list to // Add library instance and consumed library class list to
// libInstanceMap. // libInstanceMap.
// //
libClassConsmList = SurfaceAreaQuery libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
if (libClassConsmList != null) { if (libClassConsmList != null) {
String[] classStr = new String[libClassConsmList.length]; String[] classStr = new String[libClassConsmList.length];
for (int k = 0; k < libClassConsmList.length; k++) { for (int k = 0; k < libClassConsmList.length; k++) {
@ -92,8 +91,7 @@ public class AutogenLibOrder {
// //
// Add library class and library instance map. // Add library class and library instance map.
// //
libClassDeclList = SurfaceAreaQuery libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
if (libClassDeclList != null) { if (libClassDeclList != null) {
for (int j = 0; j < libClassDeclList.length; j++) { for (int j = 0; j < libClassDeclList.length; j++) {
if (this.libClassMap.containsKey(libClassDeclList[j])) { if (this.libClassMap.containsKey(libClassDeclList[j])) {
@ -107,7 +105,6 @@ public class AutogenLibOrder {
} }
} }
} }
SurfaceAreaQuery.pop();
} }
// //

View File

@ -96,6 +96,8 @@ public class FpdParserTask extends Task {
/// ///
private Vector<Property> properties = new Vector<Property>(); private Vector<Property> properties = new Vector<Property>();
SurfaceAreaQuery saq = null;
private boolean isUnified = true; private boolean isUnified = true;
/** /**
@ -169,7 +171,7 @@ public class FpdParserTask extends Task {
// //
// Gen build.xml // Gen build.xml
// //
PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified); PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified, saq);
fileGenerator.genBuildFile(); fileGenerator.genBuildFile();
// //
@ -194,12 +196,12 @@ public class FpdParserTask extends Task {
File write FV.inf files error. File write FV.inf files error.
**/ **/
private void genFvInfFiles(String ffsCommonDir) throws BuildException { private void genFvInfFiles(String ffsCommonDir) throws BuildException {
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames(); String[] validFv = saq.getFpdValidImageNames();
for (int i = 0; i < validFv.length; i++) { for (int i = 0; i < validFv.length; i++) {
// //
// Get all global variables from FPD and set them to properties // Get all global variables from FPD and set them to properties
// //
String[][] globalVariables = SurfaceAreaQuery.getFpdGlobalVariable(); String[][] globalVariables = saq.getFpdGlobalVariable();
for (int j = 0; j < globalVariables.length; j++) { for (int j = 0; j < globalVariables.length; j++) {
getProject().setProperty(globalVariables[j][0], globalVariables[j][1]); getProject().setProperty(globalVariables[j][0], globalVariables[j][1]);
} }
@ -216,7 +218,7 @@ public class FpdParserTask extends Task {
// //
// Options // Options
// //
String[][] options = SurfaceAreaQuery.getFpdOptions(validFv[i]); String[][] options = saq.getFpdOptions(validFv[i]);
if (options.length > 0) { if (options.length > 0) {
bw.write("[options]"); bw.write("[options]");
bw.newLine(); bw.newLine();
@ -237,7 +239,7 @@ public class FpdParserTask extends Task {
// //
// Attributes; // Attributes;
// //
String[][] attributes = SurfaceAreaQuery.getFpdAttributes(validFv[i]); String[][] attributes = saq.getFpdAttributes(validFv[i]);
if (attributes.length > 0) { if (attributes.length > 0) {
bw.write("[attributes]"); bw.write("[attributes]");
bw.newLine(); bw.newLine();
@ -258,7 +260,7 @@ public class FpdParserTask extends Task {
// //
// Components // Components
// //
String[][] components = SurfaceAreaQuery.getFpdComponents(validFv[i]); String[][] components = saq.getFpdComponents(validFv[i]);
if (components.length > 0) { if (components.length > 0) {
bw.write("[components]"); bw.write("[components]");
bw.newLine(); bw.newLine();
@ -325,12 +327,12 @@ public class FpdParserTask extends Task {
Map<String, XmlObject> map = new HashMap<String, XmlObject>(); Map<String, XmlObject> map = new HashMap<String, XmlObject>();
map.put("PlatformSurfaceArea", doc); map.put("PlatformSurfaceArea", doc);
SurfaceAreaQuery.setDoc(map); saq = new SurfaceAreaQuery(map);
// //
// Initialize // Initialize
// //
platformId = SurfaceAreaQuery.getFpdHeader(); platformId = saq.getFpdHeader();
platformId.setFpdFile(fpdFile); platformId.setFpdFile(fpdFile);
getProject().setProperty("PLATFORM", platformId.getName()); getProject().setProperty("PLATFORM", platformId.getName());
getProject().setProperty("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/")); getProject().setProperty("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/"));
@ -340,17 +342,17 @@ public class FpdParserTask extends Task {
// //
// Build mode. User-defined output dir. // Build mode. User-defined output dir.
// //
String buildMode = SurfaceAreaQuery.getFpdIntermediateDirectories(); String buildMode = saq.getFpdIntermediateDirectories();
String userDefinedOutputDir = SurfaceAreaQuery.getFpdOutputDirectory(); String userDefinedOutputDir = saq.getFpdOutputDirectory();
OutputManager.getInstance().setup(userDefinedOutputDir, buildMode); OutputManager.getInstance().setup(userDefinedOutputDir, buildMode);
// //
// TBD. Deal PCD and BuildOption related Info // TBD. Deal PCD and BuildOption related Info
// //
GlobalData.setFpdBuildOptions(SurfaceAreaQuery.getFpdBuildOptions()); GlobalData.setFpdBuildOptions(saq.getFpdBuildOptions());
GlobalData.setToolChainPlatformInfo(SurfaceAreaQuery.getFpdToolChainInfo()); GlobalData.setToolChainPlatformInfo(saq.getFpdToolChainInfo());
// //
// Parse all list modules SA // Parse all list modules SA
@ -363,7 +365,7 @@ public class FpdParserTask extends Task {
parseToolChainFamilyOptions(); parseToolChainFamilyOptions();
parseToolChainOptions(); parseToolChainOptions();
SurfaceAreaQuery.setDoc(map); saq.push(map);
// //
// Pcd Collection. Call CollectPCDAction to collect pcd info. // Pcd Collection. Call CollectPCDAction to collect pcd info.
@ -379,7 +381,7 @@ public class FpdParserTask extends Task {
Parse all modules listed in FPD file. Parse all modules listed in FPD file.
**/ **/
private void parseModuleSAFiles() throws EdkException{ private void parseModuleSAFiles() throws EdkException{
Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = SurfaceAreaQuery.getFpdModules(); Map<FpdModuleIdentification, Map<String, XmlObject>> moduleSAs = saq.getFpdModules();
// //
// For every Module lists in FPD file. // For every Module lists in FPD file.
@ -397,8 +399,8 @@ public class FpdParserTask extends Task {
// //
// Put fpdModuleId to the corresponding FV // Put fpdModuleId to the corresponding FV
// //
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId)); saq.push(GlobalData.getDoc(fpdModuleId));
String fvBinding = SurfaceAreaQuery.getModuleFvBindingKeyword(); String fvBinding = saq.getModuleFvBindingKeyword();
fpdModuleId.setFvBinding(fvBinding); fpdModuleId.setFvBinding(fvBinding);
updateFvs(fvBinding, fpdModuleId); updateFvs(fvBinding, fpdModuleId);
@ -408,7 +410,7 @@ public class FpdParserTask extends Task {
// //
ModuleIdentification moduleId = fpdModuleId.getModule(); ModuleIdentification moduleId = fpdModuleId.getModule();
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename(); String baseName = saq.getModuleOutputFileBasename();
if (baseName == null) { if (baseName == null) {
baseName = moduleId.getName(); baseName = moduleId.getName();
@ -422,12 +424,12 @@ public class FpdParserTask extends Task {
// //
GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false)); GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true)); GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
SurfaceAreaQuery.pop(); saq.pop();
} }
} }
private ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException { private ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
String[][] options = SurfaceAreaQuery.getModuleBuildOptions(toolChainFamilyFlag); String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);
if (options == null || options.length == 0) { if (options == null || options.length == 0) {
return new ToolChainMap(); return new ToolChainMap();
} }
@ -435,7 +437,7 @@ public class FpdParserTask extends Task {
} }
private ToolChainMap parsePlatformBuildOptions(boolean toolChainFamilyFlag) throws EdkException { private ToolChainMap parsePlatformBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
String[][] options = SurfaceAreaQuery.getPlatformBuildOptions(toolChainFamilyFlag); String[][] options = saq.getPlatformBuildOptions(toolChainFamilyFlag);
if (options == null || options.length == 0) { if (options == null || options.length == 0) {
return new ToolChainMap(); return new ToolChainMap();
} }

View File

@ -62,6 +62,8 @@ public class PlatformBuildFileGenerator {
private boolean isUnified = true; private boolean isUnified = true;
private SurfaceAreaQuery saq = null;
private Project project; private Project project;
private String info = "DO NOT EDIT \n" private String info = "DO NOT EDIT \n"
@ -70,11 +72,12 @@ public class PlatformBuildFileGenerator {
+ "Abstract:\n" + "Abstract:\n"
+ "Auto-generated ANT build file for building EFI Modules and Platforms\n"; + "Auto-generated ANT build file for building EFI Modules and Platforms\n";
public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, Map<String, Set<FpdModuleIdentification>> fvs, boolean isUnified){ public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, Map<String, Set<FpdModuleIdentification>> fvs, boolean isUnified, SurfaceAreaQuery saq){
this.project = project; this.project = project;
this.outfiles = outfiles; this.outfiles = outfiles;
this.isUnified = isUnified; this.isUnified = isUnified;
this.fvs = fvs; this.fvs = fvs;
this.saq = saq;
this.platformName = project.getProperty("PLATFORM"); this.platformName = project.getProperty("PLATFORM");
} }
@ -197,7 +200,7 @@ public class PlatformBuildFileGenerator {
// //
// Get all valid FV name // Get all valid FV name
// //
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames(); String[] validFv = saq.getFpdValidImageNames();
// //
// For each valid FV, get all modules in sequence // For each valid FV, get all modules in sequence
@ -312,7 +315,7 @@ public class PlatformBuildFileGenerator {
String fvOutputDir = project.getProperty("BUILD_DIR") + File.separatorChar String fvOutputDir = project.getProperty("BUILD_DIR") + File.separatorChar
+ targetList[i] + "_" + targetList[i] + "_"
+ toolchainList[j] + File.separatorChar + "FV"; + toolchainList[j] + File.separatorChar + "FV";
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames(); String[] validFv = saq.getFpdValidImageNames();
for (int k = 0; k < validFv.length; k++) { for (int k = 0; k < validFv.length; k++) {
String inputFile = fvOutputDir + "" + File.separatorChar + validFv[k].toUpperCase() + ".inf"; String inputFile = fvOutputDir + "" + File.separatorChar + validFv[k].toUpperCase() + ".inf";
Element fvEle = document.createElement("genfvimage"); Element fvEle = document.createElement("genfvimage");
@ -507,7 +510,7 @@ public class PlatformBuildFileGenerator {
Element ele = document.createElement("target"); Element ele = document.createElement("target");
ele.setAttribute("name", "prebuild"); ele.setAttribute("name", "prebuild");
Node node = SurfaceAreaQuery.getFpdUserExtensionPreBuild(); Node node = saq.getFpdUserExtensionPreBuild();
if (node != null) { if (node != null) {
// //
// For every Target and ToolChain // For every Target and ToolChain
@ -551,7 +554,7 @@ public class PlatformBuildFileGenerator {
Element ele = document.createElement("target"); Element ele = document.createElement("target");
ele.setAttribute("name", "postbuild"); ele.setAttribute("name", "postbuild");
Node node = SurfaceAreaQuery.getFpdUserExtensionPostBuild(); Node node = saq.getFpdUserExtensionPostBuild();
if (node != null) { if (node != null) {
// //
// For every Target and ToolChain // For every Target and ToolChain

View File

@ -185,7 +185,7 @@ public class GlobalData {
List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList(); List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();
Iterator<DbPathAndFilename> iter = packages.iterator(); Iterator<DbPathAndFilename> iter = packages.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
String fileName = iter.next().getStringValue(); String fileName = iter.next().getStringValue().trim();
Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName)); Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));
packageList.add(spd.getPackageId()); packageList.add(spd.getPackageId());
spdTable.put(spd.getPackageId(), spd); spdTable.put(spd.getPackageId(), spd);
@ -199,7 +199,7 @@ public class GlobalData {
List<DbPathAndFilename> platforms = db.getFrameworkDatabase().getPlatformList().getFilenameList(); List<DbPathAndFilename> platforms = db.getFrameworkDatabase().getPlatformList().getFilenameList();
Iterator<DbPathAndFilename> iter = platforms.iterator(); Iterator<DbPathAndFilename> iter = platforms.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
String fileName = iter.next().getStringValue(); String fileName = iter.next().getStringValue().trim();
File fpdFile = new File(workspaceDir + File.separatorChar + fileName); File fpdFile = new File(workspaceDir + File.separatorChar + fileName);
if ( !fpdFile.exists() ) { if ( !fpdFile.exists() ) {
throw new BuildException("Platform file [" + fpdFile.getPath() + "] not exists. "); throw new BuildException("Platform file [" + fpdFile.getPath() + "] not exists. ");
@ -219,8 +219,8 @@ public class GlobalData {
// //
Map<String, XmlObject> fpdDocMap = new HashMap<String, XmlObject>(); Map<String, XmlObject> fpdDocMap = new HashMap<String, XmlObject>();
fpdDocMap.put("PlatformSurfaceArea", fpdDoc); fpdDocMap.put("PlatformSurfaceArea", fpdDoc);
SurfaceAreaQuery.setDoc(fpdDocMap); SurfaceAreaQuery saq = new SurfaceAreaQuery(fpdDocMap);
PlatformIdentification platformId = SurfaceAreaQuery.getFpdHeader(); PlatformIdentification platformId = saq.getFpdHeader();
platformId.setFpdFile(fpdFile); platformId.setFpdFile(fpdFile);
platformList.add(platformId); platformList.add(platformId);
} }

View File

@ -106,24 +106,24 @@ public class Spd {
// We can change Map to XmlObject // We can change Map to XmlObject
Map<String, XmlObject> spdDocMap = new HashMap<String, XmlObject>(); Map<String, XmlObject> spdDocMap = new HashMap<String, XmlObject>();
spdDocMap.put("PackageSurfaceArea", spdDoc); spdDocMap.put("PackageSurfaceArea", spdDoc);
SurfaceAreaQuery.setDoc(spdDocMap); SurfaceAreaQuery saq = new SurfaceAreaQuery(spdDocMap);
// //
// //
// //
packageId = SurfaceAreaQuery.getSpdHeader(); packageId = saq.getSpdHeader();
packageId.setSpdFile(packageFile); packageId.setSpdFile(packageFile);
// //
// initialize Msa Files // initialize Msa Files
// MSA file is absolute file path // MSA file is absolute file path
// //
String[] msaFilenames = SurfaceAreaQuery.getSpdMsaFile(); String[] msaFilenames = saq.getSpdMsaFile();
for (int i = 0; i < msaFilenames.length; i++){ for (int i = 0; i < msaFilenames.length; i++){
File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]); File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]);
Map<String, XmlObject> msaDoc = GlobalData.getNativeMsa( msaFile ); Map<String, XmlObject> msaDoc = GlobalData.getNativeMsa( msaFile );
SurfaceAreaQuery.push(msaDoc); saq.push(msaDoc);
ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader(); ModuleIdentification moduleId = saq.getMsaHeader();
SurfaceAreaQuery.pop(); saq.pop();
moduleId.setPackage(packageId); moduleId.setPackage(packageId);
moduleId.setMsaFile(msaFile); moduleId.setMsaFile(msaFile);
if (msaInfo.containsKey(moduleId)) { if (msaInfo.containsKey(moduleId)) {
@ -135,7 +135,7 @@ public class Spd {
// //
// initialize Package header files // initialize Package header files
// //
Map<String, String> packageHeaders = SurfaceAreaQuery.getSpdPackageHeaderFiles(); Map<String, String> packageHeaders = saq.getSpdPackageHeaderFiles();
Set keys = packageHeaders.keySet(); Set keys = packageHeaders.keySet();
Iterator iter = keys.iterator(); Iterator iter = keys.iterator();
while (iter.hasNext()){ while (iter.hasNext()){
@ -153,7 +153,7 @@ public class Spd {
// //
// initialize Guid Info // initialize Guid Info
// //
guidInfo.putAll(SurfaceAreaQuery.getSpdGuid()); guidInfo.putAll(saq.getSpdGuid());
// //
// For Pcd get TokenSpaceGuid // For Pcd get TokenSpaceGuid
@ -169,17 +169,17 @@ public class Spd {
// //
// initialize PPI info // initialize PPI info
// //
ppiInfo.putAll(SurfaceAreaQuery.getSpdPpi()); ppiInfo.putAll(saq.getSpdPpi());
// //
// initialize Protocol info // initialize Protocol info
// //
protocolInfo.putAll(SurfaceAreaQuery.getSpdProtocol()); protocolInfo.putAll(saq.getSpdProtocol());
// //
// initialize library class declaration // initialize library class declaration
// //
Map<String, String[]> libraryClassHeaders = SurfaceAreaQuery.getSpdLibraryClasses(); Map<String, String[]> libraryClassHeaders = saq.getSpdLibraryClasses();
keys = libraryClassHeaders.keySet(); keys = libraryClassHeaders.keySet();
iter = keys.iterator(); iter = keys.iterator();
while (iter.hasNext()){ while (iter.hasNext()){

View File

@ -80,36 +80,36 @@ import org.tianocore.build.autogen.CommonDefinition;
*/ */
public class SurfaceAreaQuery { public class SurfaceAreaQuery {
public static String prefix = "http://www.TianoCore.org/2006/Edk2.0"; public String prefix = "http://www.TianoCore.org/2006/Edk2.0";
// //
// Contains name/value pairs of Surface Area document object. The name is // Contains name/value pairs of Surface Area document object. The name is
// always the top level element name. // always the top level element name.
// //
private static Map<String, XmlObject> map = null; private Map<String, XmlObject> map = null;
// //
// mapStack is used to do nested query // mapStack is used to do nested query
// //
private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>(); private Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();
// //
// prefix of name space // prefix of name space
// //
private static String nsPrefix = "sans"; private String nsPrefix = "sans";
// //
// xmlbeans needs a name space for each Xpath element // xmlbeans needs a name space for each Xpath element
// //
private static String ns = null; private String ns = null;
// //
// keep the namep declaration for xmlbeans Xpath query // keep the namep declaration for xmlbeans Xpath query
// //
private static String queryDeclaration = null; private String queryDeclaration = null;
private static StringBuffer normQueryString = new StringBuffer(4096); private StringBuffer normQueryString = new StringBuffer(4096);
private static Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)"); private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");
/** /**
* Set a Surface Area document for query later * Set a Surface Area document for query later
@ -118,10 +118,10 @@ public class SurfaceAreaQuery {
* A Surface Area document in TopLevelElementName/XmlObject * A Surface Area document in TopLevelElementName/XmlObject
* format. * format.
*/ */
public static void setDoc(Map<String, XmlObject> map) { public SurfaceAreaQuery(Map<String, XmlObject> map) {
ns = prefix; ns = prefix;
queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; "; queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";
SurfaceAreaQuery.map = map; this.map = map;
} }
/** /**
@ -133,17 +133,17 @@ public class SurfaceAreaQuery {
* The TopLevelElementName/XmlObject format of a Surface Area * The TopLevelElementName/XmlObject format of a Surface Area
* document. * document.
*/ */
public static void push(Map<String, XmlObject> newMap) { public void push(Map<String, XmlObject> newMap) {
mapStack.push(SurfaceAreaQuery.map); mapStack.push(this.map);
SurfaceAreaQuery.map = newMap; this.map = newMap;
} }
/** /**
* Discard current used Surface Area document and use the top document in * Discard current used Surface Area document and use the top document in
* stack instead. * stack instead.
*/ */
public static void pop() { public void pop() {
SurfaceAreaQuery.map = mapStack.pop(); this.map = mapStack.pop();
} }
// / // /
@ -152,7 +152,7 @@ public class SurfaceAreaQuery {
// / selectPath(). For example, converting /MsaHeader/ModuleType to // / selectPath(). For example, converting /MsaHeader/ModuleType to
// / /ns:MsaHeader/ns:ModuleType // / /ns:MsaHeader/ns:ModuleType
// / // /
private static String normalizeQueryString(String[] exp, String from) { private String normalizeQueryString(String[] exp, String from) {
normQueryString.setLength(0); normQueryString.setLength(0);
int i = 0; int i = 0;
@ -194,7 +194,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns NULL if nothing is at the specified xpath * @returns NULL if nothing is at the specified xpath
*/ */
public static Object[] get(String[] xPath) { public Object[] get(String[] xPath) {
if (map == null) { if (map == null) {
return null; return null;
} }
@ -234,7 +234,7 @@ public class SurfaceAreaQuery {
* @returns An array of XmlObject if elements are found at the given xpath * @returns An array of XmlObject if elements are found at the given xpath
* @returns NULL if nothing is found at the given xpath * @returns NULL if nothing is found at the given xpath
*/ */
public static Object[] get(String rootName, String[] xPath) { public Object[] get(String rootName, String[] xPath) {
if (map == null) { if (map == null) {
return null; return null;
} }
@ -269,7 +269,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns NULL if nothing is found at the known xpath * @returns NULL if nothing is found at the known xpath
*/ */
public static String[][] getSourceFiles(String arch) { public String[][] getSourceFiles(String arch) {
String[] xPath; String[] xPath;
Object[] returns; Object[] returns;
@ -304,7 +304,7 @@ public class SurfaceAreaQuery {
* @returns Directory names array if elements are found at the known xpath * @returns Directory names array if elements are found at the known xpath
* @returns Empty if nothing is found at the known xpath * @returns Empty if nothing is found at the known xpath
*/ */
public static String getFpdOutputDirectory() { public String getFpdOutputDirectory() {
String[] xPath = new String[] { "/PlatformDefinitions" }; String[] xPath = new String[] { "/PlatformDefinitions" };
Object[] returns = get("PlatformSurfaceArea", xPath); Object[] returns = get("PlatformSurfaceArea", xPath);
@ -315,7 +315,7 @@ public class SurfaceAreaQuery {
return item.getOutputDirectory(); return item.getOutputDirectory();
} }
public static String getFpdIntermediateDirectories() { public String getFpdIntermediateDirectories() {
String[] xPath = new String[] { "/PlatformDefinitions" }; String[] xPath = new String[] { "/PlatformDefinitions" };
Object[] returns = get("PlatformSurfaceArea", xPath); Object[] returns = get("PlatformSurfaceArea", xPath);
@ -331,7 +331,7 @@ public class SurfaceAreaQuery {
} }
} }
public static String getModuleFfsKeyword() { public String getModuleFfsKeyword() {
String[] xPath = new String[] { "/" }; String[] xPath = new String[] { "/" };
Object[] returns = get("ModuleSaBuildOptions", xPath); Object[] returns = get("ModuleSaBuildOptions", xPath);
@ -342,7 +342,7 @@ public class SurfaceAreaQuery {
return item.getFfsFormatKey(); return item.getFfsFormatKey();
} }
public static String getModuleFvBindingKeyword() { public String getModuleFvBindingKeyword() {
String[] xPath = new String[] { "/" }; String[] xPath = new String[] { "/" };
Object[] returns = get("ModuleSaBuildOptions", xPath); Object[] returns = get("ModuleSaBuildOptions", xPath);
@ -353,7 +353,7 @@ public class SurfaceAreaQuery {
return item.getFvBinding(); return item.getFvBinding();
} }
public static List getModuleSupportedArchs() { public List getModuleSupportedArchs() {
String[] xPath = new String[] { "/" }; String[] xPath = new String[] { "/" };
Object[] returns = get("ModuleDefinitions", xPath); Object[] returns = get("ModuleDefinitions", xPath);
@ -364,7 +364,7 @@ public class SurfaceAreaQuery {
return item.getSupportedArchitectures(); return item.getSupportedArchitectures();
} }
public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() { public BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {
String[] xPath = new String[] {"/Ffs"}; String[] xPath = new String[] {"/Ffs"};
Object[] returns = get("BuildOptions", xPath); Object[] returns = get("BuildOptions", xPath);
@ -374,7 +374,7 @@ public class SurfaceAreaQuery {
return (BuildOptionsDocument.BuildOptions.Ffs[])returns; return (BuildOptionsDocument.BuildOptions.Ffs[])returns;
} }
public static String getModuleOutputFileBasename() { public String getModuleOutputFileBasename() {
String[] xPath = new String[] { "/" }; String[] xPath = new String[] { "/" };
Object[] returns = get("ModuleDefinitions", xPath); Object[] returns = get("ModuleDefinitions", xPath);
@ -398,7 +398,7 @@ public class SurfaceAreaQuery {
* *
* @returns Empty array if nothing is there * @returns Empty array if nothing is there
*/ */
public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) { public String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {
String target = null; String target = null;
String toolchain = null; String toolchain = null;
String toolchainFamily = null; String toolchainFamily = null;
@ -482,7 +482,7 @@ public class SurfaceAreaQuery {
return result; return result;
} }
public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) { public String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {
String[] xPath; String[] xPath;
if (toolChainFamilyFlag == true) { if (toolChainFamilyFlag == true) {
@ -497,7 +497,7 @@ public class SurfaceAreaQuery {
return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag); return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);
} }
public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) { public String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {
String[] xPath; String[] xPath;
if (toolChainFamilyFlag == true) { if (toolChainFamilyFlag == true) {
@ -513,7 +513,7 @@ public class SurfaceAreaQuery {
return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag); return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag);
} }
public static ToolChainInfo getFpdToolChainInfo() { public ToolChainInfo getFpdToolChainInfo() {
String[] xPath = new String[] { "/PlatformDefinitions" }; String[] xPath = new String[] { "/PlatformDefinitions" };
Object[] returns = get("PlatformSurfaceArea", xPath); Object[] returns = get("PlatformSurfaceArea", xPath);
@ -535,7 +535,7 @@ public class SurfaceAreaQuery {
* @returns The module type name if elements are found at the known xpath * @returns The module type name if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String getModuleType() { public String getModuleType() {
String[] xPath = new String[] { "/ModuleType" }; String[] xPath = new String[] { "/ModuleType" };
Object[] returns = get(xPath); Object[] returns = get(xPath);
@ -556,7 +556,7 @@ public class SurfaceAreaQuery {
* @returns package name list if elements are found at the known xpath * @returns package name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static PackageIdentification[] getDependencePkg(String arch) { public PackageIdentification[] getDependencePkg(String arch) {
String[] xPath; String[] xPath;
String packageGuid = null; String packageGuid = null;
String packageVersion = null; String packageVersion = null;
@ -604,7 +604,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getLibraryClasses(String usage, String arch) { public String[] getLibraryClasses(String usage, String arch) {
String[] xPath; String[] xPath;
if (usage == null || usage.equals("")) { if (usage == null || usage.equals("")) {
xPath = new String[] { "/LibraryClass" }; xPath = new String[] { "/LibraryClass" };
@ -639,7 +639,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getModuleEntryPointArray() { public String[] getModuleEntryPointArray() {
String[] xPath = new String[] { "/Extern/ModuleEntryPoint" }; String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };
Object[] returns = get("Externs", xPath); Object[] returns = get("Externs", xPath);
@ -666,7 +666,7 @@ public class SurfaceAreaQuery {
* @returns Protocol String list if elements are found at the known xpath * @returns Protocol String list if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getProtocolArray(String arch, String usage) { public String[] getProtocolArray(String arch, String usage) {
String[] xPath; String[] xPath;
String usageXpath = ""; String usageXpath = "";
String archXpath = ""; String archXpath = "";
@ -706,7 +706,7 @@ public class SurfaceAreaQuery {
* @returns Protocol String list if elements are found at the known xpath * @returns Protocol String list if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getProtocolArray(String arch) { public String[] getProtocolArray(String arch) {
String[] xPath; String[] xPath;
if (arch == null || arch.equals("")) { if (arch == null || arch.equals("")) {
@ -745,7 +745,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getProtocolNotifyArray(String arch) { public String[] getProtocolNotifyArray(String arch) {
String[] xPath; String[] xPath;
if (arch == null || arch.equals("")) { if (arch == null || arch.equals("")) {
@ -784,7 +784,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getProtocolNotifyArray(String arch, String usage) { public String[] getProtocolNotifyArray(String arch, String usage) {
String[] xPath; String[] xPath;
String usageXpath; String usageXpath;
@ -822,7 +822,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getModuleUnloadImageArray() { public String[] getModuleUnloadImageArray() {
String[] xPath = new String[] { "/Extern/ModuleUnloadImage" }; String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };
Object[] returns = get("Externs", xPath); Object[] returns = get("Externs", xPath);
@ -846,7 +846,7 @@ public class SurfaceAreaQuery {
* @returns Extern objects list if elements are found at the known xpath * @returns Extern objects list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static ExternsDocument.Externs.Extern[] getExternArray() { public ExternsDocument.Externs.Extern[] getExternArray() {
String[] xPath = new String[] { "/Extern" }; String[] xPath = new String[] { "/Extern" };
Object[] returns = get("Externs", xPath); Object[] returns = get("Externs", xPath);
@ -866,7 +866,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getPpiNotifyArray(String arch) { public String[] getPpiNotifyArray(String arch) {
String[] xPath; String[] xPath;
if (arch == null || arch.equals("")) { if (arch == null || arch.equals("")) {
@ -907,7 +907,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getPpiNotifyArray(String arch, String usage) { public String[] getPpiNotifyArray(String arch, String usage) {
String[] xPath; String[] xPath;
String usageXpath; String usageXpath;
@ -947,7 +947,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getPpiArray(String arch) { public String[] getPpiArray(String arch) {
String[] xPath; String[] xPath;
if (arch == null || arch.equals("")) { if (arch == null || arch.equals("")) {
@ -986,7 +986,7 @@ public class SurfaceAreaQuery {
* @returns String[] if elements are found at the known xpath * @returns String[] if elements are found at the known xpath
* @returns String[0] if nothing is there * @returns String[0] if nothing is there
*/ */
public static String[] getPpiArray(String arch, String usage) { public String[] getPpiArray(String arch, String usage) {
String[] xPath; String[] xPath;
String usageXpath; String usageXpath;
@ -1026,7 +1026,7 @@ public class SurfaceAreaQuery {
* @returns GuidEntry objects list if elements are found at the known xpath * @returns GuidEntry objects list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getGuidEntryArray(String arch) { public String[] getGuidEntryArray(String arch) {
String[] xPath; String[] xPath;
if (arch == null || arch.equals("")) { if (arch == null || arch.equals("")) {
@ -1065,7 +1065,7 @@ public class SurfaceAreaQuery {
* @returns GuidEntry objects list if elements are found at the known xpath * @returns GuidEntry objects list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getGuidEntryArray(String arch, String usage) { public String[] getGuidEntryArray(String arch, String usage) {
String[] xPath; String[] xPath;
String archXpath; String archXpath;
String usageXpath; String usageXpath;
@ -1107,7 +1107,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static ModuleIdentification[] getLibraryInstance(String arch) { public ModuleIdentification[] getLibraryInstance(String arch) {
String[] xPath; String[] xPath;
String saGuid = null; String saGuid = null;
String saVersion = null; String saVersion = null;
@ -1156,7 +1156,7 @@ public class SurfaceAreaQuery {
// / This method is used for retrieving the elements information which has // / This method is used for retrieving the elements information which has
// / CName sub-element // / CName sub-element
// / // /
private static String[] getCNames(String from, String xPath[]) { private String[] getCNames(String from, String xPath[]) {
Object[] returns = get(from, xPath); Object[] returns = get(from, xPath);
if (returns == null || returns.length == 0) { if (returns == null || returns.length == 0) {
return null; return null;
@ -1177,7 +1177,7 @@ public class SurfaceAreaQuery {
* @returns constructor name list if elements are found at the known xpath * @returns constructor name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String getLibConstructorName() { public String getLibConstructorName() {
String[] xPath = new String[] { "/Extern/Constructor" }; String[] xPath = new String[] { "/Extern/Constructor" };
Object[] returns = get("Externs", xPath); Object[] returns = get("Externs", xPath);
@ -1195,7 +1195,7 @@ public class SurfaceAreaQuery {
* @returns destructor name list if elements are found at the known xpath * @returns destructor name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String getLibDestructorName() { public String getLibDestructorName() {
String[] xPath = new String[] { "/Extern/Destructor" }; String[] xPath = new String[] { "/Extern/Destructor" };
Object[] returns = get("Externs", xPath); Object[] returns = get("Externs", xPath);
@ -1216,7 +1216,7 @@ public class SurfaceAreaQuery {
* @returns DriverBinding name list if elements are found at the known xpath * @returns DriverBinding name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getDriverBindingArray() { public String[] getDriverBindingArray() {
String[] xPath = new String[] { "/Extern/DriverBinding" }; String[] xPath = new String[] { "/Extern/DriverBinding" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1227,7 +1227,7 @@ public class SurfaceAreaQuery {
* @returns ComponentName name list if elements are found at the known xpath * @returns ComponentName name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getComponentNameArray() { public String[] getComponentNameArray() {
String[] xPath = new String[] { "/Extern/ComponentName" }; String[] xPath = new String[] { "/Extern/ComponentName" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1238,7 +1238,7 @@ public class SurfaceAreaQuery {
* @returns DriverConfig name list if elements are found at the known xpath * @returns DriverConfig name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getDriverConfigArray() { public String[] getDriverConfigArray() {
String[] xPath = new String[] { "/Extern/DriverConfig" }; String[] xPath = new String[] { "/Extern/DriverConfig" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1249,7 +1249,7 @@ public class SurfaceAreaQuery {
* @returns DriverDiag name list if elements are found at the known xpath * @returns DriverDiag name list if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getDriverDiagArray() { public String[] getDriverDiagArray() {
String[] xPath = new String[] { "/Extern/DriverDiag" }; String[] xPath = new String[] { "/Extern/DriverDiag" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1261,7 +1261,7 @@ public class SurfaceAreaQuery {
* the known xpath * the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getSetVirtualAddressMapCallBackArray() { public String[] getSetVirtualAddressMapCallBackArray() {
String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" }; String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1273,7 +1273,7 @@ public class SurfaceAreaQuery {
* known xpath * known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[] getExitBootServicesCallBackArray() { public String[] getExitBootServicesCallBackArray() {
String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" }; String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
@ -1284,7 +1284,7 @@ public class SurfaceAreaQuery {
@return CommonDefinition.PCD_DRIVER_TYPE the type of current driver @return CommonDefinition.PCD_DRIVER_TYPE the type of current driver
**/ **/
public static CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() { public CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() {
String[] xPath = new String[] {"/PcdIsDriver"}; String[] xPath = new String[] {"/PcdIsDriver"};
Object[] results = get ("Externs", xPath); Object[] results = get ("Externs", xPath);
@ -1308,7 +1308,7 @@ public class SurfaceAreaQuery {
* @returns ModuleSA objects list if elements are found at the known xpath * @returns ModuleSA objects list if elements are found at the known xpath
* @returns Empty ModuleSA list if nothing is there * @returns Empty ModuleSA list if nothing is there
*/ */
public static Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() { public Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" }; String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
Object[] result = get("PlatformSurfaceArea", xPath); Object[] result = get("PlatformSurfaceArea", xPath);
String arch = null; String arch = null;
@ -1399,7 +1399,7 @@ public class SurfaceAreaQuery {
* @returns valid iamges name list if elements are found at the known xpath * @returns valid iamges name list if elements are found at the known xpath
* @returns empty list if nothing is there * @returns empty list if nothing is there
*/ */
public static String[] getFpdValidImageNames() { public String[] getFpdValidImageNames() {
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" }; String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1415,7 +1415,7 @@ public class SurfaceAreaQuery {
return result; return result;
} }
public static Node getFpdUserExtensionPreBuild() { public Node getFpdUserExtensionPreBuild() {
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" }; String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1427,7 +1427,7 @@ public class SurfaceAreaQuery {
return a.getDomNode(); return a.getDomNode();
} }
public static Node getFpdUserExtensionPostBuild() { public Node getFpdUserExtensionPostBuild() {
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" }; String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1448,7 +1448,7 @@ public class SurfaceAreaQuery {
* @returns option name/value list if elements are found at the known xpath * @returns option name/value list if elements are found at the known xpath
* @returns empty list if nothing is there * @returns empty list if nothing is there
*/ */
public static String[][] getFpdOptions(String fvName) { public String[][] getFpdOptions(String fvName) {
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='" String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"
+ fvName + "']/FvImageOptions" }; + fvName + "']/FvImageOptions" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1476,7 +1476,7 @@ public class SurfaceAreaQuery {
} }
public static XmlObject getFpdBuildOptions() { public XmlObject getFpdBuildOptions() {
String[] xPath = new String[] { "/BuildOptions" }; String[] xPath = new String[] { "/BuildOptions" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1487,7 +1487,7 @@ public class SurfaceAreaQuery {
return (XmlObject)queryResult[0]; return (XmlObject)queryResult[0];
} }
public static PlatformIdentification getFpdHeader() { public PlatformIdentification getFpdHeader() {
String[] xPath = new String[] { "/PlatformHeader" }; String[] xPath = new String[] { "/PlatformHeader" };
Object[] returns = get("PlatformSurfaceArea", xPath); Object[] returns = get("PlatformSurfaceArea", xPath);
@ -1516,7 +1516,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns empty list if nothing is there * @returns empty list if nothing is there
*/ */
public static String[][] getFpdAttributes(String fvName) { public String[][] getFpdAttributes(String fvName) {
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='" String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"
+ fvName + "']/FvImageOptions" }; + fvName + "']/FvImageOptions" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1549,7 +1549,7 @@ public class SurfaceAreaQuery {
* @returns file name if elements are found at the known xpath * @returns file name if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String getFlashDefinitionFile() { public String getFlashDefinitionFile() {
String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" }; String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
@ -1561,7 +1561,7 @@ public class SurfaceAreaQuery {
return filename.getStringValue(); return filename.getStringValue();
} }
public static String[][] getFpdGlobalVariable() { public String[][] getFpdGlobalVariable() {
String[] xPath = new String[] { "/Flash/FvImages/NameValue" }; String[] xPath = new String[] { "/Flash/FvImages/NameValue" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
if (queryResult == null) { if (queryResult == null) {
@ -1587,7 +1587,7 @@ public class SurfaceAreaQuery {
* @returns name/value pairs list if elements are found at the known xpath * @returns name/value pairs list if elements are found at the known xpath
* @returns empty list if nothing is there * @returns empty list if nothing is there
*/ */
public static String[][] getFpdComponents(String fvName) { public String[][] getFpdComponents(String fvName) {
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" }; String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" };
Object[] queryResult = get("PlatformSurfaceArea", xPath); Object[] queryResult = get("PlatformSurfaceArea", xPath);
if (queryResult == null) { if (queryResult == null) {
@ -1620,7 +1620,7 @@ public class SurfaceAreaQuery {
* xpath * xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String[][] getPcdTokenArray() { public String[][] getPcdTokenArray() {
String[] xPath = new String[] { "/PcdData" }; String[] xPath = new String[] { "/PcdData" };
Object[] returns = get("PCDs", xPath); Object[] returns = get("PCDs", xPath);
@ -1637,7 +1637,7 @@ public class SurfaceAreaQuery {
* @return * @return
* @return * @return
*/ */
public static ModuleIdentification getMsaHeader() { public ModuleIdentification getMsaHeader() {
String[] xPath = new String[] { "/" }; String[] xPath = new String[] { "/" };
Object[] returns = get("MsaHeader", xPath); Object[] returns = get("MsaHeader", xPath);
@ -1673,7 +1673,7 @@ public class SurfaceAreaQuery {
* *
*/ */
public static String[] getExternSpecificaiton() { public String[] getExternSpecificaiton() {
String[] xPath = new String[] { "/Specification" }; String[] xPath = new String[] { "/Specification" };
Object[] queryResult = get("Externs", xPath); Object[] queryResult = get("Externs", xPath);
@ -1696,7 +1696,7 @@ public class SurfaceAreaQuery {
* @return String[][3] The string sequence is ModuleName, ModuleGuid, * @return String[][3] The string sequence is ModuleName, ModuleGuid,
* ModuleVersion, MsaFile String[0][] If no msafile in SPD * ModuleVersion, MsaFile String[0][] If no msafile in SPD
*/ */
public static String[] getSpdMsaFile() { public String[] getSpdMsaFile() {
String[] xPath = new String[] { "/MsaFiles" }; String[] xPath = new String[] { "/MsaFiles" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1712,7 +1712,7 @@ public class SurfaceAreaQuery {
/** /**
* Reteive * Reteive
*/ */
public static Map<String, String[]> getSpdLibraryClasses() { public Map<String, String[]> getSpdLibraryClasses() {
String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" }; String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1737,7 +1737,7 @@ public class SurfaceAreaQuery {
/** /**
* Reteive * Reteive
*/ */
public static Map<String, String> getSpdPackageHeaderFiles() { public Map<String, String> getSpdPackageHeaderFiles() {
String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" }; String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1759,7 +1759,7 @@ public class SurfaceAreaQuery {
return packageIncludeMap; return packageIncludeMap;
} }
public static PackageIdentification getSpdHeader() { public PackageIdentification getSpdHeader() {
String[] xPath = new String[] { "/SpdHeader" }; String[] xPath = new String[] { "/SpdHeader" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1782,7 +1782,7 @@ public class SurfaceAreaQuery {
/** /**
* Reteive * Reteive
*/ */
public static Map<String, String[]> getSpdGuid() { public Map<String, String[]> getSpdGuid() {
String[] xPath = new String[] { "/GuidDeclarations/Entry" }; String[] xPath = new String[] { "/GuidDeclarations/Entry" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1811,7 +1811,7 @@ public class SurfaceAreaQuery {
/** /**
* Reteive * Reteive
*/ */
public static Map<String, String[]> getSpdProtocol() { public Map<String, String[]> getSpdProtocol() {
String[] xPath = new String[] { "/ProtocolDeclarations/Entry" }; String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1847,7 +1847,7 @@ public class SurfaceAreaQuery {
* Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI
* entry in SPD. * entry in SPD.
*/ */
public static Map<String, String[]> getSpdPpi() { public Map<String, String[]> getSpdPpi() {
String[] xPath = new String[] { "/PpiDeclarations/Entry" }; String[] xPath = new String[] { "/PpiDeclarations/Entry" };
Object[] returns = get("PackageSurfaceArea", xPath); Object[] returns = get("PackageSurfaceArea", xPath);
@ -1877,7 +1877,7 @@ public class SurfaceAreaQuery {
* @returns GUILD string if elements are found at the known xpath * @returns GUILD string if elements are found at the known xpath
* @returns null if nothing is there * @returns null if nothing is there
*/ */
public static String getModuleGuid() { public String getModuleGuid() {
String[] xPath = new String[] { "" }; String[] xPath = new String[] { "" };
Object[] returns = get("MsaHeader", xPath); Object[] returns = get("MsaHeader", xPath);
@ -1893,7 +1893,7 @@ public class SurfaceAreaQuery {
// //
// For new Pcd // For new Pcd
// //
public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() { public ModuleSADocument.ModuleSA[] getFpdModuleSAs() {
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" }; String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };
Object[] result = get("PlatformSurfaceArea", xPath); Object[] result = get("PlatformSurfaceArea", xPath);
if (result != null) { if (result != null) {
@ -1908,7 +1908,7 @@ public class SurfaceAreaQuery {
@return String[] @return String[]
**/ **/
public static String[] getModulePcdEntryNameArray() { public String[] getModulePcdEntryNameArray() {
PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null; PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;
String[] results; String[] results;
int index; int index;
@ -1933,7 +1933,7 @@ public class SurfaceAreaQuery {
@return boolean @return boolean
**/ **/
public static boolean contains(List list, String str) { public boolean contains(List list, String str) {
if (list == null || list.size()== 0) { if (list == null || list.size()== 0) {
return true; return true;
} }
@ -1948,7 +1948,7 @@ public class SurfaceAreaQuery {
return false; return false;
} }
public static boolean isHaveTianoR8FlashMap(){ public boolean isHaveTianoR8FlashMap(){
String[] xPath = new String[] {"/"}; String[] xPath = new String[] {"/"};
Object[] returns = get ("Externs", xPath); Object[] returns = get ("Externs", xPath);