X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FMigrationTools%2Forg%2Ftianocore%2Fmigration%2FModuleInfo.java;h=d53c7b93f746ce4092c7cf4417a2e1a880ee1ac3;hb=16b7eeef5489a5e16da1574c13df53990ffac2cf;hp=242b5c545026e0961f83a8d23c7afae4a98c4109;hpb=821709bd1b37f1a61fe5c998530083665eb2c854;p=mirror_edk2.git diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java index 242b5c5450..d53c7b93f7 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java @@ -22,22 +22,10 @@ information and all the temporary data. public final class ModuleInfo { ModuleInfo(String modulepath) throws Exception { this.modulepath = modulepath; - - if (ModuleInfo.defaultoutput) { - this.outputpath = this.modulepath.replaceAll(Common.strseparate, "$1"); - } else { - ModuleInfo.ui.println("Choose where to place the result"); - if ((outputpath = ModuleInfo.ui.getFilepath("Please choose where to place the output module")) == null) { - outputpath = modulepath; - } - ModuleInfo.ui.println("Output to: " + outputpath); - } } public final String modulepath; - public String outputpath = null; - public String modulename = null; public String guidvalue = null; public String moduletype = null; @@ -59,12 +47,24 @@ public final class ModuleInfo { public final Set protocol = new HashSet(); public final Set ppi = new HashSet(); + public final String getModuleType() { + if (moduletype.contains("PEI")) { + return "PEIM"; + } else { + return "DXE_DRIVER"; + } + } + public final void enroll(String filepath) throws Exception { + String temp = null; if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) { - localmodulesources.add(filepath.replace(modulepath + "\\", "")); + localmodulesources.add(filepath.replace(modulepath + File.separator, "")); } else if (filepath.contains(".inf") || filepath.contains(".msa")) { - msaorinf.add(filepath.replace(modulepath + "\\", "")); + temp = filepath.replace(modulepath + File.separator, ""); + if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded + msaorinf.add(temp); + } } } @@ -79,76 +79,4 @@ public final class ModuleInfo { } return false; } - - //---------------------------------------------------------------------------// - - private static final void manipulate(ModuleInfo mi) throws Exception { - - ModuleReader.ModuleScan(mi); - //ModuleInfo.ui.yesOrNo("go on replace?"); - SourceFileReplacer.flush(mi); // some adding library actions are taken here,so it must be put before "MsaWriter" - - //ModuleInfo.ui.yesOrNo("go on show?"); - // show result - if (ModuleInfo.printModuleInfo) { - ModuleInfo.ui.println("\nModule Information : "); - ModuleInfo.ui.println("Entrypoint : " + mi.entrypoint); - show(mi.protocol, "Protocol : "); - show(mi.ppi, "Ppi : "); - show(mi.guid, "Guid : "); - show(mi.hashfuncc, "call : "); - show(mi.hashfuncd, "def : "); - show(mi.hashEFIcall, "EFIcall : "); - show(mi.hashnonlocalmacro, "macro : "); - show(mi.hashnonlocalfunc, "nonlocal : "); - show(mi.hashr8only, "hashr8only : "); - } - - //ModuleInfo.ui.yesOrNo("go on msawrite?"); - new MsaWriter(mi).flush(); - //ModuleInfo.ui.yesOrNo("go on critic?"); - - if (ModuleInfo.doCritic) { - Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename); - } - - //ModuleInfo.ui.yesOrNo("go on delete?"); - Common.deleteDir(mi.modulepath + File.separator + "temp"); - - ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error); - ModuleInfo.ui.println("Complete!"); - //ModuleInfo.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result"); - //ModuleInfo.ui.println("Your logfile was placed here: " + mi.modulepath); - } - - private static final void show(Set hash, String show) { - ModuleInfo.ui.println(show + hash.size()); - ModuleInfo.ui.println(hash); - } - - public static final void seekModule(String filepath) throws Exception { - if (ModuleInfo.isModule(filepath)) { - manipulate(new ModuleInfo(filepath)); - } - } - - public static final void triger(String path) throws Exception { - ModuleInfo.ui.println("Project Migration"); - ModuleInfo.ui.println("Copyright (c) 2006, Intel Corporation"); - Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR); - } - - public static UI ui = null; - public static Database db = null; - - public static final String migrationcomment = "//%$//"; - - public static boolean printModuleInfo = false; - public static boolean doCritic = false; - public static boolean defaultoutput = false; - - public static void main(String[] args) throws Exception { - ui = FirstPanel.init(); - db = Database.init(); - } } \ No newline at end of file