Add checking for whether module's FfsFormatKey is specified or not. For driver, fail build if can't find FfsFormatKey in FPD.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1041 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-07-19 05:44:44 +00:00
parent 2a870f5348
commit e64c74dd8c
1 changed files with 7 additions and 36 deletions

View File

@ -163,45 +163,16 @@ public class FfsProcess {
} }
// //
// if module specify sections itself, it's okay // If FfsFormatKey is not null, report exception and fail build
// otherwise find sections from WORKSPACE default setting with // Otherwise report warning message
// ComponentType
// //
if (ffs == null) { if (buildType == null) {
File file = new File(project.getProperty("COMMON_FILE")); System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");
//
// if common file is not existed, just return
//
if (!file.exists()) {
return false;
}
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder dombuilder = domfac.newDocumentBuilder();
InputStream is = new FileInputStream(file);
Document doc = dombuilder.parse(is);
Element root = doc.getDocumentElement();
NodeList items = root.getChildNodes();
for (int i = 0; i < items.getLength(); i++) {
Node node = items.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = node.getNodeName();
if (nodeName.equalsIgnoreCase("Ffs")) {
NamedNodeMap attr = node.getAttributes();
Node type = attr.getNamedItem("type");
if (type != null) {
if (isMatch(type.getTextContent(), buildType)) {
ffs = node;
return true;
}
}
}
}
}
} catch (Exception e) {
throw new BuildException("Parse COMMON_FILE [" + file.getPath() + "] error!\n" + e.getMessage());
} }
else {
throw new BuildException("Can't find FfsFormatKey [" + buildType + "] in FPD file. ");
} }
if (ffs == null) { if (ffs == null) {
return false; return false;
} else { } else {