Ant Dependency Management

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Ant Dependency Management

R0b0t1
Hello,

When referring to Makefiles, dependencies are rules that represent a
subset of the overall build. With Ant, I they seem to represent
external libraries, so I am having trouble researching my question.

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

Respectfully,
     R0b0t1.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant Dependency Management

Earl Hood
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant Dependency Management

mbenson
In reply to this post by R0b0t1
If you're referring to Java compilation, tools like Ant and Maven
generally perform incremental compilation unless explicitly forced to
do otherwise, such as by "cleaning" (deleting) existing classfiles
from a previous compilation.

HTH,
Matt

On Sat, Oct 28, 2017 at 5:17 PM, R0b0t1 <[hidden email]> wrote:

> Hello,
>
> When referring to Makefiles, dependencies are rules that represent a
> subset of the overall build. With Ant, I they seem to represent
> external libraries, so I am having trouble researching my question.
>
> Is it possible to cache compilation results? I would like to avoid
> lengthy compile times after changing one file.
>
> Respectfully,
>      R0b0t1.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant Dependency Management

mgainty
if you need frequently referenced jars loaded into a "known place" take a look at repository management:
Ivy:

http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html


Building a repository | Apache Ivy<http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html>
ant.apache.org
Building a repository The install Ant task lets you copy a module or a set of modules from one repository to another. This is very useful to build and maintain an ...

Maven Repository Management:

https://maven.apache.org/repository-management.html

Maven – Best Practice - Using a Repository Manager<https://maven.apache.org/repository-management.html>
maven.apache.org
A repository manager is a dedicated server application designed to manage repositories of binary components. The usage of a repository manager is considered an ...

Sonatype's Nexus repository is probably the most widely used repository manager of all:
https://www.sonatype.com/download-oss-sonatype
Download Repository OSS - Sonatype Nexus<https://www.sonatype.com/download-oss-sonatype>
www.sonatype.com
The latest version of Nexus Repository OSS, providing cutting-edge support for the formats below.

/hth/

martin
______________________________________________


________________________________
From: Matt Benson <[hidden email]>
Sent: Saturday, October 28, 2017 7:34 PM
To: Ant Users List
Subject: Re: Ant Dependency Management

If you're referring to Java compilation, tools like Ant and Maven
generally perform incremental compilation unless explicitly forced to
do otherwise, such as by "cleaning" (deleting) existing classfiles
from a previous compilation.

HTH,
Matt

On Sat, Oct 28, 2017 at 5:17 PM, R0b0t1 <[hidden email]> wrote:

> Hello,
>
> When referring to Makefiles, dependencies are rules that represent a
> subset of the overall build. With Ant, I they seem to represent
> external libraries, so I am having trouble researching my question.
>
> Is it possible to cache compilation results? I would like to avoid
> lengthy compile times after changing one file.
>
> Respectfully,
>      R0b0t1.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant Dependency Management

R0b0t1
Hello,

On Sat, Oct 28, 2017 at 6:34 PM, Matt Benson <[hidden email]> wrote:
> If you're referring to Java compilation, tools like Ant and Maven
> generally perform incremental compilation unless explicitly forced to
> do otherwise, such as by "cleaning" (deleting) existing classfiles
> from a previous compilation.
>
> HTH,
> Matt
>

That does help: I realized I should amend my question. The ANTLR task
included with Ant is very old, so I am using an exec task to run the
parser generator instead. How do I add incremental build awareness to
my build-grammar target? Currently, the build target depends on the
build-grammar target. The build-grammar target is run every time,
regardless of whether or not my grammar file has changed.


On Sat, Oct 28, 2017 at 7:43 PM, Martin Gainty <[hidden email]> wrote:

> if you need frequently referenced jars loaded into a "known place" take a look at repository management:
> Ivy:
>
> http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html
>
>
> Building a repository | Apache Ivy<http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html>
> ant.apache.org
> Building a repository The install Ant task lets you copy a module or a set of modules from one repository to another. This is very useful to build and maintain an ...
>

