Browse Source

add updated and error property attributes to the javac task

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@490751 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
56956979d8
4 changed files with 57 additions and 0 deletions
  1. +2
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +8
    -0
      contributors.xml
  4. +44
    -0
      src/main/org/apache/tools/ant/taskdefs/Javac.java

+ 2
- 0
CONTRIBUTORS View File

@@ -175,6 +175,7 @@ Michael J. Sikorsky
Michael McCallum
Michael Montuori
Michael Newcomb
Micheal Nygard
Michael Saunders
Miha
Mike Roberts
@@ -252,6 +253,7 @@ Thomas Butz
Thomas Christen
Thomas Christensen
Thomas Haas
Thomas Quas
Tim Drury
Tim Fennell
Timothy Gerard Endres


+ 3
- 0
WHATSNEW View File

@@ -25,6 +25,9 @@ Other changes:

* <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
===================================



+ 8
- 0
contributors.xml View File

@@ -704,6 +704,10 @@
<first>Michael</first>
<last>Newcomb</last>
</name>
<name>
<first>Michael</first>
<last>Nygard</last>
</name>
<name>
<first>Michael</first>
<last>Saunders</last>
@@ -1001,6 +1005,10 @@
<first>Thomas</first>
<last>Haas</last>
</name>
<name>
<first>Thomas</first>
<last>Quas</last>
</name>
<name>
<first>Tim</first>
<last>Drury</last>


+ 44
- 0
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -113,6 +113,9 @@ public class Javac extends MatchingTask {
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.
@@ -792,6 +795,37 @@ public class Javac extends MatchingTask {
return tmpDir;
}

/**
* 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 @@ public class Javac extends MatchingTask {
}

compile();
if (updatedProperty != null
&& taskSuccess
&& compileList.length != 0) {
getProject().setNewProperty(updatedProperty, "true");
}
}

/**
@@ -995,6 +1034,11 @@ public class Javac extends MatchingTask {

// 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 {


Loading…
Cancel
Save