Support two more attribute LIBPATH and INCLUDEPATH in tools_def file.
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / GenBuildTask.java
index d614e67865ea76b3c068847305a3f4e244696669..9a847172f8f0ecfd17f3bc48248db1e34e209dca 100644 (file)
@@ -134,30 +134,25 @@ public class GenBuildTask extends Ant {
         try {\r
             processGenBuild();\r
         } catch (PcdAutogenException e) {\r
-            //\r
-            // Add more logic process here\r
-            //\r
-            throw new BuildException(e.getMessage());\r
+            BuildException buildException = new BuildException(e.getMessage());\r
+            buildException.setStackTrace(e.getStackTrace());\r
+            throw buildException;\r
         } catch (AutoGenException e) {\r
-            //\r
-            // Add more logic process here\r
-            //\r
-            throw new BuildException(e.getMessage());\r
+            BuildException buildException = new BuildException(e.getMessage());\r
+            buildException.setStackTrace(e.getStackTrace());\r
+            throw buildException;\r
         } catch (PlatformPcdPreprocessBuildException e) {\r
-            //\r
-            // Add more logic process here\r
-            //\r
-            throw new BuildException(e.getMessage());\r
+            BuildException buildException = new BuildException(e.getMessage());\r
+            buildException.setStackTrace(e.getStackTrace());\r
+            throw buildException;\r
         } catch (GenBuildException e) {\r
-            //\r
-            // Add more logic process here\r
-            //\r
-            throw new BuildException(e.getMessage());\r
+            BuildException buildException = new BuildException(e.getMessage());\r
+            buildException.setStackTrace(e.getStackTrace());\r
+            throw buildException;\r
         } catch (EdkException e) {\r
-            //\r
-            // Add more logic process here\r
-            //\r
-            throw new BuildException(e.getMessage());\r
+            BuildException buildException = new BuildException(e.getMessage());\r
+            buildException.setStackTrace(e.getStackTrace());\r
+            throw buildException;\r
         }\r
     }\r
 \r
@@ -295,7 +290,7 @@ public class GenBuildTask extends Ant {
                     // don't do anything if no tools found\r
                     //\r
                     if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {\r
-                        EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: No build issued.  No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");\r
+                        EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: No build issued.  No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");\r
                         continue;\r
                     }\r
 \r
@@ -481,6 +476,8 @@ public class GenBuildTask extends Ant {
             key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_NAME;\r
             String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);\r
             if (cmdName.length() == 0) {\r
+                EdkLog.log(this, EdkLog.EDK_VERBOSE, "Warning: " + cmd[m] + " hasn't been defined!");\r
+                getProject().setProperty(cmd[m], "");\r
                 continue;\r
             }\r
             File cmdFile = new File(cmdPath + File.separatorChar + cmdName);\r
@@ -546,6 +543,28 @@ public class GenBuildTask extends Ant {
             } else {\r
                 getProject().setProperty(cmd[m] + "_DPATH", "");\r
             }\r
+            \r
+            //\r
+            // Set CC_LIBPATH\r
+            //\r
+            key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_LIBPATH;\r
+            String libpath = GlobalData.getCommandSetting(key, fpdModuleId);\r
+            if (libpath != null) {\r
+                getProject().setProperty(cmd[m] + "_LIBPATH", libpath.replaceAll("(\\\\)", "/"));\r
+            } else {\r
+                getProject().setProperty(cmd[m] + "_LIBPATH", "");\r
+            }\r
+            \r
+            //\r
+            // Set CC_INCLUDEPATH\r
+            //\r
+            key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_INCLUDEPATH;\r
+            String includepath = GlobalData.getCommandSetting(key, fpdModuleId);\r
+            if (dpath != null) {\r
+                getProject().setProperty(cmd[m] + "_INCLUDEPATH", includepath.replaceAll("(\\\\)", "/"));\r
+            } else {\r
+                getProject().setProperty(cmd[m] + "_INCLUDEPATH", "");\r
+            }\r
         }\r
     }\r
 \r