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
\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
runner.setCommandline(cmd.getCommandline());\r
\r
EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmd.getCommandline()));\r
- EdkLog.log(EdkLog.EDK_INFO, " ");\r
\r
int result = 0;\r
try {\r
\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
/// 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
//\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
\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