// private members, use set/get to access them\r
//\r
private static final String cmdName = "MakeDeps";\r
- private String includePath = null;\r
private String depsFile = null;\r
private String subDir = null;\r
private boolean quietMode = true;\r
/// compose full tool path\r
///\r
if (toolPath == null || toolPath.length() == 0) {\r
- toolPath = "./" + cmdName;\r
+ toolPath = cmdName;\r
} else {\r
if (toolPath.endsWith("/") || toolPath.endsWith("\\")) {\r
toolPath = toolPath + cmdName;\r
} else {\r
- toolPath = toolPath + "/" + cmdName;\r
+ toolPath = toolPath + File.separator + cmdName;\r
}\r
}\r
\r
///\r
StringBuffer args = new StringBuffer(4096);\r
if (ignoreError) {\r
- args.append(" -ignorenotfound");\r
+ args.append(" -ignorenotfound ");\r
}\r
if (quietMode) {\r
- args.append(" -q");\r
+ args.append(" -q ");\r
}\r
if (subDir != null && subDir.length() > 0) {\r
args.append(" -s ");\r
///\r
/// compose source file arguments\r
///\r
- Iterator iterator = inputFileList.iterator();\r
- while (iterator.hasNext()) {\r
- Input inputFile = (Input)iterator.next();\r
- String inputFileString = cleanupPathName(inputFile.getFile());\r
- args.append(" -f ");\r
- args.append(inputFileString);\r
+ for (int i = 0, listLength = inputFileList.size(); i < listLength; ++i) {\r
+ args.append(inputFileList.get(i).toString());\r
}\r
\r
- ///\r
- /// compose search pathes argument\r
- ///\r
- StringBuffer includePathArg = new StringBuffer(4096);\r
- if (includePath != null && includePath.length() > 0) {\r
- StringTokenizer pathTokens = new StringTokenizer(includePath, ";");\r
- while (pathTokens.hasMoreTokens()) {\r
- String tmpPath = pathTokens.nextToken().trim();\r
- if (tmpPath.length() == 0) {\r
- continue;\r
- }\r
-\r
- includePathArg.append(" -i ");\r
- includePathArg.append(cleanupPathName(tmpPath));\r
- }\r
+ for (int i = 0, listLength = includePathList.size(); i < listLength; ++i) {\r
+ args.append(includePathList.get(i).toString());\r
}\r
- iterator = includePathList.iterator();\r
- while (iterator.hasNext()) {\r
- IncludePath path = (IncludePath)iterator.next();\r
- includePathArg.append(cleanupPathName(path.getPath()));\r
- }\r
- args.append(includePathArg);\r
\r
///\r
/// We don't need a real target. So just a "dummy" is given\r
///\r
args.append(" -target dummy");\r
args.append(" -o ");\r
- args.append(cleanupPathName(depsFile));\r
+ args.append(depsFile);\r
\r
///\r
/// prepare to execute the tool\r
\r
if (result != 0) {\r
EdkLog.log(EdkLog.EDK_INFO, "MakeDeps failed!");\r
- return;\r
+ throw new BuildException("MakeDeps: failed to generate dependency file!");\r
}\r
}\r
\r
@param dir The name of sub-directory in which source files will be scanned\r
**/\r
public void setSubDir(String dir) {\r
- subDir = dir;\r
+ subDir = cleanupPathName(dir);\r
}\r
\r
/**\r
return subDir;\r
}\r
\r
- /**\r
- Set method for "IncludePath" attribute\r
-\r
- @param path The name of include path\r
- **/\r
- public void setIncludePath(String path) {\r
- includePath = cleanupPathName(path);\r
- }\r
-\r
- /**\r
- Get method for "IncludePath" attribute\r
-\r
- @returns The name of include path\r
- **/\r
- public String getIncludePath() {\r
- return includePath;\r
- }\r
-\r
/**\r
Set method for "ExtraDeps" attribute\r
\r
@param deps The name of dependency file specified separately\r
**/\r
public void setExtraDeps(String deps) {\r
- extraDeps = deps;\r
+ extraDeps = cleanupPathName(deps);\r
}\r
\r
/**\r
return false;\r
}\r
\r
- ///\r
- /// If the source file(s) is newer than dependency list file, we need to\r
- /// re-generate the dependency list file\r
- ///\r
+ //\r
+ // If the source file(s) is newer than dependency list file, we need to\r
+ // re-generate the dependency list file\r
+ //\r
long depsFileTimeStamp = df.lastModified();\r
- Iterator iterator = inputFileList.iterator();\r
+ Iterator<Input> iterator = (Iterator<Input>)inputFileList.iterator();\r
while (iterator.hasNext()) {\r
- Input inputFile = (Input)iterator.next();\r
- File sf = new File(inputFile.getFile());\r
- if (sf.lastModified() > depsFileTimeStamp) {\r
- return false;\r
+ Input inputFile = iterator.next();\r
+ List<String> fileList = inputFile.getNameList();\r
+ for (int i = 0, length = fileList.size(); i < length; ++i) {\r
+ File sf = new File(fileList.get(i));\r
+ if (sf.lastModified() > depsFileTimeStamp) {\r
+ return false;\r
+ }\r
}\r
}\r
\r
- ///\r
- /// If the source files haven't been changed since last time the dependency\r
- /// list file was generated, we need to check each file in the file list to\r
- /// see if any of them is changed or not. If anyone of them is newer than\r
- /// the dependency list file, MakeDeps.exe is needed to run again.\r
- ///\r
+ //\r
+ // If the source files haven't been changed since last time the dependency\r
+ // list file was generated, we need to check each file in the file list to\r
+ // see if any of them is changed or not. If anyone of them is newer than\r
+ // the dependency list file, MakeDeps.exe is needed to run again.\r
+ //\r
LineNumberReader lineReader = null;\r
FileReader fileReader = null;\r
boolean ret = true;\r