summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-21 06:54:50 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-21 06:54:50 +0000
commitdf87de9bdf58aa2b1662a2f57286890b0e452803 (patch)
tree51d6a6a0456364e451835b2b16bc4a91fb6b7403 /Tools/Source/MigrationTools
parentf88b9153c0a1e442e14e4a3afe0401eec06fec06 (diff)
downloadedk2-df87de9bdf58aa2b1662a2f57286890b0e452803.zip
edk2-df87de9bdf58aa2b1662a2f57286890b0e452803.tar.gz
edk2-df87de9bdf58aa2b1662a2f57286890b0e452803.tar.bz2
new temp schema
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1588 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/MigrationTools')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java19
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java2
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java16
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java6
4 files changed, 26 insertions, 17 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
index fea4f8b..004950f 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
@@ -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 {
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
index 912e31c..0799bf5 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
@@ -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;
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
index 6495810..5467b3e 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
@@ -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);
}
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
index bce108f..9d4c85c 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
@@ -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();