summaryrefslogtreecommitdiffstats
path: root/Tools/Java
diff options
context:
space:
mode:
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-23 08:51:06 +0000
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-23 08:51:06 +0000
commit700279a971c1f603a72a45455be4b4f842ce39d9 (patch)
treef60a940c590959405415fd783bc3030d1c9c3144 /Tools/Java
parent2b34c3fe630ca813f15fe198caf971cd6a92c775 (diff)
downloadedk2-700279a971c1f603a72a45455be4b4f842ce39d9.tar.gz
edk2-700279a971c1f603a72a45455be4b4f842ce39d9.tar.bz2
edk2-700279a971c1f603a72a45455be4b4f842ce39d9.zip
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
Diffstat (limited to 'Tools/Java')
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java14
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java214
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java35
-rw-r--r--Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java18
4 files changed, 146 insertions, 135 deletions
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index 9d7eb6d094..8be1d62cc0 100644
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ b/Tools/Java/Source/GenBuild/org/tianocore/build/GenBuildTask.java
@@ -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 {
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
index 5925e504f6..ce6ff61842 100644
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
+++ b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
@@ -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,112 +2113,118 @@ public class AutoGen {
String[] exitBoots = null;
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);
+ if (libraryIdList.length <= 0) {
+ return;
+ }
+ //
+ // Reorder library instance sequence.
+ //
+ AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList, this.arch);
+ List<ModuleIdentification> orderList = libOrder.orderLibInstance();
+ //
+ // Process library instance one by one.
+ //
+ for (int i = 0; i < orderList.size(); i++) {
+ //
+ // Get library instance basename.
+ //
+ ModuleIdentification libInstanceId = orderList.get(i);
- if (libraryIdList != null) {
//
- // Reorder library instance sequence.
+ // Get override map
//
- AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,
- this.arch);
- List<ModuleIdentification> orderList = libOrder
- .orderLibInstance();
- if (orderList != null) {
- //
- // Process library instance one by one.
- //
- for (int i = 0; i < orderList.size(); i++) {
- //
- // Get library instance basename.
- //
- ModuleIdentification libInstanceId = orderList.get(i);
-
- //
- // Get override map
- //
-
- Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
- saq.push(libDoc);
- //
- // 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);
-
- //
- // Add those ppi, protocol, guid in global ppi,
- // protocol, guid
- // list.
- //
- for (index = 0; index < ppiList.length; index++) {
- this.mPpiList.add(ppiList[index]);
- }
+ 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.
+ //
+ 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++) {
- this.mProtocolList.add(protocolList[index]);
- }
+ for (index = 0; index < ppiNotifyList.length; index++) {
+ this.mPpiList.add(ppiNotifyList[index]);
+ }
- for (index = 0; index < protocolNotifyList.length; index++) {
- this.mProtocolList.add(protocolNotifyList[index]);
- }
+ for (index = 0; index < protocolList.length; index++) {
+ this.mProtocolList.add(protocolList[index]);
+ }
- for (index = 0; index < guidList.length; index++) {
- this.mGuidList.add(guidList[index]);
- }
- for (index = 0; index < pkgList.length; index++) {
- if (!this.mDepPkgList.contains(pkgList[index])) {
- this.mDepPkgList.add(pkgList[index]);
- }
- }
+ for (index = 0; index < protocolNotifyList.length; index++) {
+ this.mProtocolList.add(protocolNotifyList[index]);
+ }
- //
- // If not yet parse this library instance's constructor
- // element,parse it.
- //
- libConstructName = saq.getLibConstructorName();
- libDestructName = saq.getLibDestructorName();
- libModuleType = saq.getModuleType();
-
- //
- // 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(new String[] {libConstructName, libModuleType});
- }
- //
- // Add dependent library instance destructor fuction.
- //
- if (libDestructName != null) {
- this.libDestructList.add(new String[] {libDestructName, libModuleType});
- }
+ for (index = 0; index < guidList.length; index++) {
+ this.mGuidList.add(guidList[index]);
+ }
+ for (index = 0; index < pkgList.length; index++) {
+ if (!this.mDepPkgList.contains(pkgList[index])) {
+ this.mDepPkgList.add(pkgList[index]);
+ }
+ }
+
+ //
+ // If not yet parse this library instance's constructor
+ // element,parse it.
+ //
+ libConstructName = saq.getLibConstructorName();
+ libDestructName = saq.getLibDestructorName();
+ libModuleType = saq.getModuleType();
+
+ //
+ // 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(new String[] {libConstructName, libModuleType});
+ }
+ //
+ // Add dependent library instance destructor fuction.
+ //
+ if (libDestructName != null) {
+ this.libDestructList.add(new String[] {libDestructName, libModuleType});
+ }
}
}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
index 042f0447ef..ca415daf90 100644
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
+++ b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java
@@ -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) {
@@ -231,27 +237,26 @@ public class AutogenLibOrder {
//
// Append the remaining library instance to the end of sorted list
//
- boolean HasError = false;
+ boolean HasError = false;
for (int i = 0; i < libInstanceList.length; ++i) {
- HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(libInstanceList[i]);
+ HashSet<ModuleIdentification> consumedBy = libInstanceConsumedBy.get(libInstanceList[i]);
if (consumedBy.size() > 0 && libInstanceList[i].hasConstructor()) {
EdkLog.log(EdkLog.EDK_ERROR, libInstanceList[i].getName()
+ " 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());
- }
- HasError = true;
+ 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());
+ }
+ HasError = true;
}
if (!orderList.contains(libInstanceList[i])) {
orderList.add(libInstanceList[i]);
}
}
- if (HasError) {
- throw new AutoGenException("Circular dependency in library instances is found!");
- }
+ if (HasError) {
+ throw new AutoGenException("Circular dependency in library instances is found!");
+ }
return orderList;
}
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
index 17f7541e09..78bea2a434 100644
--- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
+++ b/Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
@@ -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(){