Update cpptaks to support LIBPATH and INCLUDEPATH which will defined in TOOLS_DEF...
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 07:34:13 +0000 (07:34 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 07:34:13 +0000 (07:34 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1754 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/CommandLineUserDefine.java
Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineDef.java

index 56e82de188c38130a83f3895521e4a36e8b6d5f9..f9177cfb62158c8bed8719700995d4336524b615 100644 (file)
@@ -220,20 +220,36 @@ public class CommandLineUserDefine {
 //        }\r
 //        project.log(logLine.toString(), Project.MSG_VERBOSE);\r
 \r
-        int retval = 0;\r
+        Environment newEnv = new Environment();\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
+        if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) {\r
+            String existPath = System.getenv(getPathName("PATH"));\r
+            \r
             Variable var = new Variable();\r
-            var.setKey(getPathName());\r
+            var.setKey(getPathName("PATH"));\r
             var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));\r
             newEnv.addVariable(var);\r
-            retval = runCommand(cctask, workdir, cmd, newEnv);\r
         }\r
         \r
+        if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) {\r
+            String existPath = System.getenv(getPathName("LIB"));\r
+            \r
+            Variable var = new Variable();\r
+            var.setKey(getPathName("LIB"));\r
+            var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));\r
+            newEnv.addVariable(var);\r
+        }\r
+        \r
+        if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) {\r
+            String existPath = System.getenv(getPathName("INCLUDE"));\r
+            \r
+            Variable var = new Variable();\r
+            var.setKey(getPathName("INCLUDE"));\r
+            var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));\r
+            newEnv.addVariable(var);\r
+        }\r
+        \r
+        int retval = runCommand(cctask, workdir, cmd, newEnv);\r
 \r
         if (retval != 0) {\r
             throw new BuildException(userdefine.getCmd()\r
@@ -242,7 +258,7 @@ public class CommandLineUserDefine {
         }\r
     }\r
     \r
-    private String getPathName() {\r
+    private String getPathName(String variableName) {\r
         if (pathName != null) {\r
             return pathName;\r
         }\r
@@ -250,7 +266,7 @@ public class CommandLineUserDefine {
         Iterator iter = allEnv.keySet().iterator();\r
         while (iter.hasNext()) {\r
             String key = (String)iter.next();\r
-            if(key.equalsIgnoreCase("PATH")) {\r
+            if(key.equalsIgnoreCase(variableName)) {\r
                 pathName = key;\r
                 break ;\r
             }\r
index 9b66ebe9e35513f13da3b5f868164c8fe4ccc329..c19c98636e4ca841e9e7f7f107d6aeeb135f47a2 100644 (file)
@@ -63,6 +63,10 @@ public class UserDefineDef extends ProcessorDef {
     private Vector allLibraries = new Vector();\r
     \r
     private String dpath = null;\r
+    \r
+    private String libpath = null;\r
+    \r
+    private String include = null;\r
 \r
     public void addLibset(LibrarySet libset) {\r
         if (isReference()) {\r
@@ -310,4 +314,20 @@ public class UserDefineDef extends ProcessorDef {
         this.dpath = dpath;\r
     }\r
 \r
+    public String getLibpath() {\r
+        return libpath;\r
+    }\r
+\r
+    public void setLibpath(String libpath) {\r
+        this.libpath = libpath;\r
+    }\r
+\r
+    public String getInclude() {\r
+        return include;\r
+    }\r
+\r
+    public void setInclude(String include) {\r
+        this.include = include;\r
+    }\r
+\r
 }\r