]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
1 package org
.tianocore
.migration
;
6 public class MigrationTool
{
7 public static UI ui
= null;
8 public static Database db
= null;
10 public static String MIGRATIONCOMMENT
= "//%$//";
12 public static boolean printModuleInfo
= false;
13 public static boolean doCritic
= false;
14 public static boolean defaultoutput
= false;
16 public static final HashMap
<ModuleInfo
, String
> ModuleInfoMap
= new HashMap
<ModuleInfo
, String
>();
18 private static final void mainFlow(ModuleInfo mi
) throws Exception
{
20 ModuleReader
.ModuleScan(mi
);
22 //MigrationTool.ui.yesOrNo("go on replace?");
23 SourceFileReplacer
.flush(mi
); // some adding library actions are taken here,so it must be put before "MsaWriter"
25 //MigrationTool.ui.yesOrNo("go on show?");
27 if (MigrationTool
.printModuleInfo
) {
28 MigrationTool
.ui
.println("\nModule Information : ");
29 MigrationTool
.ui
.println("Entrypoint : " + mi
.entrypoint
);
30 show(mi
.protocol
, "Protocol : ");
31 show(mi
.ppi
, "Ppi : ");
32 show(mi
.guid
, "Guid : ");
33 show(mi
.hashfuncc
, "call : ");
34 show(mi
.hashfuncd
, "def : ");
35 show(mi
.hashEFIcall
, "EFIcall : ");
36 show(mi
.hashnonlocalmacro
, "macro : ");
37 show(mi
.hashnonlocalfunc
, "nonlocal : ");
38 show(mi
.hashr8only
, "hashr8only : ");
41 //MigrationTool.ui.yesOrNo("go on msawrite?");
42 new MsaWriter(mi
).flush();
43 //MigrationTool.ui.yesOrNo("go on critic?");
45 if (MigrationTool
.doCritic
) {
46 Critic
.fireAt(ModuleInfoMap
.get(mi
) + File
.separator
+ "Migration_" + mi
.modulename
);
49 //MigrationTool.ui.yesOrNo("go on delete?");
50 Common
.deleteDir(mi
.modulepath
+ File
.separator
+ "temp");
52 MigrationTool
.ui
.println("Errors Left : " + MigrationTool
.db
.error
);
53 MigrationTool
.ui
.println("Complete!");
54 //MigrationTool.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");
55 //MigrationTool.ui.println("Your logfile was placed here: " + mi.modulepath);
58 private static final void show(Set
<String
> hash
, String show
) {
59 MigrationTool
.ui
.println(show
+ hash
.size());
60 MigrationTool
.ui
.println(hash
);
63 private static final String
assignOutPutPath(String inputpath
) {
64 if (MigrationTool
.defaultoutput
) {
65 return inputpath
.replaceAll(Common
.strseparate
, "$1");
67 return MigrationTool
.ui
.getFilepath("Please choose where to place the output module");
71 public static final void seekModule(String filepath
) throws Exception
{
72 if (ModuleInfo
.isModule(filepath
)) {
73 ModuleInfoMap
.put(new ModuleInfo(filepath
), assignOutPutPath(filepath
));
77 public static final void startMigrateAll(String path
) throws Exception
{
78 MigrationTool
.ui
.println("Project Migration");
79 MigrationTool
.ui
.println("Copyright (c) 2006, Intel Corporation");
80 Common
.toDoAll(path
, MigrationTool
.class.getMethod("seekModule", String
.class), null, null, Common
.DIR
);
82 Iterator
<ModuleInfo
> miit
= ModuleInfoMap
.keySet().iterator();
83 while (miit
.hasNext()) {
84 mainFlow(miit
.next());
87 ModuleInfoMap
.clear();
90 public static void main(String
[] args
) throws Exception
{
91 ui
= FirstPanel
.getInstance();
92 db
= Database
.getInstance();