Thanks, I was considering Ivy for this. It took me a while to figure
out what the terminology meant and this link helped.

> Maven Repository Management:
>
> https://maven.apache.org/repository-management.html
>
> Maven – Best Practice - Using a Repository Manager<https://maven.apache.org/repository-management.html>
> maven.apache.org
> A repository manager is a dedicated server application designed to manage repositories of binary components. The usage of a repository manager is considered an ...
>

Maven seems like it does too much for me. Coming from Linux, tools
which reimplement package management tend to get in the way of my
system. On Windows they work fair enough. However, it does seem the
best supported.

> Sonatype's Nexus repository is probably the most widely used repository manager of all:
> https://www.sonatype.com/download-oss-sonatype
> Download Repository OSS - Sonatype Nexus<https://www.sonatype.com/download-oss-sonatype>
> www.sonatype.com
> The latest version of Nexus Repository OSS, providing cutting-edge support for the formats below.
>

I prefer to use open source where possible. In any case, I can't
figure out where to go on that site.


Respectfully,
     R0b0t1.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ant Dependency Management

R0b0t1
Ahh, sorry. I just found the "uptodate" directive. I've done:

<uptodate srcfile="grammar.g4" targetfile="GrammarParser.java"
              property="grammar.uptodate"/>

<target name="build-grammar" unless="grammar.uptodate">
</target>

And all seems to be well.

On Sat, Oct 28, 2017 at 8:19 PM, R0b0t1 <[hidden email]> wrote:

> Hello,
>
> On Sat, Oct 28, 2017 at 6:34 PM, Matt Benson <[hidden email]> wrote:
>> If you're referring to Java compilation, tools like Ant and Maven
>> generally perform incremental compilation unless explicitly forced to
>> do otherwise, such as by "cleaning" (deleting) existing classfiles
>> from a previous compilation.
>>
>> HTH,
>> Matt
>>
>
> That does help: I realized I should amend my question. The ANTLR task
> included with Ant is very old, so I am using an exec task to run the
> parser generator instead. How do I add incremental build awareness to
> my build-grammar target? Currently, the build target depends on the
> build-grammar target. The build-grammar target is run every time,
> regardless of whether or not my grammar file has changed.
>
>
> On Sat, Oct 28, 2017 at 7:43 PM, Martin Gainty <[hidden email]> wrote:
>> if you need frequently referenced jars loaded into a "known place" take a look at repository management:
>> Ivy:
>>
>> http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html
>>
>>
>> Building a repository | Apache Ivy<http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository.html>
>> ant.apache.org
>> Building a repository The install Ant task lets you copy a module or a set of modules from one repository to another. This is very useful to build and maintain an ...
>>
>
> Thanks, I was considering Ivy for this. It took me a while to figure
> out what the terminology meant and this link helped.
>
>> Maven Repository Management:
>>
>> https://maven.apache.org/repository-management.html
>>
>> Maven – Best Practice - Using a Repository Manager<https://maven.apache.org/repository-management.html>
>> maven.apache.org
>> A repository manager is a dedicated server application designed to manage repositories of binary components. The usage of a repository manager is considered an ...
>>
>
> Maven seems like it does too much for me. Coming from Linux, tools
> which reimplement package management tend to get in the way of my
> system. On Windows they work fair enough. However, it does seem the
> best supported.
>
>> Sonatype's Nexus repository is probably the most widely used repository manager of all:
>> https://www.sonatype.com/download-oss-sonatype
>> Download Repository OSS - Sonatype Nexus<https://www.sonatype.com/download-oss-sonatype>
>> www.sonatype.com
>> The latest version of Nexus Repository OSS, providing cutting-edge support for the formats below.
>>
>
> I prefer to use open source where possible. In any case, I can't
> figure out where to go on that site.
>
>
> Respectfully,
>      R0b0t1.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]