mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 09:04:07 +02:00
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:
parent
2b34c3fe63
commit
700279a971
@ -26,14 +26,11 @@ import java.util.Vector;
|
|||||||
|
|
||||||
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.BuildException;
|
||||||
import org.apache.tools.ant.BuildListener;
|
import org.apache.tools.ant.BuildListener;
|
||||||
|
import org.apache.tools.ant.Location;
|
||||||
import org.apache.tools.ant.Project;
|
import org.apache.tools.ant.Project;
|
||||||
import org.apache.tools.ant.taskdefs.Ant;
|
import org.apache.tools.ant.taskdefs.Ant;
|
||||||
import org.apache.tools.ant.taskdefs.Property;
|
import org.apache.tools.ant.taskdefs.Property;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
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.autogen.AutoGen;
|
||||||
import org.tianocore.build.exception.AutoGenException;
|
import org.tianocore.build.exception.AutoGenException;
|
||||||
import org.tianocore.build.exception.GenBuildException;
|
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.PackageIdentification;
|
||||||
import org.tianocore.build.id.PlatformIdentification;
|
import org.tianocore.build.id.PlatformIdentification;
|
||||||
import org.tianocore.build.tools.ModuleItem;
|
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>
|
<p>
|
||||||
@ -151,6 +151,10 @@ public class GenBuildTask extends Ant {
|
|||||||
BuildException buildException = new BuildException(e.getMessage());
|
BuildException buildException = new BuildException(e.getMessage());
|
||||||
buildException.setStackTrace(e.getStackTrace());
|
buildException.setStackTrace(e.getStackTrace());
|
||||||
throw buildException;
|
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);
|
moduleId.setMsaFile(msaFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);
|
String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED", null, null);
|
||||||
if (producedLibraryClasses.length == 0) {
|
if (producedLibraryClasses.length == 0) {
|
||||||
moduleId.setLibrary(false);
|
moduleId.setLibrary(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,8 +347,8 @@ public class AutoGen {
|
|||||||
//
|
//
|
||||||
// Write library class's related *.h file to autogen.h.
|
// Write library class's related *.h file to autogen.h.
|
||||||
//
|
//
|
||||||
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED,this.arch);
|
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
|
||||||
if (libClassList != null) {
|
if (libClassList.length > 0) {
|
||||||
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
||||||
item = libClassIncludeH.iterator();
|
item = libClassIncludeH.iterator();
|
||||||
while (item.hasNext()) {
|
while (item.hasNext()) {
|
||||||
@ -356,8 +356,8 @@ public class AutoGen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
|
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);
|
||||||
if (libClassList != null) {
|
if (libClassList.length > 0) {
|
||||||
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
||||||
item = libClassIncludeH.iterator();
|
item = libClassIncludeH.iterator();
|
||||||
while (item.hasNext()) {
|
while (item.hasNext()) {
|
||||||
@ -584,7 +584,7 @@ public class AutoGen {
|
|||||||
//
|
//
|
||||||
// Write library class's related *.h file to autogen.h
|
// Write library class's related *.h file to autogen.h
|
||||||
//
|
//
|
||||||
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);
|
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);
|
||||||
if (libClassList != null) {
|
if (libClassList != null) {
|
||||||
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
||||||
item = libClassIncludeH.iterator();
|
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) {
|
if (libClassList != null) {
|
||||||
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
libClassIncludeH = LibraryClassToAutogenH(libClassList);
|
||||||
item = libClassIncludeH.iterator();
|
item = libClassIncludeH.iterator();
|
||||||
@ -1354,12 +1354,11 @@ public class AutoGen {
|
|||||||
//
|
//
|
||||||
// Add library constructor to AutoGen.c
|
// Add library constructor to AutoGen.c
|
||||||
//
|
//
|
||||||
LibConstructorToAutogenC(libConstructList, moduleType,
|
LibConstructorToAutogenC(libConstructList, moduleType, fileBuffer);
|
||||||
fileBuffer/* autogenC */);
|
|
||||||
//
|
//
|
||||||
// Add library destructor to AutoGen.c
|
// 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{
|
private void collectLibInstanceInfo() throws EdkException{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
|
String moduleType = moduleId.getModuleType();
|
||||||
String libConstructName = null;
|
String libConstructName = null;
|
||||||
String libDestructName = null;
|
String libDestructName = null;
|
||||||
String libModuleType = null;
|
String libModuleType = null;
|
||||||
@ -2113,17 +2113,14 @@ public class AutoGen {
|
|||||||
String[] exitBoots = null;
|
String[] exitBoots = null;
|
||||||
|
|
||||||
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
|
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
|
||||||
|
if (libraryIdList.length <= 0) {
|
||||||
if (libraryIdList != null) {
|
return;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Reorder library instance sequence.
|
// Reorder library instance sequence.
|
||||||
//
|
//
|
||||||
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,
|
AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList, this.arch);
|
||||||
this.arch);
|
List<ModuleIdentification> orderList = libOrder.orderLibInstance();
|
||||||
List<ModuleIdentification> orderList = libOrder
|
|
||||||
.orderLibInstance();
|
|
||||||
|
|
||||||
if (orderList != null) {
|
|
||||||
//
|
//
|
||||||
// Process library instance one by one.
|
// Process library instance one by one.
|
||||||
//
|
//
|
||||||
@ -2140,6 +2137,17 @@ public class AutoGen {
|
|||||||
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
|
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
|
||||||
saq.push(libDoc);
|
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
|
// Get <PPis>, <Protocols>, <Guids> list of this library
|
||||||
// instance.
|
// instance.
|
||||||
//
|
//
|
||||||
@ -2219,8 +2227,6 @@ public class AutoGen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
|
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){
|
||||||
//
|
//
|
||||||
|
@ -90,8 +90,8 @@ public class AutogenLibOrder {
|
|||||||
//
|
//
|
||||||
// Create library class consume database.
|
// Create library class consume database.
|
||||||
//
|
//
|
||||||
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
|
libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch, null);
|
||||||
if (libClassConsmList != null) {
|
if (libClassConsmList.length > 0) {
|
||||||
if (this.libInstanceConsumes.containsKey(libInstance)) {
|
if (this.libInstanceConsumes.containsKey(libInstance)) {
|
||||||
throw new AutoGenException(
|
throw new AutoGenException(
|
||||||
libraryList[i].getName()
|
libraryList[i].getName()
|
||||||
@ -104,8 +104,8 @@ public class AutogenLibOrder {
|
|||||||
//
|
//
|
||||||
// Create library class implementer database
|
// Create library class implementer database
|
||||||
//
|
//
|
||||||
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
|
libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch, null);
|
||||||
if (libClassDeclList != null) {
|
if (libClassDeclList.length > 0) {
|
||||||
this.libInstanceProduces.put(libInstance, libClassDeclList);
|
this.libInstanceProduces.put(libInstance, libClassDeclList);
|
||||||
for (int j = 0; j < libClassDeclList.length; j++) {
|
for (int j = 0; j < libClassDeclList.length; j++) {
|
||||||
if (this.libClassProducer.containsKey(libClassDeclList[j])) {
|
if (this.libClassProducer.containsKey(libClassDeclList[j])) {
|
||||||
@ -132,6 +132,9 @@ public class AutogenLibOrder {
|
|||||||
for (int k = 0; k < libraryList.length; ++k) {
|
for (int k = 0; k < libraryList.length; ++k) {
|
||||||
ModuleIdentification consumer = libraryList[k];
|
ModuleIdentification consumer = libraryList[k];
|
||||||
String[] consumedClassList = libInstanceConsumes.get(consumer);
|
String[] consumedClassList = libInstanceConsumes.get(consumer);
|
||||||
|
if (consumedClassList == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (int l = 0; l < consumedClassList.length; ++l) {
|
for (int l = 0; l < consumedClassList.length; ++l) {
|
||||||
if (consumedClassList[l].equals(className)) {
|
if (consumedClassList[l].equals(className)) {
|
||||||
@ -168,6 +171,9 @@ public class AutogenLibOrder {
|
|||||||
orderList.addFirst(n);
|
orderList.addFirst(n);
|
||||||
|
|
||||||
String[] consumedClassList = libInstanceConsumes.get(n);
|
String[] consumedClassList = libInstanceConsumes.get(n);
|
||||||
|
if (consumedClassList == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (int i = 0; i < consumedClassList.length; ++i) {
|
for (int i = 0; i < consumedClassList.length; ++i) {
|
||||||
ModuleIdentification m = libClassProducer.get(consumedClassList[i]);
|
ModuleIdentification m = libClassProducer.get(consumedClassList[i]);
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
@ -239,8 +245,7 @@ public class AutogenLibOrder {
|
|||||||
+ " with constructor has a circular dependency!");
|
+ " with constructor has a circular dependency!");
|
||||||
ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);
|
ModuleIdentification[] consumedByList = consumedBy.toArray(new ModuleIdentification[consumedBy.size()]);
|
||||||
for (int j = 0; j < consumedByList.length; ++j) {
|
for (int j = 0; j < consumedByList.length; ++j) {
|
||||||
EdkLog.log(EdkLog.EDK_ERROR,
|
EdkLog.log(EdkLog.EDK_ERROR, " consumed by " + consumedByList[j].getName());
|
||||||
" consumed by " + consumedByList[j].getName());
|
|
||||||
}
|
}
|
||||||
HasError = true;
|
HasError = true;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import org.tianocore.build.id.PackageIdentification;
|
|||||||
import org.tianocore.build.id.PlatformIdentification;
|
import org.tianocore.build.id.PlatformIdentification;
|
||||||
import org.tianocore.build.toolchain.ToolChainInfo;
|
import org.tianocore.build.toolchain.ToolChainInfo;
|
||||||
import org.tianocore.common.exception.EdkException;
|
import org.tianocore.common.exception.EdkException;
|
||||||
|
import org.tianocore.common.definitions.EdkDefinitions;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -593,7 +594,7 @@ public class SurfaceAreaQuery {
|
|||||||
* xpath
|
* xpath
|
||||||
* @returns null if nothing is there
|
* @returns null if nothing is there
|
||||||
*/
|
*/
|
||||||
public String[] getLibraryClasses(String usage, String arch) {
|
public String[] getLibraryClasses(String usage, String arch, String moduleType) {
|
||||||
String[] xPath;
|
String[] xPath;
|
||||||
if (usage == null || usage.equals("")) {
|
if (usage == null || usage.equals("")) {
|
||||||
xPath = new String[] { "/LibraryClass" };
|
xPath = new String[] { "/LibraryClass" };
|
||||||
@ -610,8 +611,10 @@ public class SurfaceAreaQuery {
|
|||||||
List<String> libraryClassName = new ArrayList<String>();
|
List<String> libraryClassName = new ArrayList<String>();
|
||||||
for (int i = 0; i < libraryClassList.length; i++) {
|
for (int i = 0; i < libraryClassList.length; i++) {
|
||||||
List archList = libraryClassList[i].getSupArchList();
|
List archList = libraryClassList[i].getSupArchList();
|
||||||
|
List moduleTypeList = libraryClassList[i].getSupModuleList();
|
||||||
if (arch == null || contains(archList, arch)) {
|
if ((arch == null || contains(archList, arch))
|
||||||
|
&& (moduleType == null || contains(moduleTypeList, moduleType)
|
||||||
|
|| contains(moduleTypeList, EdkDefinitions.MODULE_TYPE_BASE))) {
|
||||||
libraryClassName.add(libraryClassList[i].getKeyword());
|
libraryClassName.add(libraryClassList[i].getKeyword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2008,15 +2011,8 @@ public class SurfaceAreaQuery {
|
|||||||
if (list == null || list.size()== 0) {
|
if (list == null || list.size()== 0) {
|
||||||
return true;
|
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(){
|
public boolean isHaveTianoR8FlashMap(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user