- Fixed EDKT146; The override warning message has been reduced to almost none.

- Changed MakeDeps tool to generate .dep file which can be used directly by ANT task wrapper
- Made several code optimizations and format clean



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1324 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36
2006-08-18 10:25:20 +00:00
parent e485bb4bff
commit 1fa1cb752a
8 changed files with 185 additions and 173 deletions

View File

@ -182,11 +182,6 @@ public class MakeDeps extends Task {
EdkLog.log(EdkLog.EDK_INFO, "MakeDeps failed!");
return;
}
// change the old DEP file format (makefile compatible) to just file list
if (!cleanup()) {
throw new BuildException(depsFile + " was not generated!");
}
}
///
@ -326,75 +321,6 @@ public class MakeDeps extends Task {
inputFileList.add(inputFile);
}
/**
The original file generated by MakeDeps.exe is for makefile uses. The target
part (before :) is not useful for ANT. This method will do the removal.
@returns true if cleaned files is saved successfully
@returns false if error occurs in file I/O system
**/
private boolean cleanup() {
File df = new File(depsFile);
if (!df.exists()) {
return false;
}
LineNumberReader lineReader = null;
FileReader fileReader = null;
Set<String> lineSet = new HashSet<String>(100); // used to remove duplicated lines
try {
fileReader = new FileReader(df);
lineReader = new LineNumberReader(fileReader);
///
/// clean-up each line in deps file
//
String line = null;
while ((line = lineReader.readLine()) != null) {
String[] filePath = line.split(" : ");
if (filePath.length == 2) {
///
/// keep the file name after ":"
///
lineSet.add(cleanupPathName(filePath[1]));
}
}
lineReader.close();
fileReader.close();
///
/// we may have explicitly specified dependency files
///
StringTokenizer fileTokens = new StringTokenizer(extraDeps, ";");
while (fileTokens.hasMoreTokens()) {
lineSet.add(cleanupPathName(fileTokens.nextToken()));
}
///
/// compose the final file content
///
StringBuffer cleanedLines = new StringBuffer(40960);
Iterator<String> it = lineSet.iterator();
while (it.hasNext()) {
String filePath = it.next();
cleanedLines.append(filePath);
cleanedLines.append("\n");
}
///
/// overwrite old dep file with new content
///
FileWriter fileWriter = null;
fileWriter = new FileWriter(df);
fileWriter.write(cleanedLines.toString());
fileWriter.close();
} catch (IOException e) {
log (e.getMessage());
}
return true;
}
/**
Check if the dependency list file should be (re-)generated or not.