git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1190243 13f79535-47bb-0310-9956-ffa450edef68master
@@ -134,7 +134,12 @@ Other changes: | |||||
property hasn't been set when the resource was empty even if the | property hasn't been set when the resource was empty even if the | ||||
quiet attribute was set to true. They will now use VERBOSE | quiet attribute was set to true. They will now use VERBOSE | ||||
instead. | instead. | ||||
Bugzilla Report 52107. | |||||
Bugzilla Report 52107. | |||||
* <javac> has a new attribute createMissingPackageInfoClass that can | |||||
be set to false to prevent Ant from creating empty dummy classes | |||||
used for up-to-date-ness checks. | |||||
Bugzilla Report 52096. | |||||
Changes from Ant 1.8.1 TO Ant 1.8.2 | Changes from Ant 1.8.1 TO Ant 1.8.2 | ||||
=================================== | =================================== | ||||
@@ -441,6 +441,22 @@ invoking the compiler.</p> | |||||
</td> | </td> | ||||
<td align="center" valign="top">No - default is "true"</td> | <td align="center" valign="top">No - default is "true"</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">createMissingPackageInfoClass</td> | |||||
<td valign="top"> | |||||
Some package level annotations in <code>package-info.java</code> | |||||
files don't create any <code>package-info.class</code> files so | |||||
Ant would recompile the same file every time.<br/> | |||||
Starting with Ant 1.8 Ant will create an | |||||
empty <code>package-info.class</code> for | |||||
each <code>package-info.java</code> if there isn't one created | |||||
by the compiler.<br/> | |||||
In some setups this additional class causes problems and it can | |||||
be suppressed by setting this attribute to "false". | |||||
<em>Since Ant 1.8.3</em>. | |||||
</td> | |||||
<td align="center" valign="top">No - default is "true"</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Parameters specified as nested elements</h3> | <h3>Parameters specified as nested elements</h3> | ||||
@@ -131,6 +131,8 @@ public class Javac extends MatchingTask { | |||||
private boolean includeDestClasses = true; | private boolean includeDestClasses = true; | ||||
private CompilerAdapter nestedAdapter = null; | private CompilerAdapter nestedAdapter = null; | ||||
private boolean createMissingPackageInfoClass = true; | |||||
/** | /** | ||||
* Javac task for compilation of Java files. | * Javac task for compilation of Java files. | ||||
*/ | */ | ||||
@@ -884,6 +886,17 @@ public class Javac extends MatchingTask { | |||||
nestedAdapter = adapter; | nestedAdapter = adapter; | ||||
} | } | ||||
/** | |||||
* Whether package-info.class files will be created by Ant | |||||
* matching package-info.java files that have been compiled but | |||||
* didn't create class files themselves. | |||||
* | |||||
* @since Ant 1.8.3 | |||||
*/ | |||||
public void setCreateMissingPackageInfoClass(boolean b) { | |||||
createMissingPackageInfoClass = b; | |||||
} | |||||
/** | /** | ||||
* Executes the task. | * Executes the task. | ||||
* @exception BuildException if an error occurs | * @exception BuildException if an error occurs | ||||
@@ -1133,6 +1146,7 @@ public class Javac extends MatchingTask { | |||||
// finally, lets execute the compiler!! | // finally, lets execute the compiler!! | ||||
if (adapter.execute()) { | if (adapter.execute()) { | ||||
// Success | // Success | ||||
if (createMissingPackageInfoClass) { | |||||
try { | try { | ||||
generateMissingPackageInfoClasses(destDir != null | generateMissingPackageInfoClasses(destDir != null | ||||
? destDir | ? destDir | ||||
@@ -1142,6 +1156,7 @@ public class Javac extends MatchingTask { | |||||
// Should this be made a nonfatal warning? | // Should this be made a nonfatal warning? | ||||
throw new BuildException(x, getLocation()); | throw new BuildException(x, getLocation()); | ||||
} | } | ||||
} | |||||
} else { | } else { | ||||
// Fail path | // Fail path | ||||
this.taskSuccess = false; | this.taskSuccess = false; | ||||
@@ -139,6 +139,18 @@ | |||||
<au:assertPropertyEquals name="third-pass" value="true" /> | <au:assertPropertyEquals name="third-pass" value="true" /> | ||||
</target> | </target> | ||||
<target name="testSuppressPackageInfoClass" | |||||
depends="setUpForPackageInfoJava" | |||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=52096"> | |||||
<au:assertFileExists file="${build-dir}/a/package-info.class"/> | |||||
<delete file="${build-dir}/a/package-info.class"/> | |||||
<javac srcdir="${javac-dir}/src" destdir="${build-dir}" | |||||
createMissingPackageInfoClass="false" | |||||
updatedProperty="second-pass" /> | |||||
<au:assertPropertyEquals name="second-pass" value="true" /> | |||||
<au:assertFileDoesntExist file="${build-dir}/a/package-info.class"/> | |||||
</target> | |||||
<target name="-create-javac-adapter"> | <target name="-create-javac-adapter"> | ||||
<property name="adapter.dir" location="${output}/adapter" /> | <property name="adapter.dir" location="${output}/adapter" /> | ||||
<mkdir dir="${input}/org/example" /> | <mkdir dir="${input}/org/example" /> | ||||