ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Caoilte O'Connor <li...@caoilte.org>
Subject Re: how to only do stuff if javac compiled something?
Date Fri, 14 Nov 2003 19:13:22 GMT
thanks I'll play with that over the weekend.

but is this really something no one else has ever felt the 
need for? I'm starting to feel like I didn't think my build 
process through properly.

c


On Friday 14 November 2003 19:07, peter reilly wrote:
> The easiest way I can think of is to extend/modify Javac
> and set a property if is actually calls the compiler
> which is done in Javac#compile().
>
> Using my beanshelldef task to extend javac in-line:
>
>  <project default="all">
>   <target name="init">
>     <beanshelldef name="my.javac" classname="MyJavac">
>       import org.apache.tools.ant.taskdefs.Javac;
>       public class MyJavac extends Javac {
>         private String compileProperty;
>         public void setCompileProperty(String
> compileProperty) { this.compileProperty =
> compileProperty; }
>         protected void compile() {
>           if (compileList.length &gt; 0) {
>              if (compileProperty != null) {
>                
> getProject().setNewProperty(compileProperty, "true"); }
>           }
>           super.compile();
>         }
>       }
>     </beanshelldef>
>   </target>
>
>   <target name="compile_classes" depends="init">
>     <my.javac srcdir="src" destdir="classes"
>               compileProperty="classes.compiled"/>
>     <echo>compiled_classes is ${compiled_classes}</echo>
>   </target>
>
>   <target name="test_classes" depends="compile_classes"
> if="classes.compiled"> <echo>Test the classes</echo>
>   </target>
>
>   <target name="package_classes"
>                 depends="compile_classes"
> if="classes.compiled"> <echo>Package the classes</echo>
>   </target>
>
>   <target name="all"
> depends="compile_classes,test_classes,package_classes"/>
> </project>
>
> Peter
>
> On Friday 14 November 2003 17:36, Caoilte O'Connor wrote:
> > I have the following tasks,
> >
> > compile-X
> > test-X
> > package-X
> >
> > other tasks has dependencies on package-X.
> >
> >
> > When package-X gets called and no changes have been
> > made to the source the compile-X doesn't recompile but
> > the test-X and package-X still repeat their processes.
> >
> > Is there anyway I can adjust my compile-X command to
> > call the test-X and package-X directly, dependent on
> > there being some changed/new java files compiled? It
> > would speed up average usage enormously.
> >
> > thanks for any pointers,
> >
> > c
> >
> >
> > -------------------------------------------------------
> >-------------- To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org For additional
> > commands, e-mail: user-help@ant.apache.org
>
> ---------------------------------------------------------
>------------ To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org For additional commands,
> e-mail: user-help@ant.apache.org


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


Mime
View raw message