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

View File

@ -108,6 +108,8 @@ public class GenBuildTask extends Ant {
private Vector<Property> properties = new Vector<Property>();
private boolean isSingleModuleBuild = false;
private SurfaceAreaQuery saq = null;
/**
Public construct method. It is necessary for ANT task.
@ -154,14 +156,14 @@ public class GenBuildTask extends Ant {
moduleId = new ModuleIdentification(moduleGuid, moduleVersion);
moduleId.setPackage(packageId);
Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);
SurfaceAreaQuery.setDoc(doc);
moduleId = SurfaceAreaQuery.getMsaHeader();
saq = new SurfaceAreaQuery(doc);
moduleId = saq.getMsaHeader();
} else {
Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);
SurfaceAreaQuery.setDoc(doc);
moduleId = SurfaceAreaQuery.getMsaHeader();
saq = new SurfaceAreaQuery(doc);
moduleId = saq.getMsaHeader();
}
String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null);
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
if (producedLibraryClasses.length == 0) {
moduleId.setLibrary(false);
} else {
@ -221,7 +223,7 @@ public class GenBuildTask extends Ant {
//
// Judge if arch is all supported by current module. If not, throw Exception.
//
List moduleSupportedArchs = SurfaceAreaQuery.getModuleSupportedArchs();
List moduleSupportedArchs = saq.getModuleSupportedArchs();
if (moduleSupportedArchs != null) {
for (int k = 0; k < archList.length; k++) {
if ( ! moduleSupportedArchs.contains(archList[k])) {
@ -277,7 +279,7 @@ public class GenBuildTask extends Ant {
System.out.println("Build " + moduleId + " start >>>");
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
@ -377,7 +379,7 @@ public class GenBuildTask extends Ant {
// MODULE_DIR, MODULE_RELATIVE_DIR
//
PropertyManager.setProperty("MODULE", moduleId.getName());
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();
String baseName = saq.getModuleOutputFileBasename();
if (baseName == null) {
PropertyManager.setProperty("BASE_NAME", moduleId.getName());
} else {
@ -539,13 +541,11 @@ public class GenBuildTask extends Ant {
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());
AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq);
autogen.genAutogen();
//
// Get compiler flags
//
@ -559,7 +559,7 @@ public class GenBuildTask extends Ant {
//
// Prepare LIBS
//
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());
ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());
String propertyLibs = "";
for (int i = 0; i < libinstances.length; i++) {
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
// TBD
//
String ffsKeyword = SurfaceAreaQuery.getModuleFfsKeyword();
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes);
String ffsKeyword = saq.getModuleFfsKeyword();
ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes, saq);
String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
fileGenerator.genBuildFile(buildFilename);
@ -721,7 +721,7 @@ public class GenBuildTask extends Ant {
//
// Packages in PackageDenpendencies
//
PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
PackageIdentification[] packageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
for (int i = 0; i < packageDependencies.length; i++) {
GlobalData.refreshPackageIdentification(packageDependencies[i]);
File packageFile = packageDependencies[i].getSpdFile();
@ -732,17 +732,17 @@ public class GenBuildTask extends Ant {
//
// 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++) {
SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());
saq.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));
PackageIdentification[] libraryPackageDependencies = saq.getDependencePkg(fpdModuleId.getArch());
for (int j = 0; j < libraryPackageDependencies.length; j++) {
GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);
File packageFile = libraryPackageDependencies[j].getSpdFile();
includes.add(packageFile.getParent() + File.separatorChar + "Include");
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;
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.fpdModuleId = fpdModuleId;
this.ffsKeyword = ffsKeyword;
this.includes = includes;
this.saq = saq;
}
/**
@ -88,7 +91,7 @@ public class ModuleBuildFileGenerator {
Error throws during BaseName_build.xml generating.
**/
public void genBuildFile(String buildFilename) throws BuildException {
FfsProcess fp = new FfsProcess();
FfsProcess fp = new FfsProcess(saq);
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder dombuilder = domfac.newDocumentBuilder();
@ -293,7 +296,7 @@ public class ModuleBuildFileGenerator {
@param root Root element for current
**/
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++) {
//
// 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
//
String[][] sourceFiles = SurfaceAreaQuery.getSourceFiles(fpdModuleId.getArch());
String[][] sourceFiles = saq.getSourceFiles(fpdModuleId.getArch());
FileProcess fileProcess = new FileProcess();
fileProcess.init(project, includes, document);

View File

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

View File

@ -65,16 +65,15 @@ public class AutogenLibOrder {
// Add libraryInstance in to libInstanceList.
//
Map<String, XmlObject> libDoc = GlobalData.getDoc(libraryList[i], arch);
SurfaceAreaQuery.push(libDoc);
libInstanceNode = new LibraryInstanceNode (libraryList[i],SurfaceAreaQuery.getLibConstructorName(), SurfaceAreaQuery.getLibDestructorName());
SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc);
libInstanceNode = new LibraryInstanceNode (libraryList[i],saq.getLibConstructorName(), saq.getLibDestructorName());
libInstanceList.add(libInstanceNode);
//
// Add library instance and consumed library class list to
// libInstanceMap.
//
libClassConsmList = SurfaceAreaQuery
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
if (libClassConsmList != null) {
String[] classStr = new String[libClassConsmList.length];
for (int k = 0; k < libClassConsmList.length; k++) {
@ -92,8 +91,7 @@ public class AutogenLibOrder {
//
// Add library class and library instance map.
//
libClassDeclList = SurfaceAreaQuery
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
if (libClassDeclList != null) {
for (int j = 0; j < libClassDeclList.length; 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>();
SurfaceAreaQuery saq = null;
private boolean isUnified = true;
/**
@ -169,7 +171,7 @@ public class FpdParserTask extends Task {
//
// Gen build.xml
//
PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified);
PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified, saq);
fileGenerator.genBuildFile();
//
@ -194,12 +196,12 @@ public class FpdParserTask extends Task {
File write FV.inf files error.
**/
private void genFvInfFiles(String ffsCommonDir) throws BuildException {
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames();
String[] validFv = saq.getFpdValidImageNames();
for (int i = 0; i < validFv.length; i++) {
//
// 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++) {
getProject().setProperty(globalVariables[j][0], globalVariables[j][1]);
}
@ -216,7 +218,7 @@ public class FpdParserTask extends Task {
//
// Options
//
String[][] options = SurfaceAreaQuery.getFpdOptions(validFv[i]);
String[][] options = saq.getFpdOptions(validFv[i]);
if (options.length > 0) {
bw.write("[options]");
bw.newLine();
@ -237,7 +239,7 @@ public class FpdParserTask extends Task {
//
// Attributes;
//
String[][] attributes = SurfaceAreaQuery.getFpdAttributes(validFv[i]);
String[][] attributes = saq.getFpdAttributes(validFv[i]);
if (attributes.length > 0) {
bw.write("[attributes]");
bw.newLine();
@ -258,7 +260,7 @@ public class FpdParserTask extends Task {
//
// Components
//
String[][] components = SurfaceAreaQuery.getFpdComponents(validFv[i]);
String[][] components = saq.getFpdComponents(validFv[i]);
if (components.length > 0) {
bw.write("[components]");
bw.newLine();
@ -325,12 +327,12 @@ public class FpdParserTask extends Task {
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
map.put("PlatformSurfaceArea", doc);
SurfaceAreaQuery.setDoc(map);
saq = new SurfaceAreaQuery(map);
//
// Initialize
//
platformId = SurfaceAreaQuery.getFpdHeader();
platformId = saq.getFpdHeader();
platformId.setFpdFile(fpdFile);
getProject().setProperty("PLATFORM", platformId.getName());
getProject().setProperty("PLATFORM_FILE", platformId.getRelativeFpdFile().replaceAll("(\\\\)", "/"));
@ -340,17 +342,17 @@ public class FpdParserTask extends Task {
//
// Build mode. User-defined output dir.
//
String buildMode = SurfaceAreaQuery.getFpdIntermediateDirectories();
String userDefinedOutputDir = SurfaceAreaQuery.getFpdOutputDirectory();
String buildMode = saq.getFpdIntermediateDirectories();
String userDefinedOutputDir = saq.getFpdOutputDirectory();
OutputManager.getInstance().setup(userDefinedOutputDir, buildMode);
//
// 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
@ -363,7 +365,7 @@ public class FpdParserTask extends Task {
parseToolChainFamilyOptions();
parseToolChainOptions();
SurfaceAreaQuery.setDoc(map);
saq.push(map);
//
// Pcd Collection. Call CollectPCDAction to collect pcd info.
@ -379,7 +381,7 @@ public class FpdParserTask extends Task {
Parse all modules listed in FPD file.
**/
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.
@ -397,8 +399,8 @@ public class FpdParserTask extends Task {
//
// Put fpdModuleId to the corresponding FV
//
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));
String fvBinding = SurfaceAreaQuery.getModuleFvBindingKeyword();
saq.push(GlobalData.getDoc(fpdModuleId));
String fvBinding = saq.getModuleFvBindingKeyword();
fpdModuleId.setFvBinding(fvBinding);
updateFvs(fvBinding, fpdModuleId);
@ -408,7 +410,7 @@ public class FpdParserTask extends Task {
//
ModuleIdentification moduleId = fpdModuleId.getModule();
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();
String baseName = saq.getModuleOutputFileBasename();
if (baseName == null) {
baseName = moduleId.getName();
@ -422,12 +424,12 @@ public class FpdParserTask extends Task {
//
GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
SurfaceAreaQuery.pop();
saq.pop();
}
}
private ToolChainMap parseModuleBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
String[][] options = SurfaceAreaQuery.getModuleBuildOptions(toolChainFamilyFlag);
String[][] options = saq.getModuleBuildOptions(toolChainFamilyFlag);
if (options == null || options.length == 0) {
return new ToolChainMap();
}
@ -435,7 +437,7 @@ public class FpdParserTask extends Task {
}
private ToolChainMap parsePlatformBuildOptions(boolean toolChainFamilyFlag) throws EdkException {
String[][] options = SurfaceAreaQuery.getPlatformBuildOptions(toolChainFamilyFlag);
String[][] options = saq.getPlatformBuildOptions(toolChainFamilyFlag);
if (options == null || options.length == 0) {
return new ToolChainMap();
}

View File

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

View File

@ -185,7 +185,7 @@ public class GlobalData {
List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();
Iterator<DbPathAndFilename> iter = packages.iterator();
while (iter.hasNext()) {
String fileName = iter.next().getStringValue();
String fileName = iter.next().getStringValue().trim();
Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));
packageList.add(spd.getPackageId());
spdTable.put(spd.getPackageId(), spd);
@ -199,7 +199,7 @@ public class GlobalData {
List<DbPathAndFilename> platforms = db.getFrameworkDatabase().getPlatformList().getFilenameList();
Iterator<DbPathAndFilename> iter = platforms.iterator();
while (iter.hasNext()) {
String fileName = iter.next().getStringValue();
String fileName = iter.next().getStringValue().trim();
File fpdFile = new File(workspaceDir + File.separatorChar + fileName);
if ( !fpdFile.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>();
fpdDocMap.put("PlatformSurfaceArea", fpdDoc);
SurfaceAreaQuery.setDoc(fpdDocMap);
PlatformIdentification platformId = SurfaceAreaQuery.getFpdHeader();
SurfaceAreaQuery saq = new SurfaceAreaQuery(fpdDocMap);
PlatformIdentification platformId = saq.getFpdHeader();
platformId.setFpdFile(fpdFile);
platformList.add(platformId);
}

View File

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

View File

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