mirror of https://github.com/acidanthera/audk.git
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:
parent
2a870f5348
commit
e64c74dd8c
|
@ -163,45 +163,16 @@ public class FfsProcess {
|
|||
}
|
||||
|
||||
//
|
||||
// if module specify sections itself, it's okay
|
||||
// otherwise find sections from WORKSPACE default setting with
|
||||
// ComponentType
|
||||
// If FfsFormatKey is not null, report exception and fail build
|
||||
// Otherwise report warning message
|
||||
//
|
||||
if (ffs == null) {
|
||||
File file = new File(project.getProperty("COMMON_FILE"));
|
||||
//
|
||||
// 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());
|
||||
if (buildType == null) {
|
||||
System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");
|
||||
}
|
||||
else {
|
||||
throw new BuildException("Can't find FfsFormatKey [" + buildType + "] in FPD file. ");
|
||||
}
|
||||
|
||||
if (ffs == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue