ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Doing Ant builds
Date Fri, 12 Jun 2009 16:22:52 GMT
On Thu, Jun 11, 2009 at 1:58 PM, Ina, Antoine <antoine.ina@philips.com>wrote:

> I am posing a general question about Ant vs Make vs Batch:
> 1- What is advantage of Ant script over regular Batch script that calls up
> the solution files for all the projects in  your system tree of projects(for
> Windows platform)


Ant and Make do two things that Batch scripts cannot do:

1). Dependency Matrix calculations
2). Build Avoidance

Let's take the first one: Imagine you are building a dozen separate
components, but some of those components depend upon other components to be
built first. You could calculate out your own dependency tree, and then
implement that in your script. But, what happens if things change? Now,
you'll have to recalculate the dependency matrix and probably overhaul your
build script.

Ant and Make both handle the dependency matrix for you. You say that B
depends upon A, and C depends upon A and that A depends upon D, and both Ant
and Make will calculate out the build order of your components. If you make
a change (Say B now depends upon both A and C, Ant and Make will adjust the
build without major rewriting of your build script.

The other major thing is build avoidance. Let's say you have 1000 source
files that are used to build object files and then combined into a single
build entity. If I modify one of those source files, do I have to rebuild
all 1000 build object files? Of course, not. All I have to do is build that
changed object file and rebuild my single build entity.

Doing this build avoidance in a batch script is almost impossible. Doing it
in a Perl or Python script is possible, but a lot of work. Why not simply
use a tool that does it for you?

Now to answer other questions: Why XML for Ant?

XML is a very flexible tool since you can easily have entities embedded in
other entities in a way that's easy to parse. Yes, it isn't the most
readable human language, but then you can use a XML editor to help you. I
use VIM which does syntax highlighting and automatic indentations which
greatly helps me create my build.xml file.

Make and Ant differ in their approach to a build tool. In Make, you depend
upon third party tools such as your compiler and linker. Make only provides
a dependency matrix. The actual tools used to run the build are yours to
provide.

Ant took a different approach in that almost all the major tasks that are
needed for building are provided as part of the basic set. Thus, such tasks
as the <copy> task can also avoid doing extra work just like the <javac>
task does. It also removed the OS dependency upon the build system. The same
Ant file can build on Windows, Mac OS X, Unix, and even VMS and mainframe
operating systems. If you have a Java Development Kit on your system, you
can use the same Ant script.


> 2- How does Ant handle up and down project dependencies
>

I take it this means your dependency matrix. Ant handles this by building a
dependency matrix. You should never specify the order of an Ant build. You
only specify the local dependencies. I merely have to say "A" depends upon
"B" and that "B" depends upon "C". Ant figures out that it has to build "C"
first.

-- 
David Weintraub
qazwart@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message