Fix two bugs for current PCD workflow:

1) Switch build message on for PCD action.
2) If SPD file does *not* contains PCD information, it is illegal.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@76 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-04-28 13:52:29 +00:00
parent 2a8b1c0a8a
commit 3d52de132f
3 changed files with 23 additions and 20 deletions

View File

@ -799,7 +799,7 @@ public class FpdParserTask extends Task {
collectAction.perform (
getProject().getProperty("WORKSPACE_DIR"),
fpdFilename.getPath(),
ActionMessage.NULL_MESSAGE_LEVEL
ActionMessage.MAX_MESSAGE_LEVEL
);
} catch (Exception exp) {
throw new BuildException (exp.getMessage());

View File

@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.build.pcd.action;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
import org.tianocore.build.pcd.exception.BuildActionException;
/** BuildAction is the parent class for all action related to ant Task. This class will
@ -68,9 +69,7 @@ abstract class BuildAction extends Task {
//
// Comment following code because in console debug environment, we can't
// get Project instance.
//((Task) action).log(errorText, Project.MSG_INFO);
//
System.out.println(logStr);
((Task) action).log(logStr, Project.MSG_INFO);
}
/**
@ -87,9 +86,7 @@ abstract class BuildAction extends Task {
//
// Comment following code because in console debug environment, we can't
// get Project instance.
//((Task) action).log(warningText, Project.MSG_WARN);
//
System.out.println(warningStr);
((Task) action).log(warningStr, Project.MSG_WARN);
}
/**

View File

@ -501,7 +501,8 @@ public class CollectPCDAction {
token.skuDataArrayEnabled = pcdBuildData.getSkuDataArrayEnable();
token.assignedtokenNumber = Integer.decode(pcdBuildData.getToken().getStringValue());
skuDataArray = pcdBuildData.getSkuDataArray1();
token.datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());
if(skuDataArray != null) {
for(skuIndex = 0; skuIndex < skuDataArray.size(); skuIndex ++) {
//
@ -550,11 +551,12 @@ public class CollectPCDAction {
private void updateTokenBySPD(UsageInstance usageInstance,
String packageFullPath)
throws EntityException {
PackageSurfaceAreaDocument pkgDoc = null;
List<PcdDefinitions.PcdEntry> pcdEntryArray = new ArrayList<PcdDefinitions.PcdEntry>();
int index;
boolean isFoundInSpd = false;
Token.DATUM_TYPE datumType = Token.DATUM_TYPE.UNKNOWN;
PackageSurfaceAreaDocument pkgDoc = null;
PcdDefinitions pcdDefinitions = null;
List<PcdDefinitions.PcdEntry> pcdEntryArray = new ArrayList<PcdDefinitions.PcdEntry>();
int index = 0;
boolean isFoundInSpd = false;
Token.DATUM_TYPE datumType = Token.DATUM_TYPE.UNKNOWN;
try {
pkgDoc =(PackageSurfaceAreaDocument)XmlObject.Factory.parse(new File(packageFullPath));
@ -563,8 +565,18 @@ public class CollectPCDAction {
} catch(XmlException xmlE) {
throw new EntityException("Can't parse the FPD xml fle:" + packageFullPath);
}
pcdDefinitions = pkgDoc.getPackageSurfaceArea().getPcdDefinitions();
//
// It is illege for SPD file does not contains any PCD information.
//
if (pcdDefinitions == null) {
return;
}
pcdEntryArray = pkgDoc.getPackageSurfaceArea().getPcdDefinitions().getPcdEntryList();
pcdEntryArray = pcdDefinitions.getPcdEntryList();
if (pcdEntryArray == null) {
return;
}
for(index = 0; index < pcdEntryArray.size(); index ++) {
if(pcdEntryArray.get(index).getCName().equalsIgnoreCase(
usageInstance.parentToken.cName)) {
@ -616,12 +628,6 @@ public class CollectPCDAction {
}
}
}
if(!isFoundInSpd ) {
ActionMessage.warning(this,
"Can *not* find the PCD token " + usageInstance.parentToken.cName +
" in SPD file!");
}
}
/**