Manifest-Version: 1.0\r
-Main-Class: org.tianocore.migration.MigrationTool\r
+Main-Class: org.tianocore.migration.ModuleInfo\r
<Filename>org/tianocore/migration/SourceFileReplacer.java</Filename>\r
<Filename>org/tianocore/migration/UI.java</Filename>\r
<Filename>org/tianocore/migration/MsaTreeEditor.java</Filename> \r
- <Filename>org/tianocore/migration/MigrationTool.java</Filename> \r
<Filename>org/tianocore/migration/Critic.java</Filename> \r
<Filename>org/tianocore/migration/Common.java</Filename>\r
</SourceFiles>\r
\r
mibox = new JCheckBox("Print ModuleInfo", false);\r
mibox.addItemListener(this);\r
- MigrationTool.printModuleInfo = false;\r
+ ModuleInfo.printModuleInfo = false;\r
\r
criticbox = new JCheckBox("Run Critic", true);\r
criticbox.addItemListener(this);\r
- MigrationTool.doCritic = true;\r
+ ModuleInfo.doCritic = true;\r
\r
defaultpathbox = new JCheckBox("Use Default Output Path", true);\r
defaultpathbox.addItemListener(this);\r
}\r
} else if (e.getSource() == mibox) {\r
if (e.getStateChange() == ItemEvent.DESELECTED) {\r
- MigrationTool.printModuleInfo = false;\r
+ ModuleInfo.printModuleInfo = false;\r
} else if (e.getStateChange() == ItemEvent.SELECTED) {\r
- MigrationTool.printModuleInfo = true;\r
+ ModuleInfo.printModuleInfo = true;\r
}\r
} else if (e.getSource() == criticbox) {\r
if (e.getStateChange() == ItemEvent.DESELECTED) {\r
- MigrationTool.doCritic = false;\r
+ ModuleInfo.doCritic = false;\r
System.out.println("criticbox DESELECTED");\r
} else if (e.getStateChange() == ItemEvent.SELECTED) {\r
- MigrationTool.doCritic = true;\r
+ ModuleInfo.doCritic = true;\r
System.out.println("criticbox SELECTED");\r
}\r
} else if (e.getSource() == defaultpathbox) {\r
String temp = null;\r
\r
temp = mtr.group();\r
- if (MigrationTool.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database\r
- type = MigrationTool.db.getGuidType(temp);\r
+ if (ModuleInfo.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database\r
+ type = ModuleInfo.db.getGuidType(temp);\r
if (type.matches("Protocol")) {\r
mi.protocol.add(temp);\r
} else if (type.matches("Ppi")) {\r
String temp = null;\r
\r
temp = mtr.group();\r
- if (MigrationTool.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones\r
+ if (ModuleInfo.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones\r
if (!unmacro.contains(temp)) {\r
mi.hashnonlocalmacro.add(temp);\r
}\r
+++ /dev/null
-/** @file\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.migration;\r
-\r
-public class MigrationTool {\r
- public static UI ui = null;\r
- public static Database db = null;\r
- \r
- public static final String migrationcomment = "//%$//";\r
- \r
- public static boolean printModuleInfo = false;\r
- public static boolean doCritic = false;\r
- \r
- public static void main(String[] args) throws Exception {\r
- ui = FirstPanel.init();\r
- db = Database.init();\r
- }\r
-}\r
ModuleInfo(String modulepath) throws Exception {\r
this.modulepath = modulepath;\r
\r
- MigrationTool.ui.println("Choose where to place the result");\r
- if ((outputpath = MigrationTool.ui.getFilepath()) == null) {\r
+ ModuleInfo.ui.println("Choose where to place the result");\r
+ if ((outputpath = ModuleInfo.ui.getFilepath()) == null) {\r
outputpath = modulepath; \r
}\r
- MigrationTool.ui.println(outputpath);\r
+ ModuleInfo.ui.println(outputpath);\r
\r
mainFlow();\r
}\r
SourceFileReplacer.flush(this); // some adding library actions are taken here,so it must be put before "MsaWriter"\r
\r
// show result\r
- if (MigrationTool.printModuleInfo) {\r
- MigrationTool.ui.println("\nModule Information : ");\r
- MigrationTool.ui.println("Entrypoint : " + entrypoint);\r
+ if (ModuleInfo.printModuleInfo) {\r
+ ModuleInfo.ui.println("\nModule Information : ");\r
+ ModuleInfo.ui.println("Entrypoint : " + entrypoint);\r
show(protocol, "Protocol : ");\r
show(ppi, "Ppi : ");\r
show(guid, "Guid : ");\r
\r
new MsaWriter(this).flush();\r
\r
- if (MigrationTool.doCritic) {\r
+ if (ModuleInfo.doCritic) {\r
Critic.fireAt(outputpath + File.separator + "Migration_" + modulename);\r
}\r
\r
Common.deleteDir(modulepath + File.separator + "temp");\r
\r
- MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);\r
- MigrationTool.ui.println("Complete!");\r
- MigrationTool.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");\r
- MigrationTool.ui.println("Your logfile was placed here: " + modulepath);\r
+ ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error);\r
+ ModuleInfo.ui.println("Complete!");\r
+ ModuleInfo.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");\r
+ ModuleInfo.ui.println("Your logfile was placed here: " + modulepath);\r
}\r
\r
private void show(Set<String> hash, String show) {\r
- MigrationTool.ui.println(show + hash.size());\r
- MigrationTool.ui.println(hash);\r
+ ModuleInfo.ui.println(show + hash.size());\r
+ ModuleInfo.ui.println(hash);\r
}\r
\r
public final void enroll(String filepath) throws Exception {\r
}\r
\r
public static final void triger(String path) throws Exception {\r
- MigrationTool.ui.println("Project Migration");\r
- MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
+ ModuleInfo.ui.println("Project Migration");\r
+ ModuleInfo.ui.println("Copyright (c) 2006, Intel Corporation");\r
Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
}\r
+ \r
+ //---------------------------------------------------------------------------//\r
+ \r
+ public static UI ui = null;\r
+ public static Database db = null;\r
+ \r
+ public static final String migrationcomment = "//%$//";\r
+ \r
+ public static boolean printModuleInfo = false;\r
+ public static boolean doCritic = false;\r
+ \r
+ public static void main(String[] args) throws Exception {\r
+ ui = FirstPanel.init();\r
+ db = Database.init();\r
+ }\r
}
\ No newline at end of file
\r
String filename = null;\r
if (mi.msaorinf.isEmpty()) {\r
- MigrationTool.ui.println("No INF nor MSA file found!");\r
+ ModuleInfo.ui.println("No INF nor MSA file found!");\r
System.exit(0);\r
} else {\r
- filename = MigrationTool.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
+ filename = ModuleInfo.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
}\r
if (filename.contains(".inf")) {\r
readInf(filename);\r
}\r
if (mtrinfequation.group(1).matches("DPX_SOURCE")) {\r
if (!mi.localmodulesources.contains(mtrinfequation.group(2))) {\r
- MigrationTool.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
+ ModuleInfo.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
}\r
}\r
}\r
mtrfilename = ptnfilename.matcher(mtrsection.group(2));\r
while (mtrfilename.find()) {\r
if (!mi.localmodulesources.contains(mtrfilename.group())) {\r
- MigrationTool.ui.println("Source File Missing! : " + mtrfilename.group());\r
+ ModuleInfo.ui.println("Source File Missing! : " + mtrfilename.group());\r
}\r
}\r
}\r
mtrinclude = ptninclude.matcher(line);\r
if (mtrinclude.find() && mi.localmodulesources.contains(mtrinclude.group(1))) {\r
} else {\r
- line = MigrationTool.migrationcomment + line;\r
+ line = ModuleInfo.migrationcomment + line;\r
}\r
}\r
outfile.append(line + '\n');\r
matguid = Guid.ptnguid.matcher(line); // several ways to implement this , which one is faster ? :\r
while (matguid.find()) { // 1.currently , find once , then call to identify which is it\r
if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) { // 2.use 3 different matchers , search 3 times to find each\r
- //matguid.appendReplacement(result, MigrationTool.db.getR9Guidname(temp)); // search the database for all 3 kinds of guids , high cost\r
+ //matguid.appendReplacement(result, ModuleInfo.db.getR9Guidname(temp)); // search the database for all 3 kinds of guids , high cost\r
}\r
}\r
//matguid.appendTail(result);\r
matfuncc = Func.ptnfuncc.matcher(line);\r
while (matfuncc.find()) {\r
if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) {\r
- //MigrationTool.ui.println(ifile + " dofunc " + temp);\r
- //matfuncc.appendReplacement(result, MigrationTool.db.getR9Func(temp));\r
+ //ModuleInfo.ui.println(ifile + " dofunc " + temp);\r
+ //matfuncc.appendReplacement(result, ModuleInfo.db.getR9Func(temp));\r
}\r
}\r
//matfuncc.appendTail(result);\r
}\r
\r
private void addNode() {\r
- addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), MigrationTool.ui.getInput("Input Node Name"));\r
+ addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), ModuleInfo.ui.getInput("Input Node Name"));\r
}\r
\r
private void addNode(DefaultMutableTreeNode parentNode, Object child) {\r
\r
String outname = null;\r
String inname = null;\r
- if (MigrationTool.ui.yesOrNo("Changes will be made to the Source Code. View details?")) {\r
+ if (ModuleInfo.ui.yesOrNo("Changes will be made to the Source Code. View details?")) {\r
showdetails = true;\r
}\r
\r
} else {\r
outname = inname;\r
}\r
- MigrationTool.ui.println("\nModifying file: " + inname);\r
+ ModuleInfo.ui.println("\nModifying file: " + inname);\r
Common.string2file(sourcefilereplace(mi.modulepath + File.separator + "temp" + File.separator + inname), mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + outname);\r
} else if (inname.contains(".h") || inname.contains(".H") || inname.contains(".dxs") || inname.contains(".uni")) {\r
if (inname.contains(".H")) {\r
} else {\r
outname = inname;\r
}\r
- MigrationTool.ui.println("\nCopying file: " + inname);\r
+ ModuleInfo.ui.println("\nCopying file: " + inname);\r
Common.string2file(Common.file2string(mi.modulepath + File.separator + "temp" + File.separator + inname), mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + outname);\r
}\r
}\r
\r
private static final void addr8only() throws Exception {\r
String paragraph = null;\r
- String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");\r
+ String line = Common.file2string(ModuleInfo.db.DatabasePath + File.separator + "R8Lib.c");\r
//Common.ensureDir(mi.modulepath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c");\r
PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c")));\r
PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(mi.outputpath + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.h")));\r
// replace BS -> gBS , RT -> gRT\r
Matcher mat = pat.matcher(line);\r
if (mat.find()) { // add a library here\r
- MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");\r
+ ModuleInfo.ui.println("Converting all BS->gBS, RT->gRT");\r
line = mat.replaceAll("g$1$2$3"); //unknown correctiveness\r
}\r
mat.reset();\r
Pattern patentrypoint = Pattern.compile("EFI_DRIVER_ENTRY_POINT[^\\}]*\\}");\r
Matcher matentrypoint = patentrypoint.matcher(line);\r
if (matentrypoint.find()) {\r
- MigrationTool.ui.println("Deleting Entry_Point");\r
+ ModuleInfo.ui.println("Deleting Entry_Point");\r
line = matentrypoint.replaceAll("");\r
}\r
*/\r
mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib"); //a\r
mi.hashrequiredr9libs.add("DxeServicesTableLib"); //l\r
} else { //\r
- mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here\r
+ mi.hashrequiredr9libs.add(ModuleInfo.db.getR9Lib(r8thing)); // add a library here\r
}\r
\r
- if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
+ if ((r9thing = ModuleInfo.db.getR9Func(r8thing)) != null) {\r
if (!r8thing.equals(r9thing)) {\r
if (line.contains(r8thing)) {\r
line = line.replaceAll(r8thing, r9thing);\r
Iterator<r8tor9> rt = filefunc.iterator();\r
while (rt.hasNext()) {\r
temp = rt.next();\r
- if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
+ if (ModuleInfo.db.r8only.contains(temp.r8thing)) {\r
filer8only.add(r8thing);\r
mi.hashr8only.add(r8thing);\r
addr8 = true;\r
it = mi.hashnonlocalmacro.iterator();\r
while (it.hasNext()) { //macros are all assumed MdePkg currently\r
r8thing = it.next();\r
- //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); \r
- if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
+ //mi.hashrequiredr9libs.add(ModuleInfo.db.getR9Lib(r8thing)); \r
+ if ((r9thing = ModuleInfo.db.getR9Macro(r8thing)) != null) {\r
if (line.contains(r8thing)) {\r
line = line.replaceAll(r8thing, r9thing);\r
filemacro.add(new r8tor9(r8thing, r9thing));\r
show(fileppi, "ppi");\r
show(fileprotocol, "protocol");\r
if (!filer8only.isEmpty()) {\r
- MigrationTool.ui.println("Converting r8only : " + filer8only);\r
+ ModuleInfo.ui.println("Converting r8only : " + filer8only);\r
}\r
\r
filefunc.clear();\r
r8tor9 temp;\r
if (showdetails) {\r
if (!hash.isEmpty()) {\r
- MigrationTool.ui.print("Converting " + sh + " : ");\r
+ ModuleInfo.ui.print("Converting " + sh + " : ");\r
while (it.hasNext()) {\r
temp = it.next();\r
- MigrationTool.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] ");\r
+ ModuleInfo.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] ");\r
}\r
- MigrationTool.ui.println("");\r
+ ModuleInfo.ui.println("");\r
}\r
}\r
}\r
it = hash.iterator();\r
while (it.hasNext()) {\r
r8thing = it.next();\r
- if ((r9thing = MigrationTool.db.getR9Guidname(r8thing)) != null) {\r
+ if ((r9thing = ModuleInfo.db.getR9Guidname(r8thing)) != null) {\r
if (!r8thing.equals(r9thing)) {\r
if (line.contains(r8thing)) {\r
line = line.replaceAll(r8thing, r9thing);\r
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
)\r
\r
@REM Run Migration\r
-call "java" org.tianocore.migration.MigrationTool\r
+call "java" org.tianocore.migration.ModuleInfo\r
\r
goto end\r
\r