]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
1. Fix EDKT281 there are too many values in the list of Hob's Guid C Name. only the...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / workspace / WorkspaceTools.java
index 9c8368b0d7c45b0a06fc529e6cc073a670bbbe6a..4e40d59efc16f54fd5d0db2018ae14ba5be93434 100644 (file)
@@ -25,7 +25,9 @@ import org.tianocore.DbPathAndFilename;
 import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.MsaFilesDocument.MsaFiles;\r
+import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r
 import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
+import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
 import org.tianocore.SourceFilesDocument.SourceFiles;\r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.GlobalData;\r
@@ -294,8 +296,42 @@ public class WorkspaceTools {
         for (int index = 0; index < modulePaths.size(); index++) {\r
             modulePath = modulePaths.get(index);\r
             ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);\r
+            if (id != null) {\r
+                v.addElement(id);\r
+            }\r
+        }\r
+        Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
+        return v;\r
+    }\r
 \r
-            v.addElement(id);\r
+    /**\r
+     Get all module basic information from a platform\r
+     \r
+     @param id Package id\r
+     @return A vector includes all modules' basic information\r
+     \r
+     **/\r
+    public Vector<ModuleIdentification> getAllModules(PlatformIdentification fid) {\r
+        Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
+        PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformById(fid).getXmlFpd();\r
+        if (fpd.getFrameworkModules() != null) {\r
+            for (int index = 0; index < fpd.getFrameworkModules().getModuleSAList().size(); index++) {\r
+                String guid = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleGuid();\r
+                String version = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleVersion();\r
+                ModuleIdentification id = GlobalData.openingModuleList.getIdByGuidVersion(guid, version);\r
+                if (id != null) {\r
+                    boolean isFind = false;\r
+                    for (int indexOfModules = 0; indexOfModules < v.size(); indexOfModules++) {\r
+                        if (v.elementAt(indexOfModules).equals(id)) {\r
+                            isFind = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFind) {\r
+                        v.addElement(id);\r
+                    }\r
+                }\r
+            }\r
         }\r
         Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
         return v;\r
@@ -380,12 +416,24 @@ public class WorkspaceTools {
      \r
      @return Vector\r
      **/\r
-    public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd) {\r
+    public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd, String type) {\r
         Vector<String> vector = new Vector<String>();\r
+        boolean isFound = false;\r
         if (spd.getGuidDeclarations() != null) {\r
             if (spd.getGuidDeclarations().getEntryList().size() > 0) {\r
                 for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {\r
-                    vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
+                    Vector<String> vArch = Tools.convertListToVector(spd.getGuidDeclarations().getEntryList()\r
+                                                                        .get(index).getGuidTypeList());\r
+                    for (int indexOfArch = 0; indexOfArch < vArch.size(); indexOfArch++) {\r
+                        if (vArch.get(indexOfArch).equals(type)) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if ((isFound) || (vArch == null) || (vArch.size() < 1)) {\r
+                        vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
+                        isFound = false;\r
+                    }\r
                 }\r
             }\r
         }\r
@@ -432,6 +480,21 @@ public class WorkspaceTools {
         return vector;\r
     }\r
 \r
+    public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r
+                                                                                                     .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                                      .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
     public Vector<String> getAllProtocolDeclarationsFromWorkspace() {\r
         Vector<String> vector = new Vector<String>();\r
         for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
@@ -446,6 +509,20 @@ public class WorkspaceTools {
         return vector;\r
     }\r
 \r
+    public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                                  .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                                   .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
     public Vector<String> getAllPpiDeclarationsFromWorkspace() {\r
         Vector<String> vector = new Vector<String>();\r
         for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
@@ -460,12 +537,45 @@ public class WorkspaceTools {
         return vector;\r
     }\r
 \r
-    public Vector<String> getAllGuidDeclarationsFromWorkspace() {\r
+    public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                             .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                              .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
+    public Vector<String> getAllGuidDeclarationsFromWorkspace(String type) {\r
         Vector<String> vector = new Vector<String>();\r
         for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
-            Vector<String> v = getAllGuidDeclarationsFromPackage(GlobalData.openingPackageList\r
+            Vector<String> v = getAllGuidDeclarationsFromPackage(\r
+                                                                 GlobalData.openingPackageList\r
                                                                                               .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
-                                                                                                                                                  .get(index)));\r
+                                                                                                                                                  .get(index)),\r
+                                                                 type);\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
+    public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid, String type) {\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllGuidDeclarationsFromPackage(\r
+                                                                 GlobalData.openingPackageList\r
+                                                                                              .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                               .get(index)),\r
+                                                                 type);\r
             if (v != null && v.size() > 0) {\r
                 vector.addAll(v);\r
             }\r
@@ -490,6 +600,21 @@ public class WorkspaceTools {
         return vector;\r
     }\r
 \r
+    public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
+        PcdVector vector = new PcdVector();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                        .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                         .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+\r
+        }\r
+        Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
     /**\r
      Find a module's package's id\r
      \r
@@ -670,4 +795,53 @@ public class WorkspaceTools {
 \r
         return v;\r
     }\r
+\r
+    /**\r
+     Get a module's all package dependencies\r
+     \r
+     @param mid The module id\r
+     @return A vector of all package dependency ids\r
+     \r
+     **/\r
+    public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {\r
+        Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();\r
+        ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);\r
+        if (msa != null) {\r
+            PackageDependencies pd = msa.getPackageDependencies();\r
+            if (pd != null) {\r
+                for (int index = 0; index < pd.getPackageList().size(); index++) {\r
+                    String guid = pd.getPackageList().get(index).getPackageGuid();\r
+                    String version = pd.getPackageList().get(index).getPackageVersion();\r
+                    PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);\r
+                    if (pid != null) {\r
+                        vpid.addElement(pid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return vpid;\r
+    }\r
+\r
+    public Vector<String> getAllModuleGuidXref() {\r
+        Vector<String> v = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {\r
+            ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();\r
+            v.addElement(id.getGuid() + " " + id.getName());\r
+        }\r
+        return v;\r
+    }\r
+\r
+    public Vector<String> getModuleArch(ModuleIdentification id) {\r
+        Vector<String> v = new Vector<String>();\r
+        ModuleSurfaceArea msa = null;\r
+        if (id != null) {\r
+            msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(id);\r
+        }\r
+        if (msa != null) {\r
+            if (msa.getModuleDefinitions() != null) {\r
+                v = Tools.convertListToVector(msa.getModuleDefinitions().getSupportedArchitectures());\r
+            }\r
+        }\r
+        return v;\r
+    }\r
 }\r