From 050e979f683e64d9d747a9ea49bb3deee0dd9ae5 Mon Sep 17 00:00:00 2001 From: alfred Date: Tue, 22 Aug 2006 10:45:49 +0000 Subject: [PATCH] remove MigrationTools.java git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1352 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/Source/MigrationTools/MANIFEST.MF | 2 +- .../Source/MigrationTools/MigrationTools.msa | 1 - .../org/tianocore/migration/FirstPanel.java | 12 ++--- .../org/tianocore/migration/Guid.java | 4 +- .../org/tianocore/migration/Macro.java | 2 +- .../tianocore/migration/MigrationTool.java | 28 ------------ .../org/tianocore/migration/ModuleInfo.java | 45 ++++++++++++------- .../org/tianocore/migration/ModuleReader.java | 16 +++---- .../tianocore/migration/MsaTreeEditor.java | 2 +- .../migration/SourceFileReplacer.java | 32 ++++++------- Tools/bin/MigrationTools | 2 +- Tools/bin/MigrationTools.bat | 2 +- 12 files changed, 67 insertions(+), 81 deletions(-) delete mode 100644 Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java diff --git a/Tools/Source/MigrationTools/MANIFEST.MF b/Tools/Source/MigrationTools/MANIFEST.MF index ae3092ebad..2786db510b 100644 --- a/Tools/Source/MigrationTools/MANIFEST.MF +++ b/Tools/Source/MigrationTools/MANIFEST.MF @@ -1,2 +1,2 @@ Manifest-Version: 1.0 -Main-Class: org.tianocore.migration.MigrationTool +Main-Class: org.tianocore.migration.ModuleInfo diff --git a/Tools/Source/MigrationTools/MigrationTools.msa b/Tools/Source/MigrationTools/MigrationTools.msa index e7c78f4ac8..db02b240b1 100644 --- a/Tools/Source/MigrationTools/MigrationTools.msa +++ b/Tools/Source/MigrationTools/MigrationTools.msa @@ -42,7 +42,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. org/tianocore/migration/SourceFileReplacer.java org/tianocore/migration/UI.java org/tianocore/migration/MsaTreeEditor.java - org/tianocore/migration/MigrationTool.java org/tianocore/migration/Critic.java org/tianocore/migration/Common.java diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java index 77162e854a..b933dac0ea 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java @@ -65,11 +65,11 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList mibox = new JCheckBox("Print ModuleInfo", false); mibox.addItemListener(this); - MigrationTool.printModuleInfo = false; + ModuleInfo.printModuleInfo = false; criticbox = new JCheckBox("Run Critic", true); criticbox.addItemListener(this); - MigrationTool.doCritic = true; + ModuleInfo.doCritic = true; defaultpathbox = new JCheckBox("Use Default Output Path", true); defaultpathbox.addItemListener(this); @@ -211,16 +211,16 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList } } else if (e.getSource() == mibox) { if (e.getStateChange() == ItemEvent.DESELECTED) { - MigrationTool.printModuleInfo = false; + ModuleInfo.printModuleInfo = false; } else if (e.getStateChange() == ItemEvent.SELECTED) { - MigrationTool.printModuleInfo = true; + ModuleInfo.printModuleInfo = true; } } else if (e.getSource() == criticbox) { if (e.getStateChange() == ItemEvent.DESELECTED) { - MigrationTool.doCritic = false; + ModuleInfo.doCritic = false; System.out.println("criticbox DESELECTED"); } else if (e.getStateChange() == ItemEvent.SELECTED) { - MigrationTool.doCritic = true; + ModuleInfo.doCritic = true; System.out.println("criticbox SELECTED"); } } else if (e.getSource() == defaultpathbox) { diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Guid.java b/Tools/Source/MigrationTools/org/tianocore/migration/Guid.java index ed6a7a77f2..61fa2c44b9 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/Guid.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/Guid.java @@ -45,8 +45,8 @@ public class Guid { String temp = null; temp = mtr.group(); - if (MigrationTool.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database - type = MigrationTool.db.getGuidType(temp); + if (ModuleInfo.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database + type = ModuleInfo.db.getGuidType(temp); if (type.matches("Protocol")) { mi.protocol.add(temp); } else if (type.matches("Ppi")) { diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java b/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java index 47c507baf4..615dda06a1 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java @@ -35,7 +35,7 @@ public class Macro { String temp = null; temp = mtr.group(); - if (MigrationTool.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones + if (ModuleInfo.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones if (!unmacro.contains(temp)) { mi.hashnonlocalmacro.add(temp); } diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java deleted file mode 100644 index 9448acf766..0000000000 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java +++ /dev/null @@ -1,28 +0,0 @@ -/** @file - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ -package org.tianocore.migration; - -public class MigrationTool { - 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 void main(String[] args) throws Exception { - ui = FirstPanel.init(); - db = Database.init(); - } -} diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java index aa6e7a2ba0..9a097872e5 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java @@ -23,11 +23,11 @@ public class ModuleInfo { ModuleInfo(String modulepath) throws Exception { this.modulepath = modulepath; - MigrationTool.ui.println("Choose where to place the result"); - if ((outputpath = MigrationTool.ui.getFilepath()) == null) { + ModuleInfo.ui.println("Choose where to place the result"); + if ((outputpath = ModuleInfo.ui.getFilepath()) == null) { outputpath = modulepath; } - MigrationTool.ui.println(outputpath); + ModuleInfo.ui.println(outputpath); mainFlow(); } @@ -64,9 +64,9 @@ public class ModuleInfo { SourceFileReplacer.flush(this); // some adding library actions are taken here,so it must be put before "MsaWriter" // show result - if (MigrationTool.printModuleInfo) { - MigrationTool.ui.println("\nModule Information : "); - MigrationTool.ui.println("Entrypoint : " + entrypoint); + if (ModuleInfo.printModuleInfo) { + ModuleInfo.ui.println("\nModule Information : "); + ModuleInfo.ui.println("Entrypoint : " + entrypoint); show(protocol, "Protocol : "); show(ppi, "Ppi : "); show(guid, "Guid : "); @@ -80,21 +80,21 @@ public class ModuleInfo { new MsaWriter(this).flush(); - if (MigrationTool.doCritic) { + if (ModuleInfo.doCritic) { Critic.fireAt(outputpath + File.separator + "Migration_" + modulename); } Common.deleteDir(modulepath + File.separator + "temp"); - MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error); - MigrationTool.ui.println("Complete!"); - MigrationTool.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result"); - MigrationTool.ui.println("Your logfile was placed here: " + modulepath); + ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error); + ModuleInfo.ui.println("Complete!"); + ModuleInfo.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result"); + ModuleInfo.ui.println("Your logfile was placed here: " + modulepath); } private void show(Set hash, String show) { - MigrationTool.ui.println(show + hash.size()); - MigrationTool.ui.println(hash); + ModuleInfo.ui.println(show + hash.size()); + ModuleInfo.ui.println(hash); } public final void enroll(String filepath) throws Exception { @@ -128,8 +128,23 @@ public class ModuleInfo { } public static final void triger(String path) throws Exception { - MigrationTool.ui.println("Project Migration"); - MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation"); + 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 void main(String[] args) throws Exception { + ui = FirstPanel.init(); + db = Database.init(); + } } \ No newline at end of file diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java index faa3efefb1..ad50952ec8 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java @@ -32,10 +32,10 @@ public final class ModuleReader { String filename = null; if (mi.msaorinf.isEmpty()) { - MigrationTool.ui.println("No INF nor MSA file found!"); + ModuleInfo.ui.println("No INF nor MSA file found!"); System.exit(0); } else { - filename = MigrationTool.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray()); + filename = ModuleInfo.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray()); } if (filename.contains(".inf")) { readInf(filename); @@ -100,7 +100,7 @@ public final class ModuleReader { } if (mtrinfequation.group(1).matches("DPX_SOURCE")) { if (!mi.localmodulesources.contains(mtrinfequation.group(2))) { - MigrationTool.ui.println("DPX File Missing! : " + mtrinfequation.group(2)); + ModuleInfo.ui.println("DPX File Missing! : " + mtrinfequation.group(2)); } } } @@ -109,7 +109,7 @@ public final class ModuleReader { mtrfilename = ptnfilename.matcher(mtrsection.group(2)); while (mtrfilename.find()) { if (!mi.localmodulesources.contains(mtrfilename.group())) { - MigrationTool.ui.println("Source File Missing! : " + mtrfilename.group()); + ModuleInfo.ui.println("Source File Missing! : " + mtrfilename.group()); } } } @@ -137,7 +137,7 @@ public final class ModuleReader { mtrinclude = ptninclude.matcher(line); if (mtrinclude.find() && mi.localmodulesources.contains(mtrinclude.group(1))) { } else { - line = MigrationTool.migrationcomment + line; + line = ModuleInfo.migrationcomment + line; } } outfile.append(line + '\n'); @@ -204,7 +204,7 @@ public final class ModuleReader { matguid = Guid.ptnguid.matcher(line); // several ways to implement this , which one is faster ? : while (matguid.find()) { // 1.currently , find once , then call to identify which is it if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) { // 2.use 3 different matchers , search 3 times to find each - //matguid.appendReplacement(result, MigrationTool.db.getR9Guidname(temp)); // search the database for all 3 kinds of guids , high cost + //matguid.appendReplacement(result, ModuleInfo.db.getR9Guidname(temp)); // search the database for all 3 kinds of guids , high cost } } //matguid.appendTail(result); @@ -221,8 +221,8 @@ public final class ModuleReader { matfuncc = Func.ptnfuncc.matcher(line); while (matfuncc.find()) { if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) { - //MigrationTool.ui.println(ifile + " dofunc " + temp); - //matfuncc.appendReplacement(result, MigrationTool.db.getR9Func(temp)); + //ModuleInfo.ui.println(ifile + " dofunc " + temp); + //matfuncc.appendReplacement(result, ModuleInfo.db.getR9Func(temp)); } } //matfuncc.appendTail(result); diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java index 7bdf028119..2b5e434a61 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java @@ -102,7 +102,7 @@ public class MsaTreeEditor extends JPanel { } private void addNode() { - addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), MigrationTool.ui.getInput("Input Node Name")); + addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), ModuleInfo.ui.getInput("Input Node Name")); } private void addNode(DefaultMutableTreeNode parentNode, Object child) { diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java index fdc8a657a7..7d4c13ba96 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java @@ -44,7 +44,7 @@ public final class SourceFileReplacer { String outname = null; String inname = null; - if (MigrationTool.ui.yesOrNo("Changes will be made to the Source Code. View details?")) { + if (ModuleInfo.ui.yesOrNo("Changes will be made to the Source Code. View details?")) { showdetails = true; } @@ -57,7 +57,7 @@ public final class SourceFileReplacer { } else { outname = inname; } - MigrationTool.ui.println("\nModifying file: " + inname); + ModuleInfo.ui.println("\nModifying file: " + inname); Common.string2file(sourcefilereplace(mi.modulepath + File.separator + "temp" + File.separator + inname), mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + outname); } else if (inname.contains(".h") || inname.contains(".H") || inname.contains(".dxs") || inname.contains(".uni")) { if (inname.contains(".H")) { @@ -65,7 +65,7 @@ public final class SourceFileReplacer { } else { outname = inname; } - MigrationTool.ui.println("\nCopying file: " + inname); + ModuleInfo.ui.println("\nCopying file: " + inname); Common.string2file(Common.file2string(mi.modulepath + File.separator + "temp" + File.separator + inname), mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + outname); } } @@ -77,7 +77,7 @@ public final class SourceFileReplacer { private static final void addr8only() throws Exception { String paragraph = null; - String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c"); + String line = Common.file2string(ModuleInfo.db.DatabasePath + File.separator + "R8Lib.c"); //Common.ensureDir(mi.modulepath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c"); PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c"))); PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.h"))); @@ -128,7 +128,7 @@ public final class SourceFileReplacer { // replace BS -> gBS , RT -> gRT Matcher mat = pat.matcher(line); if (mat.find()) { // add a library here - MigrationTool.ui.println("Converting all BS->gBS, RT->gRT"); + ModuleInfo.ui.println("Converting all BS->gBS, RT->gRT"); line = mat.replaceAll("g$1$2$3"); //unknown correctiveness } mat.reset(); @@ -145,7 +145,7 @@ public final class SourceFileReplacer { Pattern patentrypoint = Pattern.compile("EFI_DRIVER_ENTRY_POINT[^\\}]*\\}"); Matcher matentrypoint = patentrypoint.matcher(line); if (matentrypoint.find()) { - MigrationTool.ui.println("Deleting Entry_Point"); + ModuleInfo.ui.println("Deleting Entry_Point"); line = matentrypoint.replaceAll(""); } */ @@ -163,10 +163,10 @@ public final class SourceFileReplacer { mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib"); //a mi.hashrequiredr9libs.add("DxeServicesTableLib"); //l } else { // - mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here + mi.hashrequiredr9libs.add(ModuleInfo.db.getR9Lib(r8thing)); // add a library here } - if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) { + if ((r9thing = ModuleInfo.db.getR9Func(r8thing)) != null) { if (!r8thing.equals(r9thing)) { if (line.contains(r8thing)) { line = line.replaceAll(r8thing, r9thing); @@ -174,7 +174,7 @@ public final class SourceFileReplacer { Iterator rt = filefunc.iterator(); while (rt.hasNext()) { temp = rt.next(); - if (MigrationTool.db.r8only.contains(temp.r8thing)) { + if (ModuleInfo.db.r8only.contains(temp.r8thing)) { filer8only.add(r8thing); mi.hashr8only.add(r8thing); addr8 = true; @@ -192,8 +192,8 @@ public final class SourceFileReplacer { it = mi.hashnonlocalmacro.iterator(); while (it.hasNext()) { //macros are all assumed MdePkg currently r8thing = it.next(); - //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); - if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) { + //mi.hashrequiredr9libs.add(ModuleInfo.db.getR9Lib(r8thing)); + if ((r9thing = ModuleInfo.db.getR9Macro(r8thing)) != null) { if (line.contains(r8thing)) { line = line.replaceAll(r8thing, r9thing); filemacro.add(new r8tor9(r8thing, r9thing)); @@ -260,7 +260,7 @@ public final class SourceFileReplacer { show(fileppi, "ppi"); show(fileprotocol, "protocol"); if (!filer8only.isEmpty()) { - MigrationTool.ui.println("Converting r8only : " + filer8only); + ModuleInfo.ui.println("Converting r8only : " + filer8only); } filefunc.clear(); @@ -278,12 +278,12 @@ public final class SourceFileReplacer { r8tor9 temp; if (showdetails) { if (!hash.isEmpty()) { - MigrationTool.ui.print("Converting " + sh + " : "); + ModuleInfo.ui.print("Converting " + sh + " : "); while (it.hasNext()) { temp = it.next(); - MigrationTool.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] "); + ModuleInfo.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] "); } - MigrationTool.ui.println(""); + ModuleInfo.ui.println(""); } } } @@ -295,7 +295,7 @@ public final class SourceFileReplacer { it = hash.iterator(); while (it.hasNext()) { r8thing = it.next(); - if ((r9thing = MigrationTool.db.getR9Guidname(r8thing)) != null) { + if ((r9thing = ModuleInfo.db.getR9Guidname(r8thing)) != null) { if (!r8thing.equals(r9thing)) { if (line.contains(r8thing)) { line = line.replaceAll(r8thing, r9thing); diff --git a/Tools/bin/MigrationTools b/Tools/bin/MigrationTools index fc47bef2eb..c0d13d4c22 100644 --- a/Tools/bin/MigrationTools +++ b/Tools/bin/MigrationTools @@ -12,4 +12,4 @@ export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/bin/MigrationTools.jar # Run Migration Tool -java org.tianocore.migration.MigrationTool \ No newline at end of file +java org.tianocore.migration.ModuleInfo \ No newline at end of file diff --git a/Tools/bin/MigrationTools.bat b/Tools/bin/MigrationTools.bat index a29044144b..fd6c5936dd 100644 --- a/Tools/bin/MigrationTools.bat +++ b/Tools/bin/MigrationTools.bat @@ -29,7 +29,7 @@ if not exist %WORKSPACE%\Tools\bin\MigrationTools.jar ( ) @REM Run Migration -call "java" org.tianocore.migration.MigrationTool +call "java" org.tianocore.migration.ModuleInfo goto end