Add checking for whether module's FfsFormatKey is specified or not. For driver, fail...
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Jul 2006 05:44:44 +0000 (05:44 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Jul 2006 05:44:44 +0000 (05:44 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1041 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java

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