DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28941>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28941 [patch] javac && onCompile support Summary: [patch] javac && onCompile support Product: Ant Version: 1.6.1 Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Core tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi all, something that bothered me for some time was the fact that I could not find out whether <javac> actually compiled source files because they were newer than the corresponding build artifacts. In my build scripts, I wanted to use that information to decide whether I do have to generate Hibernate mappings via XDoclet or whether I can safe time and skip that step. Also, I didn't have to bundle a new JAR file if nothing would be compiled by <javac>, resulting in significant build time improvement. So I patched <javac> to support the onCompile directive. Similar to <available> it requires the name of the property that will be set to "true" if <javac> compiles any source files. Benefit: I never appreciated the handling of fileset dependencies and wanted something more straightforward. This solution requires much less effort than writing dependencies of, say, specific source files and XDoclet configuration files that have to be evaluated in order to find out whether XDoclet has to be run. Concrete example: <target name="compile"> <javac destdir="${module.build.classes}" onCompile="moduleA.compiled"> <classpath> <path refid="module.build.classpath"/> </classpath> <src path="${module.tests}"/> <src path="${module.src}"/> <include name="**/*.java"/> </javac> </target> <target name="gen.hibernate-mappings" if="moduleA.compiled"> ... <target name="build.jar" if="moduleA.compiled"> ... <target name="build"> <antcall target="compile"/> <antcall target="gen.hibernate.mappings"/> <antcall target="build.jar"/> ... It would be great if the Ant development team would consider applying this patch to the main line. Thanks, -tom *** The Patch *** Index: src/main/org/apache/tools/ant/taskdefs/Javac.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v retrieving revision 1.115.2.6 diff -r1.115.2.6 Javac.java 942a943,947 > > if ( this.onCompileRef != null ) { > String property = this.getOnCompile(); > getProject().setProperty( property, "true" ); > } 944a950,959 > > public String getOnCompile() { > return this.onCompileRef; > } > > public void setOnCompile( String property ) { > this.onCompileRef = property; > } > > private String onCompileRef; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]