]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
functions in moduleinfo 2 migrationtool
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / ModuleInfo.java
index 9a097872e5ca4296b3dd5a0a2a572729fbddb99e..9e58ed914ae3e3bafabfcab6e18808d092ce2e13 100644 (file)
@@ -28,8 +28,6 @@ public class ModuleInfo {
                        outputpath = modulepath; \r
                }\r
                ModuleInfo.ui.println(outputpath);\r
-               \r
-               mainFlow();\r
        }\r
 \r
        public String modulepath = null;\r
@@ -56,75 +54,77 @@ public class ModuleInfo {
        public Set<String> guid = new HashSet<String>();\r
        public Set<String> protocol = new HashSet<String>();\r
        public Set<String> ppi = new HashSet<String>();\r
+\r
+       public final void enroll(String filepath) throws Exception {\r
+               String[] temp;\r
+               if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
+                               filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
+                       temp = filepath.split("\\\\");\r
+                       localmodulesources.add(temp[temp.length - 1]);\r
+               } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
+                       temp = filepath.split("\\\\");\r
+                       msaorinf.add(temp[temp.length - 1]);\r
+               }\r
+       }\r
+\r
+       private 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
+       //---------------------------------------------------------------------------//\r
        \r
-       private void mainFlow() throws Exception {\r
+       private static final void manipulate(ModuleInfo mi) throws Exception {\r
                \r
-               ModuleReader.ModuleScan(this);\r
+               ModuleReader.ModuleScan(mi);\r
                \r
-               SourceFileReplacer.flush(this); // some adding library actions are taken here,so it must be put before "MsaWriter"\r
+               SourceFileReplacer.flush(mi);   // some adding library actions are taken here,so it must be put before "MsaWriter"\r
                \r
                // show result\r
                if (ModuleInfo.printModuleInfo) {\r
                        ModuleInfo.ui.println("\nModule Information : ");\r
-                       ModuleInfo.ui.println("Entrypoint : " + entrypoint);\r
-                       show(protocol, "Protocol : ");\r
-                       show(ppi, "Ppi : ");\r
-                       show(guid, "Guid : ");\r
-                       show(hashfuncc, "call : ");\r
-                       show(hashfuncd, "def : ");\r
-                       show(hashEFIcall, "EFIcall : ");\r
-                       show(hashnonlocalmacro, "macro : ");\r
-                       show(hashnonlocalfunc, "nonlocal : ");\r
-                       show(hashr8only, "hashr8only : ");\r
+                       ModuleInfo.ui.println("Entrypoint : " + mi.entrypoint);\r
+                       show(mi.protocol, "Protocol : ");\r
+                       show(mi.ppi, "Ppi : ");\r
+                       show(mi.guid, "Guid : ");\r
+                       show(mi.hashfuncc, "call : ");\r
+                       show(mi.hashfuncd, "def : ");\r
+                       show(mi.hashEFIcall, "EFIcall : ");\r
+                       show(mi.hashnonlocalmacro, "macro : ");\r
+                       show(mi.hashnonlocalfunc, "nonlocal : ");\r
+                       show(mi.hashr8only, "hashr8only : ");\r
                }\r
                \r
-               new MsaWriter(this).flush();\r
+               new MsaWriter(mi).flush();\r
 \r
                if (ModuleInfo.doCritic) {\r
-               Critic.fireAt(outputpath + File.separator + "Migration_" + modulename);\r
+               Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename);\r
                }\r
                \r
-               Common.deleteDir(modulepath + File.separator + "temp");\r
+               Common.deleteDir(mi.modulepath + File.separator + "temp");\r
                \r
                ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error);\r
                ModuleInfo.ui.println("Complete!");\r
-               ModuleInfo.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");\r
-               ModuleInfo.ui.println("Your logfile was placed here: " + modulepath);\r
+               ModuleInfo.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");\r
+               ModuleInfo.ui.println("Your logfile was placed here: " + mi.modulepath);\r
        }\r
        \r
-       private void show(Set<String> hash, String show) {\r
+       private static final void show(Set<String> hash, String show) {\r
                ModuleInfo.ui.println(show + hash.size());\r
                ModuleInfo.ui.println(hash);\r
        }\r
        \r
-       public final void enroll(String filepath) throws Exception {\r
-               String[] temp;\r
-               if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
-                               filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
-                       temp = filepath.split("\\\\");\r
-                       localmodulesources.add(temp[temp.length - 1]);\r
-               } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
-                       temp = filepath.split("\\\\");\r
-                       msaorinf.add(temp[temp.length - 1]);\r
-               }\r
-       }\r
-\r
        public static final void seekModule(String filepath) throws Exception {\r
-               if (isModule(filepath)) {\r
-                       new ModuleInfo(filepath);\r
-               }\r
-       }\r
-\r
-       private 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
+               if (ModuleInfo.isModule(filepath)) {\r
+                       manipulate(new ModuleInfo(filepath));\r
                }\r
-               return false;\r
        }\r
 \r
        public static final void triger(String path) throws Exception {\r
@@ -133,8 +133,6 @@ public class ModuleInfo {
                Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
        }\r
        \r
-       //---------------------------------------------------------------------------//\r
-       \r
        public static UI ui = null;\r
        public static Database db = null;\r
        \r