]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
MsaOwner usable
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / ModuleInfo.java
index d53c7b93f746ce4092c7cf4417a2e1a880ee1ac3..aa19522e02d1dd2af8e75ef9187c9a8485678495 100644 (file)
@@ -15,68 +15,105 @@ package org.tianocore.migration;
 import java.io.*;\r
 import java.util.*;\r
 \r
+import org.tianocore.UsageTypes;\r
+\r
 /*\r
-       Class ModuleInfo is built for scanning the source files, it contains all the needed\r
+    Class ModuleInfo is built for scanning the source files, it contains all the needed\r
 information and all the temporary data.\r
 */\r
 public final class ModuleInfo {\r
-       ModuleInfo(String modulepath) throws Exception {\r
-               this.modulepath = modulepath;\r
-       }\r
+    ModuleInfo(String modulepath) throws Exception {\r
+        this.modulepath = modulepath;\r
+        this.temppath = MigrationTool.getTempDir(this.modulepath);\r
+    }\r
+\r
+    public final String modulepath;\r
+    public final String temppath;\r
+    \r
+    private MsaOwner msaowner = MsaOwner.initNewMsaOwner();\r
+    \r
+    public String modulename = null;\r
+    public String guidvalue = null;\r
+    public String moduletype = null;\r
+    public String entrypoint = null;\r
+    \r
+    public final Set<String> localmodulesources = new HashSet<String>();        //contains both .c and .h\r
+    public final Set<String> preprocessedccodes = new HashSet<String>();\r
+    public final Set<String> msaorinf = new HashSet<String>();                //only a little, hash may be too big for this\r
+    public final Set<String> infincludes = new HashSet<String>();\r
+    public final Set<String> infsources = new HashSet<String>();\r
+    \r
+    public final Set<String> hashfuncc = new HashSet<String>();\r
+    public final Set<String> hashfuncd = new HashSet<String>();\r
+    public final Set<String> hashnonlocalfunc = new HashSet<String>();\r
+    public final Set<String> hashnonlocalmacro = new HashSet<String>();\r
+    public final Set<String> hashEFIcall = new HashSet<String>();\r
+    public final Set<String> hashr8only = new HashSet<String>();\r
+    public final Set<String> hashmacro = new HashSet<String>();\r
+    \r
+    public final Set<String> hashrequiredr9libs = new HashSet<String>();    // hashrequiredr9libs is now all added in SourceFileReplacer \r
+    public final Set<String> guids = new HashSet<String>();\r
+    public final Set<String> protocols = new HashSet<String>();\r
+    public final Set<String> ppis = new HashSet<String>();\r
 \r
-       public final String modulepath;\r
-       \r
-       public String modulename = null;\r
-       public String guidvalue = null;\r
-       public String moduletype = null;\r
-       public String entrypoint = null;\r
-       \r
-       public final Set<String> localmodulesources = new HashSet<String>();            //contains both .c and .h\r
-       public final Set<String> preprocessedccodes = new HashSet<String>();\r
-       public final Set<String> msaorinf = new HashSet<String>();                              //only a little, hash may be too big for this\r
-       \r
-       public final Set<String> hashfuncc = new HashSet<String>();\r
-       public final Set<String> hashfuncd = new HashSet<String>();\r
-       public final Set<String> hashnonlocalfunc = new HashSet<String>();\r
-       public final Set<String> hashnonlocalmacro = new HashSet<String>();\r
-       public final Set<String> hashEFIcall = new HashSet<String>();\r
-       public final Set<String> hashr8only = new HashSet<String>();\r
-       \r
-       public final Set<String> hashrequiredr9libs = new HashSet<String>();    // hashrequiredr9libs is now all added in SourceFileReplacer \r
-       public final Set<String> guid = new HashSet<String>();\r
-       public final Set<String> protocol = new HashSet<String>();\r
-       public final Set<String> ppi = new HashSet<String>();\r
+    //-----------------------------------------------------------------------------------//\r
 \r
-       public final String getModuleType() {\r
-               if (moduletype.contains("PEI")) {\r
-                       return "PEIM";\r
-               } else {\r
-                       return "DXE_DRIVER";\r
-               }\r
-       }\r
-       \r
-       public final void enroll(String filepath) throws Exception {\r
-               String temp = null;\r
-               if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
-                               filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
-                       localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r
-               } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
-                       temp = filepath.replace(modulepath + File.separator, "");\r
-                       if (!temp.contains(File.separator)) {                                                   // .inf in subdirectory is not regarded\r
-                               msaorinf.add(temp);\r
-                       }\r
-               }\r
-       }\r
+    public final boolean addProtocol (String proname, UsageTypes.Enum usage) {\r
+        //protocols.add(proname);\r
+        return msaowner.addProtocol(proname, usage);\r
+    }\r
+    \r
+    public final boolean addPpi (String ppiname, UsageTypes.Enum usage) {\r
+        //ppis.add(ppiname);\r
+        return msaowner.addPpi(ppiname, usage);\r
+    }\r
+    \r
+    public final boolean addGuid (String guidname, UsageTypes.Enum usage) {\r
+        //guids.add(guidname);\r
+        return msaowner.addGuid(guidname, usage);\r
+    }\r
+    \r
+    public final boolean addLibraryClass(String name, UsageTypes.Enum usage) {\r
+        //hashrequiredr9libs.add(name);\r
+        return msaowner.addLibraryClass(name, usage);\r
+    }\r
+    \r
+    //-----------------------------------------------------------------------------------//\r
+    \r
+    public final String getModuleType() {\r
+        if (moduletype.contains("PEI")) {\r
+            return "PEIM";\r
+        } else {\r
+            return "DXE_DRIVER";\r
+        }\r
+    }\r
+    \r
+    public final void enroll(String filepath) throws Exception {\r
+        String temp = null;\r
+        if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
+                filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
+            localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r
+        } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
+            temp = filepath.replace(modulepath + File.separator, "");\r
+            if (!temp.contains(File.separator)) {                            // .inf in subdirectory is not regarded\r
+                msaorinf.add(temp);\r
+            }\r
+        }\r
+    }\r
 \r
-       public static final boolean isModule(String path) {\r
-               String[] list = new File(path).list();\r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       if (!new File(list[i]).isDirectory()) {\r
-                               if (list[i].contains(".inf") || list[i].contains(".msa")) {\r
-                                       return true;\r
-                               }\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
+    public static final boolean isModule(String path) {\r
+        String[] list = new File(path).list();\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            if (!new File(list[i]).isDirectory()) {\r
+                if (list[i].contains(".inf") || list[i].contains(".msa")) {\r
+                    return true;\r
+                }\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    public final MsaOwner getMsaOwner() {\r
+        return msaowner;\r
+    }\r
 }
\ No newline at end of file