Fixed EDKT493. Added support to "SupModuleList" for checking if a library instance is supporting current module.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2282 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2007-01-23 08:51:06 +00:00
parent 2b34c3fe63
commit 700279a971
4 changed files with 146 additions and 135 deletions

View File

@ -26,14 +26,11 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.xmlbeans.XmlObject;
import org.tianocore.common.definitions.ToolDefinitions;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.build.autogen.AutoGen;
import org.tianocore.build.exception.AutoGenException;
import org.tianocore.build.exception.GenBuildException;
@ -48,6 +45,9 @@ import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.tools.ModuleItem;
import org.tianocore.common.definitions.ToolDefinitions;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
/**
<p>
@ -151,6 +151,10 @@ public class GenBuildTask extends Ant {
BuildException buildException = new BuildException(e.getMessage());
buildException.setStackTrace(e.getStackTrace());
throw buildException;
} catch (Exception e) {
BuildException buildException = new BuildException(e.getMessage());
buildException.setStackTrace(e.getStackTrace());
throw buildException;
}
}
@ -197,7 +201,7 @@ public class GenBuildTask extends Ant {
moduleId.setMsaFile(msaFile);
}
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED", null, null);
if (producedLibraryClasses.length == 0) {
moduleId.setLibrary(false);
} else {

View File

@ -347,8 +347,8 @@ public class AutoGen {
//
// Write library class's related *.h file to autogen.h.
//
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED,this.arch);
if (libClassList != null) {
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
if (libClassList.length > 0) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
while (item.hasNext()) {
@ -356,8 +356,8 @@ public class AutoGen {
}
}
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
if (libClassList != null) {
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);
if (libClassList.length > 0) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
while (item.hasNext()) {
@ -584,7 +584,7 @@ public class AutoGen {
//
// Write library class's related *.h file to autogen.h
//
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
@ -593,7 +593,7 @@ public class AutoGen {
}
}
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);
if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
@ -1354,12 +1354,11 @@ public class AutoGen {
//
// Add library constructor to AutoGen.c
//
LibConstructorToAutogenC(libConstructList, moduleType,
fileBuffer/* autogenC */);
LibConstructorToAutogenC(libConstructList, moduleType, fileBuffer);
//
// Add library destructor to AutoGen.c
//
LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);
LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer);
}
/**
@ -2106,6 +2105,7 @@ public class AutoGen {
private void collectLibInstanceInfo() throws EdkException{
int index;
String moduleType = moduleId.getModuleType();
String libConstructName = null;
String libDestructName = null;
String libModuleType = null;
@ -2113,17 +2113,14 @@ public class AutoGen {
String[] exitBoots = null;
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
if (libraryIdList != null) {
if (libraryIdList.length <= 0) {
return;
}
//
// Reorder library instance sequence.
//
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,
this.arch);
List<ModuleIdentification> orderList = libOrder
.orderLibInstance();
if (orderList != null) {
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList, this.arch);
List<ModuleIdentification> orderList = libOrder.orderLibInstance();
//
// Process library instance one by one.
//
@ -2140,6 +2137,17 @@ public class AutoGen {
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
saq.push(libDoc);
//
// check if the library instance support current module
//
String[] libraryClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED,
this.arch,
moduleType
);
if (libraryClassList.length <= 0) {
throw new EdkException("Library instance " + libInstanceId.getName()
+ " doesn't support module type " + moduleType);
}
//
// Get <PPis>, <Protocols>, <Guids> list of this library
// instance.
//
@ -2219,8 +2227,6 @@ public class AutoGen {
}
}
}
}
}
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
//

View File

@ -90,8 +90,8 @@ public class AutogenLibOrder {
//
// Create library class consume database.
//
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
if (libClassConsmList != null) {
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch, null);
if (libClassConsmList.length > 0) {
if (this.libInstanceConsumes.containsKey(libInstance)) {
throw new AutoGenException(
libraryList[i].getName()
@ -104,8 +104,8 @@ public class AutogenLibOrder {
//
// Create library class implementer database
//
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
if (libClassDeclList != null) {
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch, null);
if (libClassDeclList.length > 0) {
this.libInstanceProduces.put(libInstance, libClassDeclList);
for (int j = 0; j < libClassDeclList.length; j++) {
if (this.libClassProducer.containsKey(libClassDeclList[j])) {
@ -132,6 +132,9 @@ public class AutogenLibOrder {
for (int k = 0; k < libraryList.length; ++k) {
ModuleIdentification consumer = libraryList[k];
String[] consumedClassList = libInstanceConsumes.get(consumer);
if (consumedClassList == null) {
continue;
}
for (int l = 0; l < consumedClassList.length; ++l) {
if (consumedClassList[l].equals(className)) {
@ -168,6 +171,9 @@ public class AutogenLibOrder {
orderList.addFirst(n);
String[] consumedClassList = libInstanceConsumes.get(n);
if (consumedClassList == null) {
continue;
}
for (int i = 0; i < consumedClassList.length; ++i) {
ModuleIdentification m = libClassProducer.get(consumedClassList[i]);
if (m == null) {
@ -239,8 +245,7 @@ public class AutogenLibOrder {
+ " with constructor has a circular dependency!");
ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);
for (int j = 0; j < consumedByList.length; ++j) {
EdkLog.log(EdkLog.EDK_ERROR,
" consumed by " + consumedByList[j].getName());
EdkLog.log(EdkLog.EDK_ERROR, " consumed by " + consumedByList[j].getName());
}
HasError = true;
}

View File

@ -38,6 +38,7 @@ import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.definitions.EdkDefinitions;
import org.w3c.dom.Node;
/**
@ -593,7 +594,7 @@ public class SurfaceAreaQuery {
* xpath
* @returns null if nothing is there
*/
public String[] getLibraryClasses(String usage, String arch) {
public String[] getLibraryClasses(String usage, String arch, String moduleType) {
String[] xPath;
if (usage == null || usage.equals("")) {
xPath = new String[] { "/LibraryClass" };
@ -610,8 +611,10 @@ public class SurfaceAreaQuery {
List<String> libraryClassName = new ArrayList<String>();
for (int i = 0; i < libraryClassList.length; i++) {
List archList = libraryClassList[i].getSupArchList();
if (arch == null || contains(archList, arch)) {
List moduleTypeList = libraryClassList[i].getSupModuleList();
if ((arch == null || contains(archList, arch))
&& (moduleType == null || contains(moduleTypeList, moduleType)
|| contains(moduleTypeList, EdkDefinitions.MODULE_TYPE_BASE))) {
libraryClassName.add(libraryClassList[i].getKeyword());
}
}
@ -2008,15 +2011,8 @@ public class SurfaceAreaQuery {
if (list == null || list.size()== 0) {
return true;
}
Iterator it = list.iterator();
while (it.hasNext()) {
String s = (String)it.next();
if (s.equalsIgnoreCase(str)) {
return true;
}
}
return false;
return list.contains(str);
}
public boolean isHaveTianoR8FlashMap(){