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