summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 07:34:13 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 07:34:13 +0000
commit51f948637129545bf13f8457a2b1d6863019c7e4 (patch)
tree236af758f3eb11de6b84e6b86128e9e6483cc4ca
parentaa197375d8499fce429dd2dc390b41b53e680d49 (diff)
downloadedk2-platforms-51f948637129545bf13f8457a2b1d6863019c7e4.tar.xz
Update cpptaks to support LIBPATH and INCLUDEPATH which will defined in TOOLS_DEF file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1754 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java36
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java20
2 files changed, 46 insertions, 10 deletions
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
index 56e82de188..f9177cfb62 100644
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
+++ b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
@@ -220,20 +220,36 @@ public class CommandLineUserDefine {
// }
// project.log(logLine.toString(), Project.MSG_VERBOSE);
- int retval = 0;
+ Environment newEnv = new Environment();
- if (userdefine.getDpath() == null || userdefine.getDpath().trim().length() == 0) {
- retval = runCommand(cctask, workdir, cmd, null);
- } else {
- String existPath = System.getenv(getPathName());
- Environment newEnv = new Environment();
+ if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) {
+ String existPath = System.getenv(getPathName("PATH"));
+
Variable var = new Variable();
- var.setKey(getPathName());
+ var.setKey(getPathName("PATH"));
var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));
newEnv.addVariable(var);
- retval = runCommand(cctask, workdir, cmd, newEnv);
}
+ if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) {
+ String existPath = System.getenv(getPathName("LIB"));
+
+ Variable var = new Variable();
+ var.setKey(getPathName("LIB"));
+ var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));
+ newEnv.addVariable(var);
+ }
+
+ if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) {
+ String existPath = System.getenv(getPathName("INCLUDE"));
+
+ Variable var = new Variable();
+ var.setKey(getPathName("INCLUDE"));
+ var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));
+ newEnv.addVariable(var);
+ }
+
+ int retval = runCommand(cctask, workdir, cmd, newEnv);
if (retval != 0) {
throw new BuildException(userdefine.getCmd()
@@ -242,7 +258,7 @@ public class CommandLineUserDefine {
}
}
- private String getPathName() {
+ private String getPathName(String variableName) {
if (pathName != null) {
return pathName;
}
@@ -250,7 +266,7 @@ public class CommandLineUserDefine {
Iterator iter = allEnv.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
- if(key.equalsIgnoreCase("PATH")) {
+ if(key.equalsIgnoreCase(variableName)) {
pathName = key;
break ;
}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
index 9b66ebe9e3..c19c98636e 100644
--- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
+++ b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java
@@ -63,6 +63,10 @@ public class UserDefineDef extends ProcessorDef {
private Vector allLibraries = new Vector();
private String dpath = null;
+
+ private String libpath = null;
+
+ private String include = null;
public void addLibset(LibrarySet libset) {
if (isReference()) {
@@ -310,4 +314,20 @@ public class UserDefineDef extends ProcessorDef {
this.dpath = dpath;
}
+ public String getLibpath() {
+ return libpath;
+ }
+
+ public void setLibpath(String libpath) {
+ this.libpath = libpath;
+ }
+
+ public String getInclude() {
+ return include;
+ }
+
+ public void setInclude(String include) {
+ this.include = include;
+ }
+
}