Fix the track EDKT187: If a module do not use PCD, PcdLib library class need not be exist in its MSA file.

The fixing is judge whether the module's library instance use PCD, if use, build tools will add PcdLib into module's autogen.h automatically.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1297 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-08-16 13:59:00 +00:00
parent 8c4eeeb6a5
commit bd4814401e
3 changed files with 41 additions and 8 deletions

View File

@ -83,6 +83,11 @@ public class AutoGen {
///
private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;
///
/// Judge whether this module's library instance use PcdLib library class
///
private boolean isModuleLibraryInstanceUsePcd;
///
/// The protocl list which records in module or library surface area and
/// it's dependence on library instance surface area.
@ -328,6 +333,28 @@ public class AutoGen {
//
String[] libClassList = SurfaceAreaQuery
.getLibraryClasses(CommonDefinition.AlwaysConsumed,this.arch);
boolean isModuleConsumePcdLib = false;
List<String> libClassArray = new ArrayList<String>();
for (int index = 0; index < libClassList.length; index++) {
libClassArray.add(libClassList[index]);
//
// Search all library class of a module for PcdLib
//
if (libClassList[index].equalsIgnoreCase(CommonDefinition.pcdLibName)) {
isModuleConsumePcdLib = true;
}
}
//
// If module do not use PCD but module's library use PCD.
//
if (!isModuleConsumePcdLib && this.isModuleLibraryInstanceUsePcd) {
libClassArray.add(CommonDefinition.pcdLibName);
}
libClassList = new String[libClassArray.size()];
libClassArray.toArray(libClassList);
if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
@ -679,7 +706,6 @@ public class AutoGen {
// Get include file from GlobalData's SPDTable according to
// library class name.
//
for (int i = 0; i < libClassList.length; i++) {
includerName = GlobalData.getLibraryClassHeaderFiles(
SurfaceAreaQuery.getDependencePkg(this.arch),
@ -2050,8 +2076,7 @@ public class AutoGen {
// Get override map
//
Map<String, XmlObject> libDoc = GlobalData.getDoc(
libInstanceId, this.arch);
Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);
SurfaceAreaQuery.push(libDoc);
//
// Get <PPis>, <Protocols>, <Guids> list of this library
@ -2066,6 +2091,9 @@ public class AutoGen {
.getProtocolNotifyArray(this.arch);
String[] guidList = SurfaceAreaQuery
.getGuidEntryArray(this.arch);
String[] libraryClassList = SurfaceAreaQuery.getLibraryClasses(
CommonDefinition.AlwaysConsumed,
this.arch);
PackageIdentification[] pkgList = SurfaceAreaQuery.getDependencePkg(this.arch);
//
@ -2097,7 +2125,11 @@ public class AutoGen {
this.mDepPkgList.add(pkgList[index]);
}
}
for (index = 0; index < libraryClassList.length; index++) {
if (libraryClassList[index].equalsIgnoreCase(CommonDefinition.pcdLibName)) {
this.isModuleLibraryInstanceUsePcd = true;
}
}
//
// If not yet parse this library instance's constructor
// element,parse it.

View File

@ -59,6 +59,8 @@ public class CommonDefinition {
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
public final static String flashMapH = "FlashMap.h";
public final static String pcdLibName = "PcdLib";
//
// The defintions for identifying current module
// is PEI Pcd driver or Dxe Pcd driver.

View File

@ -624,10 +624,9 @@ public class SurfaceAreaQuery {
libraryClassName.add(libraryClassList[i].getKeyword());
}
}
String[] libraryArray = new String[libraryClassName.size()];
for (int i = 0; i < libraryClassName.size(); i++) {
libraryArray[i] = libraryClassName.get(i);
}
String[] libraryArray = new String[libraryClassName.size()];
libraryClassName.toArray(libraryArray);
return libraryArray;
}