summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/Cpptasks/net
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 09:24:08 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 09:24:08 +0000
commitc639781ef01dcfa4a66ac00cc0eb79bb34ef911b (patch)
treea33bee8d937e6f1844838d98bec258f012346827 /Tools/Java/Source/Cpptasks/net
parent8270b34d9de8644edba8157839fdba0e113346d2 (diff)
downloadedk2-platforms-c639781ef01dcfa4a66ac00cc0eb79bb34ef911b.tar.xz
Support two more attribute LIBPATH and INCLUDEPATH in tools_def file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1761 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source/Cpptasks/net')
-rw-r--r--Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java48
1 files changed, 30 insertions, 18 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 f9177cfb62..3ed6c9652f 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
@@ -45,8 +45,6 @@ public class CommandLineUserDefine {
String outputDelimiter = null;
- private static String pathName = null;
-
public void command(CCTask cctask, UserDefineDef userdefine) {
boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");
File workdir;
@@ -222,30 +220,48 @@ public class CommandLineUserDefine {
Environment newEnv = new Environment();
+ //
+ // Prepare for environment variable PATH
+ //
if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) {
- String existPath = System.getenv(getPathName("PATH"));
+ String pathName = getPathName("PATH");
+ String existPath = System.getenv(pathName);
Variable var = new Variable();
- var.setKey(getPathName("PATH"));
+ var.setKey(pathName);
var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));
newEnv.addVariable(var);
}
+ //
+ // Prepare for environment variable LIB
+ //
if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) {
- String existPath = System.getenv(getPathName("LIB"));
-
+ String pathName = getPathName("LIB");
+ String existPath = System.getenv(pathName);
Variable var = new Variable();
- var.setKey(getPathName("LIB"));
- var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));
+ var.setKey(pathName);
+ if (existPath == null) {
+ var.setPath(new Path(project, userdefine.getLibpath()));
+ } else {
+ var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));
+ }
newEnv.addVariable(var);
}
+ //
+ // Prepare for environment variable INCLUDE
+ //
if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) {
- String existPath = System.getenv(getPathName("INCLUDE"));
-
+ String pathName = getPathName("INCLUDE");
+ String existPath = System.getenv(pathName);
Variable var = new Variable();
- var.setKey(getPathName("INCLUDE"));
- var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));
+ var.setKey(pathName);
+ if (existPath == null) {
+ var.setPath(new Path(project, userdefine.getInclude()));
+ } else {
+ var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));
+ }
newEnv.addVariable(var);
}
@@ -259,19 +275,15 @@ public class CommandLineUserDefine {
}
private String getPathName(String variableName) {
- if (pathName != null) {
- return pathName;
- }
Map allEnv = System.getenv();
Iterator iter = allEnv.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
if(key.equalsIgnoreCase(variableName)) {
- pathName = key;
- break ;
+ return key;
}
}
- return pathName;
+ return variableName;
}
protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env)