mirror of https://github.com/acidanthera/audk.git
Unify the logger and exception in AutoGen.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1493 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
607ef9948b
commit
61528a1be3
|
@ -208,29 +208,28 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Failed to creat AutoGen.c & AutoGen.h.
|
Failed to creat AutoGen.c & AutoGen.h.
|
||||||
**/
|
**/
|
||||||
public void genAutogen() throws BuildException {
|
public void genAutogen() throws EdkException {
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// If outputPath do not exist, create it.
|
// If outputPath do not exist, create it.
|
||||||
//
|
//
|
||||||
File path = new File(outputPath);
|
File path = new File(outputPath);
|
||||||
path.mkdirs();
|
path.mkdirs();
|
||||||
|
} catch (Exception e) {
|
||||||
//
|
throw new AutoGenException(
|
||||||
// Check current is library or not, then call the corresponding
|
"Failed to create "
|
||||||
// function.
|
+ outputPath + " directory");
|
||||||
//
|
|
||||||
if (this.moduleId.isLibrary()) {
|
|
||||||
libGenAutogen();
|
|
||||||
} else {
|
|
||||||
moduleGenAutogen();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BuildException(
|
|
||||||
"Failed to create AutoGen.c & AutoGen.h!\n"
|
|
||||||
+ e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check current is library or not, then call the corresponding
|
||||||
|
// function.
|
||||||
|
//
|
||||||
|
if (this.moduleId.isLibrary()) {
|
||||||
|
libGenAutogen();
|
||||||
|
} else {
|
||||||
|
moduleGenAutogen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,17 +240,10 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Faile to create module AutoGen.c & AutoGen.h.
|
Faile to create module AutoGen.c & AutoGen.h.
|
||||||
**/
|
**/
|
||||||
void moduleGenAutogen() throws BuildException {
|
void moduleGenAutogen() throws EdkException {
|
||||||
|
collectLibInstanceInfo();
|
||||||
try {
|
moduleGenAutogenC();
|
||||||
collectLibInstanceInfo();
|
moduleGenAutogenH();
|
||||||
moduleGenAutogenC();
|
|
||||||
moduleGenAutogenH();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BuildException(
|
|
||||||
"Faile to create module AutoGen.c & AutoGen.h!\n"
|
|
||||||
+ e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -262,15 +254,9 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Faile to create library AutoGen.c & AutoGen.h
|
Faile to create library AutoGen.c & AutoGen.h
|
||||||
**/
|
**/
|
||||||
void libGenAutogen() throws BuildException {
|
void libGenAutogen() throws EdkException {
|
||||||
try {
|
libGenAutogenC();
|
||||||
libGenAutogenC();
|
libGenAutogenH();
|
||||||
libGenAutogenH();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BuildException(
|
|
||||||
"Failed to create library AutoGen.c & AutoGen.h!\n"
|
|
||||||
+ e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,7 +267,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Failed to generate AutoGen.h.
|
Failed to generate AutoGen.h.
|
||||||
**/
|
**/
|
||||||
void moduleGenAutogenH() throws EdkException, AutoGenException {
|
void moduleGenAutogenH() throws EdkException {
|
||||||
|
|
||||||
Set<String> libClassIncludeH;
|
Set<String> libClassIncludeH;
|
||||||
String moduleType;
|
String moduleType;
|
||||||
|
@ -395,7 +381,7 @@ public class AutoGen {
|
||||||
// Save string buffer content in AutoGen.h.
|
// Save string buffer content in AutoGen.h.
|
||||||
//
|
//
|
||||||
if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
|
if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
|
||||||
throw new BuildException("Failed to generate AutoGen.h !!!");
|
throw new AutoGenException("Failed to generate AutoGen.h !!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +393,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Failed to generate AutoGen.c.
|
Failed to generate AutoGen.c.
|
||||||
**/
|
**/
|
||||||
void moduleGenAutogenC() throws EdkException, AutoGenException {
|
void moduleGenAutogenC() throws EdkException {
|
||||||
|
|
||||||
StringBuffer fileBuffer = new StringBuffer(8192);
|
StringBuffer fileBuffer = new StringBuffer(8192);
|
||||||
//
|
//
|
||||||
|
@ -511,19 +497,15 @@ public class AutoGen {
|
||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
pcdDriverType);
|
pcdDriverType);
|
||||||
try {
|
|
||||||
this.myPcdAutogen.execute();
|
this.myPcdAutogen.execute();
|
||||||
} catch (Exception exp) {
|
|
||||||
throw new PcdAutogenException (exp.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.myPcdAutogen != null) {
|
if (this.myPcdAutogen != null) {
|
||||||
fileBuffer.append("\r\n");
|
fileBuffer.append("\r\n");
|
||||||
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
|
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
|
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
|
||||||
throw new BuildException("Failed to generate AutoGen.c !!!");
|
throw new AutoGenException("Failed to generate AutoGen.c !!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -536,7 +518,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Failed to generate AutoGen.c.
|
Failed to generate AutoGen.c.
|
||||||
**/
|
**/
|
||||||
void libGenAutogenH() throws EdkException, AutoGenException {
|
void libGenAutogenH() throws EdkException {
|
||||||
|
|
||||||
Set<String> libClassIncludeH;
|
Set<String> libClassIncludeH;
|
||||||
String moduleType;
|
String moduleType;
|
||||||
|
@ -641,7 +623,7 @@ public class AutoGen {
|
||||||
// Save content of string buffer to AutoGen.h file.
|
// Save content of string buffer to AutoGen.h file.
|
||||||
//
|
//
|
||||||
if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
|
if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {
|
||||||
throw new BuildException("Failed to generate AutoGen.h !!!");
|
throw new AutoGenException("Failed to generate AutoGen.h !!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +635,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Failed to generate AutoGen.c.
|
Failed to generate AutoGen.c.
|
||||||
**/
|
**/
|
||||||
void libGenAutogenC() throws BuildException, PcdAutogenException {
|
void libGenAutogenC() throws EdkException {
|
||||||
StringBuffer fileBuffer = new StringBuffer(10240);
|
StringBuffer fileBuffer = new StringBuffer(10240);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -672,19 +654,14 @@ public class AutoGen {
|
||||||
true,
|
true,
|
||||||
saq.getModulePcdEntryNameArray(),
|
saq.getModulePcdEntryNameArray(),
|
||||||
pcdDriverType);
|
pcdDriverType);
|
||||||
try {
|
this.myPcdAutogen.execute();
|
||||||
this.myPcdAutogen.execute();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new PcdAutogenException(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.myPcdAutogen != null) {
|
if (this.myPcdAutogen != null) {
|
||||||
fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
|
fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);
|
||||||
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
|
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
|
if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {
|
||||||
throw new BuildException("Failed to generate AutoGen.c !!!");
|
throw new AutoGenException("Failed to generate AutoGen.c !!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +677,7 @@ public class AutoGen {
|
||||||
@return includeStrList List of *.h file.
|
@return includeStrList List of *.h file.
|
||||||
**/
|
**/
|
||||||
Set<String> LibraryClassToAutogenH(String[] libClassList)
|
Set<String> LibraryClassToAutogenH(String[] libClassList)
|
||||||
throws EdkException, AutoGenException {
|
throws EdkException {
|
||||||
Set<String> includeStrList = new LinkedHashSet<String>();
|
Set<String> includeStrList = new LinkedHashSet<String>();
|
||||||
String includeName[];
|
String includeName[];
|
||||||
String str = "";
|
String str = "";
|
||||||
|
@ -781,7 +758,7 @@ public class AutoGen {
|
||||||
@throws Exception
|
@throws Exception
|
||||||
**/
|
**/
|
||||||
void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer)
|
void EntryPointToAutoGen(String[] entryPointList, String[] unloadImageList, StringBuffer fileBuffer)
|
||||||
throws BuildException {
|
throws EdkException {
|
||||||
|
|
||||||
String typeStr = saq.getModuleType();
|
String typeStr = saq.getModuleType();
|
||||||
int unloadImageCount = 0;
|
int unloadImageCount = 0;
|
||||||
|
@ -795,7 +772,7 @@ public class AutoGen {
|
||||||
|
|
||||||
case CommonDefinition.ModuleTypePeiCore:
|
case CommonDefinition.ModuleTypePeiCore:
|
||||||
if (entryPointList == null ||entryPointList.length != 1 ) {
|
if (entryPointList == null ||entryPointList.length != 1 ) {
|
||||||
throw new BuildException(
|
throw new AutoGenException(
|
||||||
"Module type = 'PEI_CORE', can have only one module entry point!");
|
"Module type = 'PEI_CORE', can have only one module entry point!");
|
||||||
} else {
|
} else {
|
||||||
fileBuffer.append("EFI_STATUS\r\n");
|
fileBuffer.append("EFI_STATUS\r\n");
|
||||||
|
@ -827,7 +804,7 @@ public class AutoGen {
|
||||||
case CommonDefinition.ModuleTypeDxeCore:
|
case CommonDefinition.ModuleTypeDxeCore:
|
||||||
fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
|
fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
|
||||||
if (entryPointList == null || entryPointList.length != 1) {
|
if (entryPointList == null || entryPointList.length != 1) {
|
||||||
throw new BuildException(
|
throw new AutoGenException(
|
||||||
"Module type = 'DXE_CORE', can have only one module entry point!");
|
"Module type = 'DXE_CORE', can have only one module entry point!");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1294,7 +1271,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
Protocol name must set.
|
Protocol name must set.
|
||||||
**/
|
**/
|
||||||
void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws BuildException {
|
void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws EdkException {
|
||||||
String[] cNameGuid = null;
|
String[] cNameGuid = null;
|
||||||
|
|
||||||
String[] protocolList = saq.getProtocolArray(this.arch);
|
String[] protocolList = saq.getProtocolArray(this.arch);
|
||||||
|
@ -1334,7 +1311,7 @@ public class AutoGen {
|
||||||
//
|
//
|
||||||
// If can't find protocol GUID declaration in every package
|
// If can't find protocol GUID declaration in every package
|
||||||
//
|
//
|
||||||
throw new BuildException("Can not find protocol Guid ["
|
throw new AutoGenException("Can not find protocol Guid ["
|
||||||
+ protocolKeyWord + "] declaration in any SPD package!");
|
+ protocolKeyWord + "] declaration in any SPD package!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1395,21 +1372,17 @@ public class AutoGen {
|
||||||
String buffer for AutoGen.c
|
String buffer for AutoGen.c
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
**/
|
**/
|
||||||
void LibInstanceToAutogenC(StringBuffer fileBuffer) throws BuildException {
|
void LibInstanceToAutogenC(StringBuffer fileBuffer) throws EdkException {
|
||||||
try {
|
String moduleType = this.moduleId.getModuleType();
|
||||||
String moduleType = this.moduleId.getModuleType();
|
//
|
||||||
//
|
// Add library constructor to AutoGen.c
|
||||||
// Add library constructor to AutoGen.c
|
//
|
||||||
//
|
LibConstructorToAutogenC(libConstructList, moduleType,
|
||||||
LibConstructorToAutogenC(libConstructList, moduleType,
|
fileBuffer/* autogenC */);
|
||||||
fileBuffer/* autogenC */);
|
//
|
||||||
//
|
// Add library destructor to AutoGen.c
|
||||||
// Add library destructor to AutoGen.c
|
//
|
||||||
//
|
LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);
|
||||||
LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BuildException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1427,7 +1400,7 @@ public class AutoGen {
|
||||||
@throws Exception
|
@throws Exception
|
||||||
**/
|
**/
|
||||||
void LibConstructorToAutogenC(List<String> libInstanceList,
|
void LibConstructorToAutogenC(List<String> libInstanceList,
|
||||||
String moduleType, StringBuffer fileBuffer) throws Exception {
|
String moduleType, StringBuffer fileBuffer) throws EdkException {
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1568,7 +1541,7 @@ public class AutoGen {
|
||||||
@throws Exception
|
@throws Exception
|
||||||
**/
|
**/
|
||||||
void LibDestructorToAutogenC(List<String> libInstanceList,
|
void LibDestructorToAutogenC(List<String> libInstanceList,
|
||||||
String moduleType, StringBuffer fileBuffer) throws Exception {
|
String moduleType, StringBuffer fileBuffer) throws EdkException {
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (int i = 0; i < libInstanceList.size(); i++) {
|
for (int i = 0; i < libInstanceList.size(); i++) {
|
||||||
switch (CommonDefinition.getModuleType(moduleType)) {
|
switch (CommonDefinition.getModuleType(moduleType)) {
|
||||||
|
@ -1663,7 +1636,7 @@ public class AutoGen {
|
||||||
String buffer for AutoGen.c
|
String buffer for AutoGen.c
|
||||||
**/
|
**/
|
||||||
void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)
|
void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)
|
||||||
throws BuildException {
|
throws EdkException {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check what <extern> contains. And the number of following elements
|
// Check what <extern> contains. And the number of following elements
|
||||||
|
@ -1702,7 +1675,7 @@ public class AutoGen {
|
||||||
//
|
//
|
||||||
if (compNamList != null && compNamList.length != 0) {
|
if (compNamList != null && compNamList.length != 0) {
|
||||||
if (drvBindList.length != compNamList.length) {
|
if (drvBindList.length != compNamList.length) {
|
||||||
throw new BuildException(
|
throw new AutoGenException(
|
||||||
"Different number of Driver Binding and Component Name protocols!");
|
"Different number of Driver Binding and Component Name protocols!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1719,7 +1692,7 @@ public class AutoGen {
|
||||||
//
|
//
|
||||||
if (compConfList != null && compConfList.length != 0) {
|
if (compConfList != null && compConfList.length != 0) {
|
||||||
if (drvBindList.length != compConfList.length) {
|
if (drvBindList.length != compConfList.length) {
|
||||||
throw new BuildException(
|
throw new AutoGenException(
|
||||||
"Different number of Driver Binding and Driver Configuration protocols!");
|
"Different number of Driver Binding and Driver Configuration protocols!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,7 +1709,7 @@ public class AutoGen {
|
||||||
//
|
//
|
||||||
if (compDiagList != null && compDiagList.length != 0) {
|
if (compDiagList != null && compDiagList.length != 0) {
|
||||||
if (drvBindList.length != compDiagList.length) {
|
if (drvBindList.length != compDiagList.length) {
|
||||||
throw new BuildException(
|
throw new AutoGenException(
|
||||||
"Different number of Driver Binding and Driver Diagnosis protocols!");
|
"Different number of Driver Binding and Driver Diagnosis protocols!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1818,7 +1791,7 @@ public class AutoGen {
|
||||||
@throws BuildException
|
@throws BuildException
|
||||||
**/
|
**/
|
||||||
void ExternCallBackToAutoGenC(StringBuffer fileBuffer)
|
void ExternCallBackToAutoGenC(StringBuffer fileBuffer)
|
||||||
throws BuildException {
|
throws EdkException {
|
||||||
//
|
//
|
||||||
// Collect module's <SetVirtualAddressMapCallBack> and
|
// Collect module's <SetVirtualAddressMapCallBack> and
|
||||||
// <ExitBootServiceCallBack> and add to setVirtualAddList
|
// <ExitBootServiceCallBack> and add to setVirtualAddList
|
||||||
|
@ -1879,20 +1852,21 @@ public class AutoGen {
|
||||||
// do nothing.
|
// do nothing.
|
||||||
//
|
//
|
||||||
if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
|
if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
|
||||||
try {
|
if (inFile.exists()) {
|
||||||
if (inFile.exists()) {
|
try{
|
||||||
FileInputStream fis = new FileInputStream (inFile);
|
FileInputStream fis = new FileInputStream (inFile);
|
||||||
fis.read(buffer);
|
fis.read(buffer);
|
||||||
FileOutputStream fos = new FileOutputStream(outFile);
|
FileOutputStream fos = new FileOutputStream(outFile);
|
||||||
fos.write(buffer);
|
fos.write(buffer);
|
||||||
fis.close();
|
fis.close();
|
||||||
fos.close();
|
fos.close();
|
||||||
} else {
|
} catch (IOException e){
|
||||||
throw new AutoGenException("The file, flashMap.h doesn't exist!");
|
throw new AutoGenException("The file, flashMap.h can't be open!");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
throw new AutoGenException(e.getMessage());
|
} else {
|
||||||
}
|
throw new AutoGenException("The file, flashMap.h doesn't exist!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1914,119 +1888,114 @@ public class AutoGen {
|
||||||
String[] exitBoots = null;
|
String[] exitBoots = null;
|
||||||
|
|
||||||
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
|
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
|
||||||
try {
|
|
||||||
if (libraryIdList != null) {
|
|
||||||
//
|
|
||||||
// Reorder library instance sequence.
|
|
||||||
//
|
|
||||||
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,
|
|
||||||
this.arch);
|
|
||||||
List<ModuleIdentification> orderList = libOrder
|
|
||||||
.orderLibInstance();
|
|
||||||
|
|
||||||
if (orderList != null) {
|
if (libraryIdList != null) {
|
||||||
//
|
//
|
||||||
// Process library instance one by one.
|
// Reorder library instance sequence.
|
||||||
//
|
//
|
||||||
for (int i = 0; i < orderList.size(); i++) {
|
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,
|
||||||
|
this.arch);
|
||||||
|
List<ModuleIdentification> orderList = libOrder
|
||||||
|
.orderLibInstance();
|
||||||
|
|
||||||
//
|
if (orderList != null) {
|
||||||
// Get library instance basename.
|
//
|
||||||
//
|
// Process library instance one by one.
|
||||||
ModuleIdentification libInstanceId = orderList.get(i);
|
//
|
||||||
|
for (int i = 0; i < orderList.size(); i++) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get override map
|
// Get library instance basename.
|
||||||
//
|
//
|
||||||
|
ModuleIdentification libInstanceId = orderList.get(i);
|
||||||
|
|
||||||
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
|
//
|
||||||
saq.push(libDoc);
|
// Get override map
|
||||||
//
|
//
|
||||||
// Get <PPis>, <Protocols>, <Guids> list of this library
|
|
||||||
// instance.
|
|
||||||
//
|
|
||||||
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);
|
|
||||||
|
|
||||||
//
|
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
|
||||||
// Add those ppi, protocol, guid in global ppi,
|
saq.push(libDoc);
|
||||||
// protocol, guid
|
//
|
||||||
// list.
|
// Get <PPis>, <Protocols>, <Guids> list of this library
|
||||||
//
|
// instance.
|
||||||
for (index = 0; index < ppiList.length; index++) {
|
//
|
||||||
this.mPpiList.add(ppiList[index]);
|
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);
|
||||||
|
|
||||||
for (index = 0; index < ppiNotifyList.length; index++) {
|
//
|
||||||
this.mPpiList.add(ppiNotifyList[index]);
|
// Add those ppi, protocol, guid in global ppi,
|
||||||
}
|
// protocol, guid
|
||||||
|
// list.
|
||||||
|
//
|
||||||
|
for (index = 0; index < ppiList.length; index++) {
|
||||||
|
this.mPpiList.add(ppiList[index]);
|
||||||
|
}
|
||||||
|
|
||||||
for (index = 0; index < protocolList.length; index++) {
|
for (index = 0; index < ppiNotifyList.length; index++) {
|
||||||
this.mProtocolList.add(protocolList[index]);
|
this.mPpiList.add(ppiNotifyList[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0; index < protocolNotifyList.length; index++) {
|
for (index = 0; index < protocolList.length; index++) {
|
||||||
this.mProtocolList.add(protocolNotifyList[index]);
|
this.mProtocolList.add(protocolList[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0; index < guidList.length; index++) {
|
for (index = 0; index < protocolNotifyList.length; index++) {
|
||||||
this.mGuidList.add(guidList[index]);
|
this.mProtocolList.add(protocolNotifyList[index]);
|
||||||
}
|
}
|
||||||
for (index = 0; index < pkgList.length; index++) {
|
|
||||||
if (!this.mDepPkgList.contains(pkgList[index])) {
|
|
||||||
this.mDepPkgList.add(pkgList[index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
for (index = 0; index < guidList.length; index++) {
|
||||||
// If not yet parse this library instance's constructor
|
this.mGuidList.add(guidList[index]);
|
||||||
// element,parse it.
|
}
|
||||||
//
|
for (index = 0; index < pkgList.length; index++) {
|
||||||
libConstructName = saq.getLibConstructorName();
|
if (!this.mDepPkgList.contains(pkgList[index])) {
|
||||||
libDestructName = saq.getLibDestructorName();
|
this.mDepPkgList.add(pkgList[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Collect SetVirtualAddressMapCallBack and
|
// If not yet parse this library instance's constructor
|
||||||
// ExitBootServiceCallBack.
|
// element,parse it.
|
||||||
//
|
//
|
||||||
setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
|
libConstructName = saq.getLibConstructorName();
|
||||||
exitBoots = saq.getExitBootServicesCallBackArray();
|
libDestructName = saq.getLibDestructorName();
|
||||||
if (setVirtuals != null) {
|
|
||||||
for (int j = 0; j < setVirtuals.length; j++) {
|
|
||||||
this.setVirtalAddList.add(setVirtuals[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (exitBoots != null) {
|
|
||||||
for (int k = 0; k < exitBoots.length; k++) {
|
|
||||||
this.exitBootServiceList.add(exitBoots[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
saq.pop();
|
|
||||||
//
|
|
||||||
// Add dependent library instance constructor function.
|
|
||||||
//
|
|
||||||
if (libConstructName != null) {
|
|
||||||
this.libConstructList.add(libConstructName);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Add dependent library instance destructor fuction.
|
|
||||||
//
|
|
||||||
if (libDestructName != null) {
|
|
||||||
this.libDestructList.add(libDestructName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
//
|
||||||
|
// Collect SetVirtualAddressMapCallBack and
|
||||||
|
// ExitBootServiceCallBack.
|
||||||
|
//
|
||||||
|
setVirtuals = saq.getSetVirtualAddressMapCallBackArray();
|
||||||
|
exitBoots = saq.getExitBootServicesCallBackArray();
|
||||||
|
if (setVirtuals != null) {
|
||||||
|
for (int j = 0; j < setVirtuals.length; j++) {
|
||||||
|
this.setVirtalAddList.add(setVirtuals[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exitBoots != null) {
|
||||||
|
for (int k = 0; k < exitBoots.length; k++) {
|
||||||
|
this.exitBootServiceList.add(exitBoots[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saq.pop();
|
||||||
|
//
|
||||||
|
// Add dependent library instance constructor function.
|
||||||
|
//
|
||||||
|
if (libConstructName != null) {
|
||||||
|
this.libConstructList.add(libConstructName);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Add dependent library instance destructor fuction.
|
||||||
|
//
|
||||||
|
if (libDestructName != null) {
|
||||||
|
this.libDestructList.add(libDestructName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
System.out.println(e.getMessage());
|
|
||||||
System.out.println("Collect library instance failed!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
|
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
|
||||||
//
|
//
|
||||||
|
|
|
@ -22,9 +22,11 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
|
import org.tianocore.build.exception.AutoGenException;
|
||||||
import org.tianocore.build.global.GlobalData;
|
import org.tianocore.build.global.GlobalData;
|
||||||
import org.tianocore.build.global.SurfaceAreaQuery;
|
import org.tianocore.build.global.SurfaceAreaQuery;
|
||||||
import org.tianocore.build.id.ModuleIdentification;
|
import org.tianocore.build.id.ModuleIdentification;
|
||||||
|
import org.tianocore.common.exception.EdkException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class This class is to reorder library instance sequence according to
|
This class This class is to reorder library instance sequence according to
|
||||||
|
@ -55,7 +57,7 @@ public class AutogenLibOrder {
|
||||||
@param libraryList List of the library instance.
|
@param libraryList List of the library instance.
|
||||||
@throws Exception
|
@throws Exception
|
||||||
**/
|
**/
|
||||||
AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws Exception {
|
AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws EdkException {
|
||||||
LibraryInstanceNode libInstanceNode;
|
LibraryInstanceNode libInstanceNode;
|
||||||
String[] libClassDeclList = null;
|
String[] libClassDeclList = null;
|
||||||
String[] libClassConsmList = null;
|
String[] libClassConsmList = null;
|
||||||
|
@ -80,9 +82,9 @@ public class AutogenLibOrder {
|
||||||
classStr[k] = libClassConsmList[k];
|
classStr[k] = libClassConsmList[k];
|
||||||
}
|
}
|
||||||
if (this.libInstanceMap.containsKey(libraryList[i])) {
|
if (this.libInstanceMap.containsKey(libraryList[i])) {
|
||||||
throw new Exception(
|
throw new AutoGenException(
|
||||||
libraryList[i].getName()
|
libraryList[i].getName()
|
||||||
+ "this library instance already exists, please check the library instance list!");
|
+ "-- this library instance already exists, please check the library instance list!");
|
||||||
} else {
|
} else {
|
||||||
this.libInstanceMap.put(libraryList[i], classStr);
|
this.libInstanceMap.put(libraryList[i], classStr);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +100,7 @@ public class AutogenLibOrder {
|
||||||
System.out.println(libClassDeclList[j]
|
System.out.println(libClassDeclList[j]
|
||||||
+ " class is already implement by "
|
+ " class is already implement by "
|
||||||
+ this.libClassMap.get(libClassDeclList[j]));
|
+ this.libClassMap.get(libClassDeclList[j]));
|
||||||
throw new Exception("Library Class: " + libClassDeclList
|
throw new AutoGenException("Library Class: " + libClassDeclList
|
||||||
+ " already has a library instance!");
|
+ " already has a library instance!");
|
||||||
} else {
|
} else {
|
||||||
this.libClassMap.put(libClassDeclList[j], libraryList[i]);
|
this.libClassMap.put(libClassDeclList[j], libraryList[i]);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class GenBuildException extends EdkException {
|
||||||
@param expStr exception message string.
|
@param expStr exception message string.
|
||||||
**/
|
**/
|
||||||
public GenBuildException(String expStr) {
|
public GenBuildException(String expStr) {
|
||||||
super("[GenBuildException]:" + expStr);
|
super(expStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenBuildException() {
|
public GenBuildException() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class PcdAutogenException extends AutoGenException {
|
||||||
@param expStr exception message string.
|
@param expStr exception message string.
|
||||||
**/
|
**/
|
||||||
public PcdAutogenException(String expStr) {
|
public PcdAutogenException(String expStr) {
|
||||||
super("\r\n[PcdAutogenException] #############################\r\n" + expStr);
|
super(expStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PcdAutogenException() {
|
public PcdAutogenException() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class PlatformPcdPreprocessBuildException extends GenBuildException {
|
||||||
@param expStr exception message string.
|
@param expStr exception message string.
|
||||||
**/
|
**/
|
||||||
public PlatformPcdPreprocessBuildException(String expStr) {
|
public PlatformPcdPreprocessBuildException(String expStr) {
|
||||||
super("\r\n[PlatformPcdPreprocess Failure] #############################\r\n" + expStr);
|
super(expStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlatformPcdPreprocessBuildException() {
|
public PlatformPcdPreprocessBuildException() {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class TianoToolsException extends EdkException {
|
||||||
@param expStr exception message string.
|
@param expStr exception message string.
|
||||||
**/
|
**/
|
||||||
public TianoToolsException(String expStr) {
|
public TianoToolsException(String expStr) {
|
||||||
super("[TianoToolsException]:" + expStr);
|
super(expStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TianoToolsException() {
|
public TianoToolsException() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class XmlParseException extends GenBuildException {
|
||||||
@param expStr exception message string.
|
@param expStr exception message string.
|
||||||
**/
|
**/
|
||||||
public XmlParseException(String expStr) {
|
public XmlParseException(String expStr) {
|
||||||
super("[XmlParseException]:" + expStr);
|
super(expStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlParseException() {
|
public XmlParseException() {
|
||||||
|
|
Loading…
Reference in New Issue