X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FFrameworkTasks%2Forg%2Ftianocore%2Fframework%2Ftasks%2FMakeDeps.java;h=76ab8e071500cd7177d109c6be553283535dd651;hb=91f7d582299ddc08babbff1624df3fd136a37ee9;hp=5b76176a6455e5b09609909207dac07e8a2bd58d;hpb=1fa1cb752a62f624ff8e7d81c89b89b56c44dc13;p=mirror_edk2.git
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
index 5b76176a64..76ab8e0715 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
@@ -16,15 +16,11 @@ package org.tianocore.framework.tasks;
import java.io.File;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -45,7 +41,6 @@ public class MakeDeps extends Task {
// private members, use set/get to access them
//
private static final String cmdName = "MakeDeps";
- private String includePath = null;
private String depsFile = null;
private String subDir = null;
private boolean quietMode = true;
@@ -76,20 +71,17 @@ public class MakeDeps extends Task {
Project prj = this.getOwningTarget().getProject();
String toolPath = prj.getProperty("env.FRAMEWORK_TOOLS_PATH");
- FrameworkLogger logger = new FrameworkLogger(prj, "makedeps");
- EdkLog.setLogLevel(prj.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
///
/// compose full tool path
///
if (toolPath == null || toolPath.length() == 0) {
- toolPath = "./" + cmdName;
+ toolPath = cmdName;
} else {
if (toolPath.endsWith("/") || toolPath.endsWith("\\")) {
toolPath = toolPath + cmdName;
} else {
- toolPath = toolPath + "/" + cmdName;
+ toolPath = toolPath + File.separator + cmdName;
}
}
@@ -98,10 +90,10 @@ public class MakeDeps extends Task {
///
StringBuffer args = new StringBuffer(4096);
if (ignoreError) {
- args.append(" -ignorenotfound");
+ args.append(" -ignorenotfound ");
}
if (quietMode) {
- args.append(" -q");
+ args.append(" -q ");
}
if (subDir != null && subDir.length() > 0) {
args.append(" -s ");
@@ -118,43 +110,20 @@ public class MakeDeps extends Task {
///
/// compose source file arguments
///
- Iterator iterator = inputFileList.iterator();
- while (iterator.hasNext()) {
- Input inputFile = (Input)iterator.next();
- String inputFileString = cleanupPathName(inputFile.getFile());
- args.append(" -f ");
- args.append(inputFileString);
+ for (int i = 0, listLength = inputFileList.size(); i < listLength; ++i) {
+ args.append(inputFileList.get(i).toString());
}
- ///
- /// compose search pathes argument
- ///
- StringBuffer includePathArg = new StringBuffer(4096);
- if (includePath != null && includePath.length() > 0) {
- StringTokenizer pathTokens = new StringTokenizer(includePath, ";");
- while (pathTokens.hasMoreTokens()) {
- String tmpPath = pathTokens.nextToken().trim();
- if (tmpPath.length() == 0) {
- continue;
- }
-
- includePathArg.append(" -i ");
- includePathArg.append(cleanupPathName(tmpPath));
- }
+ for (int i = 0, listLength = includePathList.size(); i < listLength; ++i) {
+ args.append(includePathList.get(i).toString());
}
- iterator = includePathList.iterator();
- while (iterator.hasNext()) {
- IncludePath path = (IncludePath)iterator.next();
- includePathArg.append(cleanupPathName(path.getPath()));
- }
- args.append(includePathArg);
///
/// We don't need a real target. So just a "dummy" is given
///
args.append(" -target dummy");
args.append(" -o ");
- args.append(cleanupPathName(depsFile));
+ args.append(depsFile);
///
/// prepare to execute the tool
@@ -169,7 +138,7 @@ public class MakeDeps extends Task {
runner.setAntRun(prj);
runner.setCommandline(cmd.getCommandline());
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmd.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmd.getCommandline()));
int result = 0;
try {
@@ -179,8 +148,8 @@ public class MakeDeps extends Task {
}
if (result != 0) {
- EdkLog.log(EdkLog.EDK_INFO, "MakeDeps failed!");
- return;
+ EdkLog.log(this, EdkLog.EDK_INFO, "MakeDeps failed!");
+ throw new BuildException("MakeDeps: failed to generate dependency file!");
}
}
@@ -255,7 +224,7 @@ public class MakeDeps extends Task {
@param dir The name of sub-directory in which source files will be scanned
**/
public void setSubDir(String dir) {
- subDir = dir;
+ subDir = cleanupPathName(dir);
}
/**
@@ -267,31 +236,13 @@ public class MakeDeps extends Task {
return subDir;
}
- /**
- Set method for "IncludePath" attribute
-
- @param path The name of include path
- **/
- public void setIncludePath(String path) {
- includePath = cleanupPathName(path);
- }
-
- /**
- Get method for "IncludePath" attribute
-
- @returns The name of include path
- **/
- public String getIncludePath() {
- return includePath;
- }
-
/**
Set method for "ExtraDeps" attribute
@param deps The name of dependency file specified separately
**/
public void setExtraDeps(String deps) {
- extraDeps = deps;
+ extraDeps = cleanupPathName(deps);
}
/**
@@ -333,26 +284,29 @@ public class MakeDeps extends Task {
return false;
}
- ///
- /// If the source file(s) is newer than dependency list file, we need to
- /// re-generate the dependency list file
- ///
+ //
+ // If the source file(s) is newer than dependency list file, we need to
+ // re-generate the dependency list file
+ //
long depsFileTimeStamp = df.lastModified();
- Iterator iterator = inputFileList.iterator();
+ Iterator iterator = (Iterator)inputFileList.iterator();
while (iterator.hasNext()) {
- Input inputFile = (Input)iterator.next();
- File sf = new File(inputFile.getFile());
- if (sf.lastModified() > depsFileTimeStamp) {
- return false;
+ Input inputFile = iterator.next();
+ List fileList = inputFile.getNameList();
+ for (int i = 0, length = fileList.size(); i < length; ++i) {
+ File sf = new File(fileList.get(i));
+ if (sf.lastModified() > depsFileTimeStamp) {
+ return false;
+ }
}
}
- ///
- /// If the source files haven't been changed since last time the dependency
- /// list file was generated, we need to check each file in the file list to
- /// see if any of them is changed or not. If anyone of them is newer than
- /// the dependency list file, MakeDeps.exe is needed to run again.
- ///
+ //
+ // If the source files haven't been changed since last time the dependency
+ // list file was generated, we need to check each file in the file list to
+ // see if any of them is changed or not. If anyone of them is newer than
+ // the dependency list file, MakeDeps.exe is needed to run again.
+ //
LineNumberReader lineReader = null;
FileReader fileReader = null;
boolean ret = true;
@@ -363,7 +317,10 @@ public class MakeDeps extends Task {
String line = null;
while ((line = lineReader.readLine()) != null) {
File sourceFile = new File(line);
- if (sourceFile.lastModified() > depsFileTimeStamp) {
+ //
+ // If a file cannot be found (moved or removed) or newer, regenerate the dep file
+ //
+ if ((!sourceFile.exists()) || (sourceFile.lastModified() > depsFileTimeStamp)) {
ret = false;
break;
}