remove MigrationTools.java

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1352 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
alfred 2006-08-22 10:45:49 +00:00
parent 437ffb0776
commit 050e979f68
12 changed files with 67 additions and 81 deletions

View File

@ -1,2 +1,2 @@
Manifest-Version: 1.0
Main-Class: org.tianocore.migration.MigrationTool
Main-Class: org.tianocore.migration.ModuleInfo

View File

@ -42,7 +42,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<Filename>org/tianocore/migration/SourceFileReplacer.java</Filename>
<Filename>org/tianocore/migration/UI.java</Filename>
<Filename>org/tianocore/migration/MsaTreeEditor.java</Filename>
<Filename>org/tianocore/migration/MigrationTool.java</Filename>
<Filename>org/tianocore/migration/Critic.java</Filename>
<Filename>org/tianocore/migration/Common.java</Filename>
</SourceFiles>

View File

@ -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) {

View File

@ -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")) {

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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<String> 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();
}
}

View File

@ -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);

View File

@ -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) {

View File

@ -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<r8tor9> 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);

View File

@ -12,4 +12,4 @@
export CLASSPATH=$CLASSPATH:$WORKSPACE/Tools/bin/MigrationTools.jar
# Run Migration Tool
java org.tianocore.migration.MigrationTool
java org.tianocore.migration.ModuleInfo

View File

@ -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