ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerry Huth <jerry.h...@Sun.COM>
Subject Re: The RIGHT Direction for ANT (was Re: Problem using script task)
Date Wed, 10 Jan 2001 00:10:10 GMT
Jason Rosenberg wrote:
> In my experience, the "dependency-generator" program to which
> you refer is usually a manual process.  Assuming you have built up
> a workable build environment, the job of generating the build-sets
> and dependent deliverable modules, requires little overhead above
> and beyond writing the code itself for which dependencies you are
> trying to track.


Actually I wasn't talking about just dependency generation.  Maybe I
should have called the program I was referring to a "build script
generator".  What I'm talking about is a program that generates the
ANT files (or Make files).  I'm not talking about just automatically
generating dependencies.  I'm talking about automatically generating
the complete build scripts!  I'm talking about using MAKE or ANT for
all they're really good at: processing low-level computer-generated
dependency scripts!

You can think of it as "smart templating": using a program rather than
static templates so that the generated build scripts can be extremely
complex (i.e. feature-rich) with a Constant time programming effort.


> So, frankly it is essential that the build environment is easy to work
> with, and has a set of features which make it easy to create the
> "dependency-reading" programs needed for each module.


Exactly:  Nothing is easier than using a program to automatically 
create the build scripts.


> So, if I have a working template that builds Weblogic EJB's in my 
> environment, for instance, then certainly, I don't want to have to 
> painstakingly redefine the sequence of compiling and jarring and 
> distributing the EJB individually, but rather, I want to reuse it.  
> So, I create a template that knows how to build and jar and distribute
> my ejb's, knows how to clean up after them, knows how
> to update them from cvs, in a standard way.  This is all above
> and beyond the simple 'ejbjar' task that is currently an 'optional'
> task in Ant.  Because I can write a reusable template that
> knows for my environment where all the important classes
> are located (for setting the classpath), etc., the ability to
> have a reusable, customized procedure, really isn't asking
> for too much.
> 
> Now, I simply declare that project X is an EJB, and my
> template now knows what to do with it.  That is the power
> of templating.


I know that simply adding a static template feature to ANT seems like
a great idea if all you've ever done before is written the ANT or MAKE
scripts manually (and honestly you are "on the right track" since you
intuitively understand that there is a better way than writing them by
hand).  However, the programming effort to go the next step and have a
separate program that completely generates the build scripts requires,
as I say, only a Constant time effort but is infinitely more powerful
than static templates.


> I have now done this, but it is rather ugly, since the process of
> creating reusable templates amounts to transferring the bulk
> of my Ant implementation to javascript code called from the
> <script> task.
> 
> Your high-browed discussion of dependency-reading vs.
> dependency-generating programs is a bit off base, not sure
> if it has much of an audience in the real world.


