diff options
author | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-27 05:53:35 +0000 |
---|---|---|
committer | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-27 05:53:35 +0000 |
commit | 32c8b5a94765118ae0552b60365f393ebbc41691 (patch) | |
tree | 527e5b9f7698d4afddf57e85ae284a20438e1935 /Tools/Source/Cpptasks | |
parent | 16c490eb0710197dfe6465619cec59f5943cfb74 (diff) | |
download | edk2-32c8b5a94765118ae0552b60365f393ebbc41691.zip edk2-32c8b5a94765118ae0552b60365f393ebbc41691.tar.gz edk2-32c8b5a94765118ae0552b60365f393ebbc41691.tar.bz2 |
To fix EDKT341. Still existing issues for VfrCompile.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1633 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/Cpptasks')
-rw-r--r-- | Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java | 54 | ||||
-rw-r--r-- | Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java | 10 |
2 files changed, 59 insertions, 5 deletions
diff --git a/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java b/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java index 00e3ac6..56e82de 100644 --- a/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java +++ b/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java @@ -19,6 +19,7 @@ package net.sf.antcontrib.cpptasks.userdefine; import java.io.File;
import java.util.Iterator;
import java.util.LinkedHashSet;
+import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -31,6 +32,9 @@ import net.sf.antcontrib.cpptasks.types.ConditionalFileSet; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Environment;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Environment.Variable;
/**
*
@@ -40,7 +44,9 @@ public class CommandLineUserDefine { String includePathDelimiter = null;
String outputDelimiter = null;
-
+
+ private static String pathName = null;
+
public void command(CCTask cctask, UserDefineDef userdefine) {
boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");
File workdir;
@@ -136,6 +142,7 @@ public class CommandLineUserDefine { // if have source file append source file in command line.
//
Set allSrcFiles = new LinkedHashSet();
+
for (int i = 0; i < srcSets.size(); i++) {
ConditionalFileSet srcSet = (ConditionalFileSet) srcSets
.elementAt(i);
@@ -144,7 +151,6 @@ public class CommandLineUserDefine { // Find matching source files
//
DirectoryScanner scanner = srcSet.getDirectoryScanner(project);
-
//
// Check each source file - see if it needs compilation
//
@@ -207,19 +213,57 @@ public class CommandLineUserDefine { for (int j = 0; j < fileNames.length; j++) {
cmd[index++] = fileNames[j];
}
+
+// StringBuffer logLine = new StringBuffer();
+// for(int i = 0; i < cmd.length; i++) {
+// logLine.append(cmd[i] + " ");
+// }
+// project.log(logLine.toString(), Project.MSG_VERBOSE);
- int retval = runCommand(cctask, workdir, cmd);
+ int retval = 0;
+ 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();
+ Variable var = new Variable();
+ var.setKey(getPathName());
+ var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));
+ newEnv.addVariable(var);
+ retval = runCommand(cctask, workdir, cmd, newEnv);
+ }
+
+
if (retval != 0) {
throw new BuildException(userdefine.getCmd()
+ " failed with return code " + retval, cctask
.getLocation());
}
}
+
+ private String getPathName() {
+ 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("PATH")) {
+ pathName = key;
+ break ;
+ }
+ }
+ return pathName;
+ }
- protected int runCommand(CCTask task, File workingDir, String[] cmdline)
+ protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env)
throws BuildException {
- return CUtil.runCommand(task, workingDir, cmdline, false, null);
+ //
+ // Write command to File
+ //
+ return CUtil.runCommand(task, workingDir, cmdline, false, env);
}
}
diff --git a/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java b/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java index bf045d1..d983880 100644 --- a/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java +++ b/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java @@ -61,6 +61,8 @@ public class UserDefineDef extends ProcessorDef { private String outputFile;
private Vector allLibraries = new Vector();
+
+ private String dpath = null;
public void addLibset(LibrarySet libset) {
if (isReference()) {
@@ -293,4 +295,12 @@ public class UserDefineDef extends ProcessorDef { this.outputDelimiter = outputDelimiter;
}
+ public String getDpath() {
+ return dpath;
+ }
+
+ public void setDpath(String dpath) {
+ this.dpath = dpath;
+ }
+
}
|