]> git.proxmox.com Git - mirror_edk2.git/commitdiff
new temp schema
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 21 Sep 2006 06:54:50 +0000 (06:54 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 21 Sep 2006 06:54:50 +0000 (06:54 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1588 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java

index fea4f8b9b0aeae08a144e720075cc36312119aae..004950f96b5fa2437a26dbe833bbbc506596fb71 100644 (file)
@@ -29,6 +29,8 @@ public class MigrationTool {
     \r
     public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();\r
 \r
+    private static String startpath = null;\r
+    \r
     private static final void mainFlow(ModuleInfo mi) throws Exception {\r
 \r
         ModuleReader.aimAt(mi);\r
@@ -36,9 +38,6 @@ public class MigrationTool {
         //MigrationTool.ui.yesOrNo("go on replace?");\r
         SourceFileReplacer.fireAt(mi);    // some adding library actions are taken here,so it must be put before "MsaWriter"\r
 \r
-        //MigrationTool.ui.yesOrNo("go on delete?");\r
-        Common.deleteDir(mi.modulepath + File.separator + "temp");\r
-\r
         //MigrationTool.ui.yesOrNo("go on show?");\r
         // show result\r
         if (MigrationTool.printModuleInfo) {\r
@@ -73,11 +72,11 @@ public class MigrationTool {
         MigrationTool.ui.println(show + hash.size());\r
         MigrationTool.ui.println(hash);\r
     }\r
-/*\r
+\r
     public static final String getTempDir(String modulepath) {\r
-       return "C:" + File.separator + "MigrationTool_Temp" + File.separator + modulepath.replaceAll(ui., arg1);\r
+       return "C:" + File.separator + "MigrationTool_Temp" + modulepath.replace(startpath, "");\r
     }\r
-*/\r
+\r
     private static final String assignOutPutPath(String inputpath) {\r
         if (MigrationTool.defaultoutput) {\r
             return inputpath.replaceAll(Common.STRSEPARATER, "$1");\r
@@ -93,8 +92,14 @@ public class MigrationTool {
     }\r
 \r
     public static final void startMigrateAll(String path) throws Exception {\r
+       startpath = path;\r
         MigrationTool.ui.println("Project Migration");\r
         MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
+        \r
+        if (new File("C:" + File.separator + "MigrationTool_Temp").exists()) {\r
+            Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");\r
+        }\r
+        \r
         Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
         \r
         Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();\r
@@ -103,6 +108,8 @@ public class MigrationTool {
         }\r
         \r
         ModuleInfoMap.clear();\r
+        \r
+        Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");\r
     }\r
 \r
     public static void main(String[] args) throws Exception {\r
index 912e31ced9fdf4eea8ac839ca20e3f37d07fe470..0799bf5c3492766c987159ecf79ac83fa3004f4e 100644 (file)
@@ -22,9 +22,11 @@ information and all the temporary data.
 public final class ModuleInfo {\r
     ModuleInfo(String modulepath) throws Exception {\r
         this.modulepath = modulepath;\r
+        this.temppath = MigrationTool.getTempDir(this.modulepath);\r
     }\r
 \r
     public final String modulepath;\r
+    public final String temppath;\r
     \r
     public String modulename = null;\r
     public String guidvalue = null;\r
index 64958108ccaec27fc8af975075a0b63c50141312..5467b3eff464a673a96f6de79edfeb1ace087478 100644 (file)
@@ -130,7 +130,7 @@ public final class ModuleReader implements Common.ForDoAll {
     \r
     private final void preProcessModule() throws Exception {\r
        // according to .inf file, add extraordinary includes and sourcefiles\r
-        Common.dirCopy(mi.modulepath, mi.modulepath + File.separator + "temp");        // collect all Laplace.namechange to here???\r
+        Common.dirCopy(mi.modulepath, mi.temppath);    // collect all Laplace.namechange to here???\r
         \r
        if (!mi.infincludes.isEmpty()) {\r
             Iterator<String> it = mi.infincludes.iterator();\r
@@ -140,9 +140,9 @@ public final class ModuleReader implements Common.ForDoAll {
                        if (tempincludename.contains("..")) {\r
                                Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename);\r
                                if (mtr.find() && !mtr.group(2).matches(".")) {\r
-                                       Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.modulepath + File.separator + "temp", ".h");\r
+                                       Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h");\r
                                } else {\r
-                                       Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.modulepath + File.separator + "temp", ".h");\r
+                                       Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h");\r
                                }\r
                        }\r
                }\r
@@ -153,17 +153,17 @@ public final class ModuleReader implements Common.ForDoAll {
             while (it.hasNext()) {\r
                tempsourcename = it.next();\r
                if (tempsourcename.contains("..")) {\r
-                       Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + "MT_Parent_Sources");\r
+                       Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources");\r
                                Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename);\r
                                if (mtr.find()) {\r
-                                       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));\r
+                                       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));\r
                                }\r
                }\r
             }\r
        }\r
 \r
         //CommentOutNonLocalHFile();\r
-        Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);\r
+        Common.toDoAll(mi.temppath, this, Common.FILE);\r
         \r
         parsePreProcessedSourceCode();\r
 \r
@@ -203,7 +203,7 @@ public final class ModuleReader implements Common.ForDoAll {
         while (ii.hasNext()) {\r
             StringBuffer wholefile = new StringBuffer();\r
             ifile = ii.next();\r
-            rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + "temp" + File.separator + ifile));\r
+            rd = new BufferedReader(new FileReader(mi.temppath + File.separator + ifile));\r
             while ((line = rd.readLine()) != null) {\r
                 wholefile.append(line + '\n');\r
             }\r
@@ -298,7 +298,7 @@ public final class ModuleReader implements Common.ForDoAll {
 \r
     //-----------------------------------ForDoAll-----------------------------------//\r
     public void run(String filepath) throws Exception {\r
-       String name = mi.modulepath + File.separator + "temp" + File.separator + filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");\r
+       String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, "");\r
        commentlaplace.transform(name, name);\r
     }\r
 \r
index bce108f934177c6883d594f635af1fd6d95bbad1..9d4c85cb045fe82a8226908fd847def2ea180665 100644 (file)
@@ -389,8 +389,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
     \r
     //-----------------------------------ForDoAll-----------------------------------//\r
     public void run(String filepath) throws Exception {\r
-        String inname = filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");\r
-        String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;\r
+        String inname = filepath.replace(mi.temppath + File.separator, "");\r
+        String tempinpath = mi.temppath + File.separator;\r
         String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;\r
 \r
         Iterator<Common.Laplace> itLaplace = Laplaces.iterator();\r
@@ -417,7 +417,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
         Laplaces.add(new CLaplace());\r
         Laplaces.add(new IdleLaplace());\r
         \r
-        Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);\r
+        Common.toDoAll(mi.temppath, this, Common.FILE);\r
         \r
         if (!mi.hashr8only.isEmpty()) {\r
             addr8only();\r