]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
singleton of Database & FirstPanel
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / MigrationTool.java
CommitLineData
482407d3 1package org.tianocore.migration;\r
2\r
3import java.io.File;\r
4import java.util.Set;\r
5\r
6public class MigrationTool {\r
4f60c26f 7 public static UI ui = null;\r
8 public static Database db = null;\r
9\r
10 public static final String MIGRATIONCOMMENT = "//%$//";\r
11\r
12 public static boolean printModuleInfo = false;\r
13 public static boolean doCritic = false;\r
14 public static boolean defaultoutput = false;\r
15\r
482407d3 16 private static final void manipulate(ModuleInfo mi) throws Exception {\r
17\r
18 ModuleReader.ModuleScan(mi);\r
19 //MigrationTool.ui.yesOrNo("go on replace?");\r
20 SourceFileReplacer.flush(mi); // some adding library actions are taken here,so it must be put before "MsaWriter"\r
21\r
22 //MigrationTool.ui.yesOrNo("go on show?");\r
23 // show result\r
24 if (MigrationTool.printModuleInfo) {\r
25 MigrationTool.ui.println("\nModule Information : ");\r
26 MigrationTool.ui.println("Entrypoint : " + mi.entrypoint);\r
27 show(mi.protocol, "Protocol : ");\r
28 show(mi.ppi, "Ppi : ");\r
29 show(mi.guid, "Guid : ");\r
30 show(mi.hashfuncc, "call : ");\r
31 show(mi.hashfuncd, "def : ");\r
32 show(mi.hashEFIcall, "EFIcall : ");\r
33 show(mi.hashnonlocalmacro, "macro : ");\r
34 show(mi.hashnonlocalfunc, "nonlocal : ");\r
35 show(mi.hashr8only, "hashr8only : ");\r
36 }\r
37\r
38 //MigrationTool.ui.yesOrNo("go on msawrite?");\r
39 new MsaWriter(mi).flush();\r
40 //MigrationTool.ui.yesOrNo("go on critic?");\r
41\r
42 if (MigrationTool.doCritic) {\r
43 Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename);\r
44 }\r
45\r
46 //MigrationTool.ui.yesOrNo("go on delete?");\r
47 Common.deleteDir(mi.modulepath + File.separator + "temp");\r
48\r
49 MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);\r
50 MigrationTool.ui.println("Complete!");\r
51 //MigrationTool.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");\r
52 //MigrationTool.ui.println("Your logfile was placed here: " + mi.modulepath);\r
53 }\r
54\r
55 private static final void show(Set<String> hash, String show) {\r
56 MigrationTool.ui.println(show + hash.size());\r
57 MigrationTool.ui.println(hash);\r
58 }\r
59\r
60 public static final void seekModule(String filepath) throws Exception {\r
61 if (ModuleInfo.isModule(filepath)) {\r
62 manipulate(new ModuleInfo(filepath));\r
63 }\r
64 }\r
65\r
66 public static final void triger(String path) throws Exception {\r
67 MigrationTool.ui.println("Project Migration");\r
68 MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
69 Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
70 }\r
71\r
482407d3 72 public static void main(String[] args) throws Exception {\r
4f60c26f 73 ui = FirstPanel.getInstance();\r
74 db = Database.getInstance();\r
482407d3 75 }\r
76}\r