]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
Modify GenFfsTask to make it don't create ORG file.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / MakeDeps.java
index 7797b7adfdc673b35f6f7f910258d8431b08b392..5c4de1a78ef232edfb92b151195f64d845a381ef 100644 (file)
@@ -35,7 +35,8 @@ import org.apache.tools.ant.taskdefs.Execute;
 import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
 import org.apache.tools.ant.types.Commandline;\r
 import org.apache.tools.ant.types.Path;\r
-import org.tianocore.logger.EdkLog;\r
+\r
+import org.tianocore.common.logger.EdkLog;\r
 \r
 /**\r
  Class MakeDeps is used to wrap MakeDeps.exe as an ANT task.\r
@@ -112,7 +113,7 @@ public class MakeDeps extends Task {
 \r
         ///\r
         /// if there's no source files, we can do nothing about dependency\r
-        /// \r
+        ///\r
         if (inputFileList.size() == 0) {\r
             throw new BuildException("No source files specified to scan");\r
         }\r
@@ -187,7 +188,7 @@ public class MakeDeps extends Task {
 \r
         // change the old DEP file format (makefile compatible) to just file list\r
         if (!cleanup()) {\r
-            throw new BuildException(depsFile + " was not generated");\r
+            throw new BuildException(depsFile + " was not generated!");\r
         }\r
     }\r
 \r
@@ -195,16 +196,10 @@ public class MakeDeps extends Task {
     /// Remove any duplicated path separator or inconsistent path separator\r
     ///\r
     private String cleanupPathName(String path) {\r
-        try {\r
-            path = (new File(path)).getCanonicalPath();\r
-        } catch (IOException e) {\r
-            String separator = "\\" + File.separator;\r
-            String duplicateSeparator = separator + "{2}";\r
-            path = Path.translateFile(path);\r
-            path = path.replaceAll(duplicateSeparator, separator);\r
-            return path;\r
-        }\r
-\r
+        String separator = "\\" + File.separator;\r
+        String duplicateSeparator = separator + "{2}";\r
+        path = Path.translateFile(path);\r
+        path = path.replaceAll(duplicateSeparator, separator);\r
         return path;\r
     }\r
 \r
@@ -360,16 +355,12 @@ public class MakeDeps extends Task {
             //\r
             String line = null;\r
             while ((line = lineReader.readLine()) != null) {\r
-                Pattern pattern = Pattern.compile(target + "[ ]*:[ ]*(.+)");\r
-                Matcher matcher = pattern.matcher(line);\r
-\r
-                while (matcher.find()) {\r
+                String[] filePath = line.split(" : ");\r
+                if (filePath.length == 2) {\r
                     ///\r
                     /// keep the file name after ":"\r
                     ///\r
-                    String filePath = line.substring(matcher.start(1), matcher.end(1));\r
-                    filePath = cleanupPathName(filePath);\r
-                    lineSet.add(filePath);\r
+                    lineSet.add(cleanupPathName(filePath[1]));\r
                 }\r
             }\r
             lineReader.close();\r
@@ -385,7 +376,7 @@ public class MakeDeps extends Task {
 \r
             ///\r
             /// compose the final file content\r
-            /// \r
+            ///\r
             StringBuffer cleanedLines = new StringBuffer(40960);\r
             Iterator<String> it = lineSet.iterator();\r
             while (it.hasNext()) {\r