Of course it depends which "real world" you're in.  The simple fact of
the matter is that companies with very large software projects
(millions or tens of millions of LOC's or more) simply do not use ANT
or MAKE directly.  They use generator programs such as I described.

I didn't just make up my analysis of the effort required to develop
and maintain large software build systems; it came from my own
experience.  And in that experience I've found that it was easier to
work on very large software projects with a build script generator
program than on medium-sized projects using just ANT or MAKE.


> What is the big-"O" order for the job of writing software?
> If I write some new code, I also need to define how the
> software should be built, and how it should be deployed.
> This doesn't add significantly to the 'order'.  Especially,
> if the job of stating how to build the module is nothing
> more than labelling the project as (an ejb, a java package,
> a jsp page, or whatever).
> 
> Templating is truly powerful, and I now see how great
> it can be, with my Ant/Javascript implementation.  This
> would have been a royal pain in the butt with Make.
> 
> Probably the biggest flaw in your argument is to have
> lumped together Make and Ant as equivalents.  Ant
> is clearly much easier and much more powerful and
> much more portable than Make.  That's why Ant is
> attractive.  It has little to do with dependency tracking.


But this really gets to the heart of why you can't see my point.  When
you're in the forest one tree may look a lot bigger than another, but
when you're at 20,000 feet they're all just a bunch of toothpicks.



 
> ----- Original Message -----
> From: "Jerry Huth" <jerry.huth@Sun.COM>
> To: <ant-dev@jakarta.apache.org>
> Sent: Tuesday, January 09, 2001 1:57 PM
> Subject: The RIGHT Direction for ANT (was Re: Problem using script task)
> 
> >
> > This discussion about whether or not ANT should have more advanced
> > features such as templates is amusing because the obvious answer is
> > that if your software system is so large that you need such advanced
> > features, then your build system should include both a
> > dependency-generation program as well as a dependency-reading program.
> >
> > ANT and MAKE are dependency-reading programs.  They are meant to read
> > dependency scripts and fire the actions.  They are not meant as
> > human-written scripting languages for large software systems.
> > Dependency-generation programs are those that write out the dependency
> > scripts: they generate the ANT or MAKE build scripts so that humans
> > don't have to.
> >
> > As software systems grow in size, the folly of trying to use the
> > dependency scripts to define your whole software build system becomes
> > more and more apparent.  No matter how many advanced features you add
> > to your dependency-reading program, you will always be able to build
> > large software systems easier using a dependency-generation program in
> > combination with the dependency-reading program.
> >
> > In fact, the only reason to add advanced features to ANT or MAKE is to
> > allow them to be used (however awkwardly) for medium-sized software
> > projects.  For large software projects it is clear that using the two
> > programs in combination is infinitely easier than trying to build the
> > whole system with only a dependency-reading program.  Indeed, MAKE
> > has become exorbitantly bloated with "advanced" features over the
> > years, but still it is completely inadequate for large software
> > systems unless it is used in combination with a dependency-generation
> > program.
> >
> > Mathematically the reason why using the two programs together is
> > easier is that the dependency-generation program requires only
> > Constant time effort (it is not dependent on the size of the software
> > system being built), whereas dependency scripts always require at
> > least some O(n) effort (n is the number of lines of source code being
> > built).  Furthermore, using a dependency-generation program allows you
> > to minimize the O(n) effort by putting the "smarts" of the build
> > system in the dependency-generation program, thus allowing the O(n)
> > scripts to be reduced to their smallest possible size.  Indeed, when
> > used with a good dependency-generation program, the O(n) effort is so
> > small that it is easily handled by the source code developers
> > themselves.
> >
> > Theoretically if a software system is "sufficiently uniform" than a
> > feature as simple as templates could allow ANT or MAKE to be used
> > without a dependency-generation program; but of course as software
> > systems grow in size, their degree of uniformity inevitably lessens
> > due to the increasing need for automation and other advanced build
> > features, so there is always a point at which the use of a separate
> > dependency-generation program is easier.
> >
> > Ultimately, software build systems should provide the most advanced
> > build features to the end-user (the software developer) while reducing
> > the O(n) build script maintainence effort to its minimal value.  And
> > this is precisely why using the two programs in combination is so
> > effective: coding the advanced features of a build system in the
> > Constant-time part (the dependency-generation program) will always
> > require less effort than coding them in the O(n) part (the dependency
> > scripts).
> >
> > What this means for the future direction of ANT is that we shouldn't
> > repeat the mistakes of MAKE by continuing to pile on more and more
> > features of dubious usefullness.  Instead we should focus our efforts
> > on providing an ANT file generator that is sufficiently general to be
> > useful to the software community at large.
> >
> > The irony of using a dependency-generator program is that when you
> > have one you only need very basic features in the dependency-reading
> > program.  ANT doesn't need any more features, it needs a companion ANT
> > file generator program!
> >
> > ---
> >
> > Jerry Huth
> > Sun Microsystems
> > (650) 786-4658
> > jerry.huth@sun.com
> >
> >
> >
> > -------------------------------------------------------------------------
> > Jason Rosenberg wrote:
> > >
> > > > On 1/6/01 9:40 PM, "Jason Rosenberg" <jason@squaretrade.com> wrote:
> > > >
> > > > > Ant is procedural, and that is what I want.  It is close to being
useful,
> > > > > to date, but just needs to add a very small set of features to close
the
> > > > > case.  Simply admitting that it is procedural would really clear
the way.
> > > > > Let's stop beating around the bush.
> > > >
> > > > Nope. Let's not. There are things that Ant needs. IMHO, turning into
> > > > something procedural isn't one of them. I'd rather just write my
> > > > buildscripts in JavaScript if that were the case.
> > > >
> > >
> > > Well, I got into this debate because I wanted to have reusable templates
> > > which are applied across a large set of like modules, etc.  And, as we have
> > > seen, Ant 1.2 is still not adequate in terms of templating, etc.  So, this
> > > leaves us with having to use JavaScript, via the script task, if we want
> > > to have any sort of elegance with Ant.  So, for now, not only are you
> > > right in saying that if you want to do anything procedural, you should
> > > use JavaScript, you also need to add that you really end up doing
> > > everything in JavaScript anyway, even when you are using Ant.
> > >
> > > > I come down to the opinion that calling something data or code is pretty
> > > > tough. After all, software is just data at some point. :) However there
is a
> > > > visceral line drawn about what Ant is good for, and at what point it's
not.
> > > > That line has been labeled with the somewhat, but sort of useful terms
of
> > > > "procedural vs. declarative". Neither term is totally appropriate. But
we
> > > > use them anyway :)
> > > >
> > >
> > > Ant is a build management tool.  It's purpose is to build software.  This
> > > means doing things like javac and javadoc and copy and ejbjar, etc.
> > > These are all procedural tasks.  If you want to be able to represent
> > > a software build module declaratively, then you need to be able
> > > to define it as a data object, with attributes which define how to
> > > build it.  In order to do this constructively, you simply have to have
> > > templates or sub-routines, etc.
> > >
> > > > > Yes, I think the beauty of Ant is that it has the power to keep
> > > > > things simple and human readable.  I like the <execute-task>
> > > > > idea mentioned by someone on another topic, or possibly a
> > > > > simple case:
> > > > >
> > > > > <case property="caseProperty">
> > > > >   <if value="1" execute="doMainCompile"/>
> > > > >   <if value="2" execute="doPartialBuild"/>
> > > > >   <default execute="showErrorAndFaile"/>
> > > > > </case>
> > > >
> > > > But here you are saying you want a "if" target implementation that could
> > > > take any set of attributes and do something. "<execute-target>"
only does
> > > > just that. It's a difference. And, imho, it's a big one.
> > > >
> > >
> > > I don't understand what you said here.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: ant-dev-help@jakarta.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org

Mime
View raw message