ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Earl Hood <earlh...@gmail.com>
Subject Re: Ant Dependency Management
Date Sat, 28 Oct 2017 22:52:44 GMT
On Sat, Oct 28, 2017 at 5:17 PM, R0b0t1 wrote:

> Is it possible to cache compilation results? I would like to avoid
> lengthy compile times after changing one file.

What I do for these situations is have the task create an empty file
which can then be used on subsequent executions for a modtime check to
determine if the task should execute or not.

I use something like the following general pattern:

  <target name="sometask"
      unless="skip.sometask"
      depends="sometask-check">
    ...
    <!-- Create empty file for subsequent up-to-date checks -->
    <touch file="sometask.time" verbose="false"/>
  </target>

  <target name="sometask-check">
    <uptodate property="skip.sometask"
        targetfile="sometask.time">
      <!-- Pattern/file set(s) here -->
    </uptodate>
  </target>

The dependent "sometask-check" will set the "skip.sometask" property if
any files specified in the pattern/file set are newer than the file
"sometask.time".

I normally put such modtime-check files in a specific directory that
gets removed when doing a "clean".

Unlike `make', Ant does not have implicit modtime dependency checks, so
you have to roll your own utilizing the <uptodate> task to set a
property that can be used to conditionalize the execution of a task.

--ewh

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


Mime
View raw message