summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-27 05:53:35 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-27 05:53:35 +0000
commit32c8b5a94765118ae0552b60365f393ebbc41691 (patch)
tree527e5b9f7698d4afddf57e85ae284a20438e1935
parent16c490eb0710197dfe6465619cec59f5943cfb74 (diff)
downloadedk2-platforms-32c8b5a94765118ae0552b60365f393ebbc41691.tar.xz
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
-rw-r--r--Tools/Conf/BuildMacro.xml32
-rw-r--r--Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java54
-rw-r--r--Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java10
3 files changed, 75 insertions, 21 deletions
diff --git a/Tools/Conf/BuildMacro.xml b/Tools/Conf/BuildMacro.xml
index 5b0d2a4918..27315073cf 100644
--- a/Tools/Conf/BuildMacro.xml
+++ b/Tools/Conf/BuildMacro.xml
@@ -76,7 +76,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}">
<EXTRA.INC/>
<argument value="${LOCAL_CC_FLAGS}"/>
<EXTRA.ARG/>
@@ -138,7 +138,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<var name="LOCAL_CC_FLAGS" value="${CC_FLAGS} /TC /Yc /Fp${DEST_DIR_DEBUG}/AutoGen.h.gch"/>
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj">
+ outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}">
<EXTRA.INC/>
<argument value="${LOCAL_CC_FLAGS}"/>
<EXTRA.ARG/>
@@ -183,7 +183,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}">
<EXTRA.INC/>
<argument value="${LOCAL_CC_FLAGS}"/>
<EXTRA.ARG/>
@@ -230,7 +230,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" dpath="${CC_DPATH}">
<EXTRA.INC/>
<argument value="${PP_FLAGS}"/>
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
@@ -312,7 +312,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" dpath="${PP_DPATH}">
<EXTRA.INC.1/>
<argument value="${PP_FLAGS}"/>
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
@@ -335,7 +335,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}">
<EXTRA.INC.1/>
<argument value="${ASM_FLAGS}"/>
@@ -386,7 +386,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
<command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}">
<EXTRA.INC.1/>
<argument value="${ASM_FLAGS}"/>
@@ -445,7 +445,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" dpath="${PP_DPATH}">
<EXTRA.INC.1/>
<argument value="${PP_FLAGS}"/>
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
@@ -454,7 +454,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
- includepathDelimiter="-I" outputDelimiter="-o"
+ includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<EXTRA.INC.1/>
<argument value="${ASM_FLAGS}"/>
@@ -490,7 +490,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<cc userdefine="on">
- <command type="ASM" includepathDelimiter="-I">
+ <command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}">
<includepath path="${WORKSPACE_DIR}"/>
<includepath path="${MODULE_DIR}"/>
<includepath path="${MODULE_DIR}/${ARCH}"/>
@@ -530,7 +530,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
<command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
- outputFile="${BIN_DIR}/@{FILENAME}.lib">
+ outputFile="${BIN_DIR}/@{FILENAME}.lib" dpath="${SLINK_DPATH}">
<argument value="${SLINK_FLAGS}"/>
<fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
@@ -655,7 +655,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- includepathDelimiter="-I"
+ includepathDelimiter="-I" dpath="${CC_DPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">
<argument value="${LOCAL_CC_FLAGS}"/>
<EXTRA.INC />
@@ -712,7 +712,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</targetfiles>
<sequential>
- <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" DllPath="${DPATH}">
+ <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}">
<EXTRA.INC/>
</vfrcompile>
@@ -732,7 +732,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
- includepathDelimiter="-I" family="${CC_FAMILY}"
+ includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
<argument value="${LOCAL_CC_FLAGS}"/>
<EXTRA.INC/>
@@ -799,7 +799,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<cc userdefine="on">
- <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
+ <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib">
<argument value="${SLINK_FLAGS}"/>
@@ -808,7 +808,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</cc>
<cc userdefine="on">
<command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
- outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" >
+ outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}" >
<argument value="${DLINK_FLAGS}"/>
<libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
<LINK.ARG/>
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 00e3ac620a..56e82de188 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 bf045d1e58..d983880ac7 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;
+ }
+
}