]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
a. Add support arch. filter for library instance selection in FPD file.
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFileContents.java
index b15e5d28d8ddebdba0920722c9d3cc5670fa5459..fc49cd4151faf641964d3a1e920b9e3a3cdc344f 100644 (file)
@@ -115,8 +115,8 @@ public class FpdFileContents {
               if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {\r
                   continue;\r
               }\r
-              String ModuleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() +\r
-               " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r
+              String ModuleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion() +\r
+               " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r
               List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();\r
               ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();\r
               while (lpi.hasNext()) {\r
@@ -358,6 +358,9 @@ public class FpdFileContents {
                 if (!cursor.isText()) {\r
                     break;\r
                 }\r
+                if (cursor.getObject() == null) {\r
+                    break;\r
+                }\r
                 String s = cursor.getTextValue();\r
                 if (s.matches(regExpNewLineAndSpaces)) {\r
                     continue;\r
@@ -371,8 +374,10 @@ public class FpdFileContents {
             cursor.pop();\r
             cursor.removeXml();\r
             if (getFrameworkModulesCount() == 0) {\r
-                cursor.toParent();\r
-                cursor.removeXml();\r
+                cursor.dispose();\r
+                removeElement(getfpdFrameworkModules());\r
+                fpdFrameworkModules = null;\r
+                return;\r
             }\r
         }\r
         cursor.dispose();\r
@@ -475,7 +480,7 @@ public class FpdFileContents {
         String[] s = moduleInfo.split(" ");\r
         for(int i = 0; i < al.size(); ++i){\r
             String consumer = al.get(i);\r
-            if (consumer.contains(s[0]) && consumer.contains(s[2])){\r
+            if (consumer.contains(s[0].toLowerCase()) && consumer.contains(s[2].toLowerCase())){\r
                 String[] consumerPart = consumer.split(" ");\r
                 if (!consumerPart[4].equals(s[4])) {\r
                     continue;\r
@@ -573,12 +578,21 @@ public class FpdFileContents {
                     //\r
                     // change item type while not updating dynPcdData????\r
                     //\r
-                    pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
-                    if(pcdData.getDatumType().equals("VOID*")) {\r
+                    if (itemType != null) {\r
+                        pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
+                    }\r
+                    \r
+                    if(pcdData.getDatumType().equals("VOID*") && maxSize != null) {\r
                         pcdData.setMaxDatumSize(new Integer(maxSize));\r
                     }\r
-                    pcdData.setValue(value);\r
-                    defaultPcdValue.put(cName + " " + tsGuid, value);\r
+                    //\r
+                    // if value input is null, keep old value untouched.\r
+                    //\r
+                    if (value != null) {\r
+                        pcdData.setValue(value);\r
+                        defaultPcdValue.put(cName + " " + tsGuid, value);\r
+                    }\r
+                    \r
                     break;\r
                 }\r
             }\r
@@ -2034,6 +2048,45 @@ public class FpdFileContents {
         }\r
     }\r
     \r
+    public void addModuleIntoBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {\r
+        if (moduleInBuildOptionsUserExtensions (fvName, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {\r
+            return;\r
+        }\r
+        ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+        QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+        QName elementModule = new QName(xmlNs, "Module");\r
+        while (li.hasNext()) {\r
+            UserExtensionsDocument.UserExtensions ues = li.next();\r
+            if (!ues.getUserID().equals("IMAGES")) {\r
+                continue;\r
+            }\r
+            XmlCursor cursor = ues.newCursor();\r
+            cursor.toFirstChild();\r
+            String elementName = cursor.getTextValue();\r
+            if (elementName.equals(fvName)) {\r
+                cursor.toNextSibling(elementIncludeModules);\r
+                cursor.toLastChild();\r
+                cursor.toEndToken();\r
+                cursor.toNextToken();\r
+                cursor.beginElement(elementModule);\r
+                cursor.insertAttributeWithValue("ModuleGuid", moduleGuid);\r
+                if (!moduleVersion.equals("null") && moduleVersion.length() != 0) {\r
+                    cursor.insertAttributeWithValue("ModuleVersion", moduleVersion);\r
+                }\r
+                cursor.insertAttributeWithValue("PackageGuid", packageGuid);\r
+                if (!packageVersion.equals("null") && packageVersion.length() != 0) {\r
+                    cursor.insertAttributeWithValue("PackageVersion", packageVersion);\r
+                }\r
+                \r
+                cursor.insertAttributeWithValue("Arch", arch);\r
+                cursor.dispose();\r
+                return;\r
+            }\r
+            cursor.dispose();\r
+        }\r
+        \r
+    }\r
+    \r
     public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r
         UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r
         if (udats == null) {\r
@@ -2369,7 +2422,9 @@ public class FpdFileContents {
         if (sections == null){\r
             sections = ffs.addNewSections();\r
         }\r
-        sections.addNewSections().setEncapsulationType(encapType);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = sections.addNewSections();\r
+        sections2.setEncapsulationType(encapType);\r
+        sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString("EFI_SECTION_PE32"));\r
     }\r
     \r
     public void removeBuildOptionsFfsSectionsSections(int i, int j) {\r
@@ -2495,9 +2550,9 @@ public class FpdFileContents {
             ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();\r
             while(li.hasNext()) {\r
                 BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();\r
-                if (section.isSetSectionType()) {\r
-                    al.add(section.getSectionType().toString());\r
-                }\r
+//                if (section.isSetSectionType()) {\r
+                    al.add(section.getSectionType()+"");\r
+//                }\r
                 \r
             }\r
         }\r
@@ -2546,7 +2601,7 @@ public class FpdFileContents {
                 if (ffs.getSections().getSectionList() != null){\r
                     ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Section> li = ffs.getSections().getSectionList().listIterator();\r
                     while (li.hasNext()) {\r
-                        firstLevelSection.add(li.next().getSectionType().toString());\r
+                        firstLevelSection.add(li.next().getSectionType()+"");\r
                     }\r
                 }\r
                 if (ffs.getSections().getSectionsList() != null) {\r