From e64c74dd8c7c3534e8b3a40da63400abe8383db0 Mon Sep 17 00:00:00 2001 From: wuyizhong Date: Wed, 19 Jul 2006 05:44:44 +0000 Subject: [PATCH] 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 --- .../org/tianocore/build/FfsProcess.java | 43 +++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java index 6660382e64..641234e1e9 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java @@ -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 { -- 2.39.2