To fix EDKT341. Still existing issues for VfrCompile.
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Sep 2006 05:53:35 +0000 (05:53 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Sep 2006 05:53:35 +0000 (05:53 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1633 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Conf/BuildMacro.xml
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java

index 5b0d2a4..2731507 100644 (file)
@@ -76,7 +76,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
           <cc userdefine="on">\r
             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
-              outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
+              outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}">\r
               <EXTRA.INC/>\r
               <argument value="${LOCAL_CC_FLAGS}"/>\r
               <EXTRA.ARG/>\r
@@ -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"/>\r
               <cc userdefine="on">\r
                 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
-                    outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj">\r
+                    outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}">\r
                   <EXTRA.INC/>\r
                   <argument value="${LOCAL_CC_FLAGS}"/>\r
                   <EXTRA.ARG/>\r
@@ -183,7 +183,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
           <cc userdefine="on">\r
             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
-                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
+                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}">\r
               <EXTRA.INC/>\r
               <argument value="${LOCAL_CC_FLAGS}"/>\r
               <EXTRA.ARG/>\r
@@ -230,7 +230,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
         <sequential>\r
           <cc userdefine="on">\r
             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"\r
-                     outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">\r
+                     outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" dpath="${CC_DPATH}">\r
               <EXTRA.INC/>\r
               <argument value="${PP_FLAGS}"/>\r
               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
@@ -312,7 +312,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
         <sequential>\r
           <cc userdefine="on">\r
-            <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">\r
+            <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" dpath="${PP_DPATH}">\r
               <EXTRA.INC.1/>\r
               <argument value="${PP_FLAGS}"/>\r
               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
@@ -335,7 +335,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
           <cc userdefine="on">\r
             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
-                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
+                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}">\r
               <EXTRA.INC.1/>\r
       \r
               <argument value="${ASM_FLAGS}"/>\r
@@ -386,7 +386,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
         <sequential>\r
           <cc userdefine="on">\r
             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
-                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
+                outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}">\r
               <EXTRA.INC.1/>\r
       \r
               <argument value="${ASM_FLAGS}"/>\r
@@ -445,7 +445,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
         <sequential>\r
           <cc userdefine="on">\r
-            <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">\r
+            <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" dpath="${PP_DPATH}">\r
               <EXTRA.INC.1/>\r
               <argument value="${PP_FLAGS}"/>\r
               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
@@ -454,7 +454,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       \r
           <cc userdefine="on">\r
             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
-                includepathDelimiter="-I" outputDelimiter="-o"\r
+                includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"\r
                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
               <EXTRA.INC.1/>\r
               <argument value="${ASM_FLAGS}"/>\r
@@ -490,7 +490,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
   \r
       <cc userdefine="on">\r
-        <command type="ASM" includepathDelimiter="-I">\r
+        <command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}">\r
           <includepath path="${WORKSPACE_DIR}"/>\r
           <includepath path="${MODULE_DIR}"/>\r
           <includepath path="${MODULE_DIR}/${ARCH}"/>\r
@@ -530,7 +530,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
         <sequential>\r
           <cc userdefine="on">\r
             <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"\r
-                outputFile="${BIN_DIR}/@{FILENAME}.lib">\r
+                outputFile="${BIN_DIR}/@{FILENAME}.lib" dpath="${SLINK_DPATH}">\r
               <argument value="${SLINK_FLAGS}"/>\r
 \r
               <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>\r
@@ -655,7 +655,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
           <cc userdefine="on">\r
             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
-                     includepathDelimiter="-I"\r
+                     includepathDelimiter="-I" dpath="${CC_DPATH}"\r
                      outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">\r
               <argument value="${LOCAL_CC_FLAGS}"/>\r
               <EXTRA.INC />\r
@@ -712,7 +712,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
         </targetfiles>\r
 \r
         <sequential>\r
-          <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" DllPath="${DPATH}">\r
+          <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}">\r
             <EXTRA.INC/>\r
           </vfrcompile>\r
     \r
@@ -732,7 +732,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
           <cc userdefine="on">\r
             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" \r
-                     includepathDelimiter="-I" family="${CC_FAMILY}"\r
+                     includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"\r
                      outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >\r
               <argument value="${LOCAL_CC_FLAGS}"/>\r
               <EXTRA.INC/>\r
@@ -799,7 +799,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
         <sequential>\r
           <cc userdefine="on">\r
-            <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"\r
+            <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"\r
                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib">\r
               <argument value="${SLINK_FLAGS}"/>\r
 \r
@@ -808,7 +808,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
           </cc>\r
           <cc userdefine="on">\r
             <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"\r
-                     outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" >\r
+                     outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}" >\r
               <argument value="${DLINK_FLAGS}"/>\r
               <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>\r
               <LINK.ARG/>\r
