Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure lazy or incremental build in general with Ant?

Java compiler provides incremental build, so javac ant task as well. But most other processes don't.

Considering build processes, they transform some set of files (source) into another set of files (target).

I can distinct two cases here:

  1. Transformator cannot take a subset of source files, only the whole set. Here we can only make lazy build - if no files from source was modified - we skip processing.
  2. Transformator can take a subset of sources files and produce a partial result - incremental build.

What are ant internal, third-party extensions or other tools to implement lazy and incremental build? Can you provide some widespread buildfile examples?

I am interested this to work with GWT compiler in particular.

like image 626
seas Avatar asked Jul 09 '10 20:07

seas


1 Answers

The uptodate task is Ant's generic solution to this problem. It's flexible enough to work in most situations where lazy or incremental compilation is desirable.

I had the same problem as you: I have a GWT module as part of my code, and I don't want to pay the (hefty!) cost of recompiling it when I don't need to. The solution in my case looked something like this:

<uptodate property="gwtCompile.mymodule.notRequired"
  targetfile="www/com.example.MyGwtModule/com.example.MyGwtModule.nocache.js">
    <srcfiles dir="src" includes="**"/>
</uptodate>

<target name="compile-mymodule-gwt" unless="gwtCompile.mymodule.notRequired">
    <compile-gwt-module module="com.example.MyGwtModule"/>
</target>
like image 92
Moss Collum Avatar answered Oct 23 '22 03:10

Moss Collum