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