You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/28 17:16:19 UTC

svn commit: r490751 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/taskdefs/Javac.java

Author: peterreilly
Date: Thu Dec 28 08:16:18 2006
New Revision: 490751

URL: http://svn.apache.org/viewvc?view=rev&rev=490751
Log:
add updated and error property attributes to the javac task

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?view=diff&rev=490751&r1=490750&r2=490751
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=490751&r1=490750&r2=490751
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Dec 28 08:16:18 2006
@@ -25,6 +25,9 @@
 
 * <script> can now work with bsf.jar and js.jar in its <classpath>.
 
+* add errorProperty and updatedProperty to <javac>
+  Bugzilla 35637 and 28941.
+
 Changes from Ant 1.6.5 to Ant 1.7.0
 ===================================
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?view=diff&rev=490751&r1=490750&r2=490751
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Thu Dec 28 08:16:18 2006
@@ -706,6 +706,10 @@
   </name>
   <name>
     <first>Michael</first>
+    <last>Nygard</last>
+  </name>
+  <name>
+    <first>Michael</first>
     <last>Saunders</last>
   </name>
   <name>
@@ -1000,6 +1004,10 @@
   <name>
     <first>Thomas</first>
     <last>Haas</last>
+  </name>
+  <name>
+    <first>Thomas</first>
+    <last>Quas</last>
   </name>
   <name>
     <first>Tim</first>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java?view=diff&rev=490751&r1=490750&r2=490751
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java Thu Dec 28 08:16:18 2006
@@ -113,6 +113,9 @@
     private String source;
     private String debugLevel;
     private File tmpDir;
+    private String updatedProperty;
+    private String errorProperty;
+    private boolean taskSuccess = true; // assume the best
 
     /**
      * Javac task for compilation of Java files.
@@ -793,6 +796,37 @@
     }
 
     /**
+     * The property to set on compliation success.
+     * This property will not be set if the compilation
+     * fails, or if there are no files to compile.
+     * @param updatedProperty the property name to use.
+     * @since Ant 1.7.1.
+     */
+    public void setUpdatedProperty(String updatedProperty) {
+        this.updatedProperty = updatedProperty;
+    }
+
+    /**
+     * The property to set on compliation failure.
+     * This property will be set if the compilation
+     * fails.
+     * @param errorProperty the property name to use.
+     * @since Ant 1.7.1.
+     */
+    public void setErrorProperty(String errorProperty) {
+        this.errorProperty = errorProperty;
+    }
+
+    /**
+     * Get the result of the javac task (success or failure).
+     * @return true if compilation succeeded, or
+     *         was not neccessary, false if the compilation failed.
+     */
+    public boolean getTaskSuccess() {
+        return taskSuccess;
+    }
+
+    /**
      * Executes the task.
      * @exception BuildException if an error occurs
      */
@@ -818,6 +852,11 @@
         }
 
         compile();
+        if (updatedProperty != null
+            && taskSuccess
+            && compileList.length != 0) {
+            getProject().setNewProperty(updatedProperty, "true");
+        }
     }
 
     /**
@@ -995,6 +1034,11 @@
 
             // finally, lets execute the compiler!!
             if (!adapter.execute()) {
+                this.taskSuccess = false;
+                if (errorProperty != null) {
+                    getProject().setNewProperty(
+                        errorProperty, "true");
+                }
                 if (failOnError) {
                     throw new BuildException(FAIL_MSG, getLocation());
                 } else {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org