new temp schema

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1588 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
alfred 2006-09-21 06:54:50 +00:00
parent f88b9153c0
commit df87de9bdf
4 changed files with 26 additions and 17 deletions

View File

@ -29,6 +29,8 @@ public class MigrationTool {
public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();
private static String startpath = null;
private static final void mainFlow(ModuleInfo mi) throws Exception {
ModuleReader.aimAt(mi);
@ -36,9 +38,6 @@ public class MigrationTool {
//MigrationTool.ui.yesOrNo("go on replace?");
SourceFileReplacer.fireAt(mi); // some adding library actions are taken here,so it must be put before "MsaWriter"
//MigrationTool.ui.yesOrNo("go on delete?");
Common.deleteDir(mi.modulepath + File.separator + "temp");
//MigrationTool.ui.yesOrNo("go on show?");
// show result
if (MigrationTool.printModuleInfo) {
@ -73,11 +72,11 @@ public class MigrationTool {
MigrationTool.ui.println(show + hash.size());
MigrationTool.ui.println(hash);
}
/*
public static final String getTempDir(String modulepath) {
return "C:" + File.separator + "MigrationTool_Temp" + File.separator + modulepath.replaceAll(ui., arg1);
return "C:" + File.separator + "MigrationTool_Temp" + modulepath.replace(startpath, "");
}
*/
private static final String assignOutPutPath(String inputpath) {
if (MigrationTool.defaultoutput) {
return inputpath.replaceAll(Common.STRSEPARATER, "$1");
@ -93,8 +92,14 @@ public class MigrationTool {
}
public static final void startMigrateAll(String path) throws Exception {
startpath = path;
MigrationTool.ui.println("Project Migration");
MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");
if (new File("C:" + File.separator + "MigrationTool_Temp").exists()) {
Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");
}
Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);
Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();
@ -103,6 +108,8 @@ public class MigrationTool {
}
ModuleInfoMap.clear();
Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");
}
public static void main(String[] args) throws Exception {

View File

@ -22,9 +22,11 @@ information and all the temporary data.
public final class ModuleInfo {
ModuleInfo(String modulepath) throws Exception {
this.modulepath = modulepath;
this.temppath = MigrationTool.getTempDir(this.modulepath);
}
public final String modulepath;
public final String temppath;
public String modulename = null;
public String guidvalue = null;

View File

@ -130,7 +130,7 @@ public final class ModuleReader implements Common.ForDoAll {
private final void preProcessModule() throws Exception {
// according to .inf file, add extraordinary includes and sourcefiles
Common.dirCopy(mi.modulepath, mi.modulepath + File.separator + "temp"); // collect all Laplace.namechange to here???
Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here???
if (!mi.infincludes.isEmpty()) {
Iterator<String> it = mi.infincludes.iterator();
@ -140,9 +140,9 @@ public final class ModuleReader implements Common.ForDoAll {
if (tempincludename.contains("..")) {
Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename);
if (mtr.find() && !mtr.group(2).matches(".")) {
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.modulepath + File.separator + "temp", ".h");
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h");
} else {
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.modulepath + File.separator + "temp", ".h");
Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h");
}
}
}
@ -153,17 +153,17 @@ public final class ModuleReader implements Common.ForDoAll {
while (it.hasNext()) {
tempsourcename = it.next();
if (tempsourcename.contains("..")) {
Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + "MT_Parent_Sources");
Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources");
Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename);
if (mtr.find()) {
Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.modulepath + File.separator + "temp" + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2));
Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2));
}
}
}
}
//CommentOutNonLocalHFile();
Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);
Common.toDoAll(mi.temppath, this, Common.FILE);
parsePreProcessedSourceCode();
@ -203,7 +203,7 @@ public final class ModuleReader implements Common.ForDoAll {
while (ii.hasNext()) {
StringBuffer wholefile = new StringBuffer();
ifile = ii.next();
rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + "temp" + File.separator + ifile));
rd = new BufferedReader(new FileReader(mi.temppath + File.separator + ifile));
while ((line = rd.readLine()) != null) {
wholefile.append(line + '\n');
}
@ -298,7 +298,7 @@ public final class ModuleReader implements Common.ForDoAll {
//-----------------------------------ForDoAll-----------------------------------//
public void run(String filepath) throws Exception {
String name = mi.modulepath + File.separator + "temp" + File.separator + filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");
String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, "");
commentlaplace.transform(name, name);
}

View File

@ -389,8 +389,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
//-----------------------------------ForDoAll-----------------------------------//
public void run(String filepath) throws Exception {
String inname = filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");
String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;
String inname = filepath.replace(mi.temppath + File.separator, "");
String tempinpath = mi.temppath + File.separator;
String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;
Iterator<Common.Laplace> itLaplace = Laplaces.iterator();
@ -417,7 +417,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
Laplaces.add(new CLaplace());
Laplaces.add(new IdleLaplace());
Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);
Common.toDoAll(mi.temppath, this, Common.FILE);
if (!mi.hashr8only.isEmpty()) {
addr8only();