index 00e3ac6..56e82de 100644 (file)
@@ -19,6 +19,7 @@ package net.sf.antcontrib.cpptasks.userdefine;
 import java.io.File;\r
 import java.util.Iterator;\r
 import java.util.LinkedHashSet;\r
+import java.util.Map;\r
 import java.util.Set;\r
 import java.util.StringTokenizer;\r
 import java.util.Vector;\r
@@ -31,6 +32,9 @@ import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
 import org.apache.tools.ant.BuildException;\r
 import org.apache.tools.ant.DirectoryScanner;\r
 import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.types.Environment;\r
+import org.apache.tools.ant.types.Path;\r
+import org.apache.tools.ant.types.Environment.Variable;\r
 \r
 /**\r
  * \r
@@ -40,7 +44,9 @@ public class CommandLineUserDefine {
     String includePathDelimiter = null;\r
 \r
     String outputDelimiter = null;\r
-\r
+    \r
+    private static String pathName = null;\r
+    \r
     public void command(CCTask cctask, UserDefineDef userdefine) {\r
         boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC");\r
         File workdir;\r
@@ -136,6 +142,7 @@ public class CommandLineUserDefine {
         // if have source file append source file in command line.\r
         //\r
         Set allSrcFiles = new LinkedHashSet();\r
+\r
         for (int i = 0; i < srcSets.size(); i++) {\r
             ConditionalFileSet srcSet = (ConditionalFileSet) srcSets\r
                             .elementAt(i);\r
@@ -144,7 +151,6 @@ public class CommandLineUserDefine {
                 // Find matching source files\r
                 //\r
                 DirectoryScanner scanner = srcSet.getDirectoryScanner(project);\r
-                \r
                 //\r
                 // Check each source file - see if it needs compilation\r
                 //\r
@@ -207,19 +213,57 @@ public class CommandLineUserDefine {
         for (int j = 0; j < fileNames.length; j++) {\r
             cmd[index++] = fileNames[j];\r
         }\r
+        \r
+//        StringBuffer logLine = new StringBuffer();\r
+//        for(int i = 0; i < cmd.length; i++) {\r
+//            logLine.append(cmd[i] + " ");\r
+//        }\r
+//        project.log(logLine.toString(), Project.MSG_VERBOSE);\r
 \r
-        int retval = runCommand(cctask, workdir, cmd);\r
+        int retval = 0;\r
         \r
+        if (userdefine.getDpath() == null || userdefine.getDpath().trim().length() == 0) {\r
+            retval = runCommand(cctask, workdir, cmd, null);\r
+        } else {\r
+            String existPath = System.getenv(getPathName());\r
+            Environment newEnv = new Environment();\r
+            Variable var = new Variable();\r
+            var.setKey(getPathName());\r
+            var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));\r
+            newEnv.addVariable(var);\r
+            retval = runCommand(cctask, workdir, cmd, newEnv);\r
+        }\r
+        \r
+\r
         if (retval != 0) {\r
             throw new BuildException(userdefine.getCmd()\r
                             + " failed with return code " + retval, cctask\r
                             .getLocation());\r
         }\r
     }\r
+    \r
+    private String getPathName() {\r
+        if (pathName != null) {\r
+            return pathName;\r
+        }\r
+        Map allEnv = System.getenv();\r
+        Iterator iter = allEnv.keySet().iterator();\r
+        while (iter.hasNext()) {\r
+            String key = (String)iter.next();\r
+            if(key.equalsIgnoreCase("PATH")) {\r
+                pathName = key;\r
+                break ;\r
+            }\r
+        }\r
+        return pathName;\r
+    }\r
 \r
-    protected int runCommand(CCTask task, File workingDir, String[] cmdline)\r
+    protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env)\r
                     throws BuildException {\r
-        return CUtil.runCommand(task, workingDir, cmdline, false, null);\r
+        //\r
+        // Write command to File\r
+        //\r
+        return CUtil.runCommand(task, workingDir, cmdline, false, env);\r
 \r
     }\r
 }\r
index bf045d1..d983880 100644 (file)
@@ -61,6 +61,8 @@ public class UserDefineDef extends ProcessorDef {
     private String outputFile;\r
 \r
     private Vector allLibraries = new Vector();\r
+    \r
+    private String dpath = null;\r
 \r
     public void addLibset(LibrarySet libset) {\r
         if (isReference()) {\r
@@ -293,4 +295,12 @@ public class UserDefineDef extends ProcessorDef {
         this.outputDelimiter = outputDelimiter;\r
     }\r
 \r
+    public String getDpath() {\r
+        return dpath;\r
+    }\r
+\r
+    public void setDpath(String dpath) {\r
+        this.dpath = dpath;\r
+    }\r
+\r
 }\r