hijacking a thread.

On Wed, 29 Oct 2008, Matt Benson <[EMAIL PROTECTED]> 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.  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).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to