ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: ProjectHelper (was Re: EasyAnt project)
Date Wed, 29 Oct 2008 17:04:22 GMT

--- Stefan Bodewig <bodewig@apache.org> wrote:

> hijacking a thread.
> 
> On Wed, 29 Oct 2008, Matt Benson
> <gudnabrsam@yahoo.com> wrote:
> 
> > I see; however let me ask you this: which is more
> straightforward,
> > creating a custom ProjectHelper or extending
> Project and/or Target?
> > I guess the answer depends on how comfortable you
> are with the SAX
> > APIs.
> 
> Who said I was using SAX?  I'm not even using XML. 

Touche.  :)

> The main reason to
> write it is to show that Ant doesn't need XML at
> all.
> 
> My "build file" is going to look like this (I'm
> making up half of it):
> 
> @Project(Name="example", DefaultTarget="echo")
> public class BuildFile extends JavaFrontBuildFile {
>     public BuildFile(Project p) {
>         super(p);
>     }
> 
>     @Target
>     public void echo() {
>         getProject().log("Hello world");
>     }
> 
>     @Target(Name="-setproperty")
>     public void setProperty() {
>        
>
taskBuilder().newProperty().withName("world").andValue("world")
>           .execute();
>     }
> 
>     @Target(Depends="-setproperty")
>     public void moreComplexExample() {
>         taskBuilder().newEcho().withMessage("Hello
> ${world}").execute();
>     }
> }
> 
> My Target class extends Target and gets a Runnable
> in its constructor
> which is then run in execute() (it completely
> ignores nested tasks).

This looks like it's friends with my concept of an Ant
DSL except mine is pretty much just a de-XMLization of
the status quo, no OO stuff as you show above.  But
there's no telling when I'll get around to finishing
that.  :(

Okay, what say we move the Project instantiation to
ProjectHelper then, so that custom ProjectHelpers can
influence the Project class used if needed?  This
still doesn't alleviate the problem that EasyAnt will
need a little custom configuration to install the
ProjectHelper and, probably, an Executor.  But these
are both handled with system properties, so this could
either be done with hook scripts or an EasyAnt Main
class that calls Ant Main after setting the necessary
properties.

-Matt

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



      

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


Mime
View raw message