ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject JavaFront update: TagBuilder
Date Thu, 30 Oct 2008 16:55:53 GMT
just committed what could be the initial version for a fluent builder:

$ cat src/etc/examples/Simple3.java
package org.example;

import org.apache.ant.javafront.annotations.AntProject;
import org.apache.ant.javafront.annotations.AntTarget;
import org.apache.tools.ant.Project;
import org.apache.ant.javafront.builder.TagBuilder;

@AntProject(Name="simple3", BaseDir="..", DefaultTarget="hello")
public class Simple3 {
    private Project p;

    public void setProject(Project p) {
        this.p = p;
    }

    @AntTarget(Name="-setup")
    public void setup() {
        TagBuilder.forProject(p)
            .newProperty().withName("world").andValue("world").execute();
    }

    @AntTarget(Depends="-setup")
    public void hello() {
        TagBuilder.forProject(p)
            .newTag("echo")
            .withAttribute("message", "Hello, ${world}!")
            .execute();
    }
}
$ ant -lib build/lib/ant-javafront-0.1.jar -f src/etc/examples/Simple3.java
Buildfile: /home/stefan/dev/ASF/ant-javafront/src/etc/examples/Simple3.java

-setup:
ProjectHelper class org.apache.ant.javafront.helper.JavaFrontHelper can't parse Antlib descriptors,
falling back to ProjectHelper2.

hello:
     [echo] Hello, world!

BUILD SUCCESSFUL
Total time: 0 seconds
$ ant -lib build/lib/ant-javafront-0.1.jar -f src/etc/examples/Simple3.java -Dworld=Welt
Buildfile: /home/stefan/dev/ASF/ant-javafront/src/etc/examples/Simple3.java

-setup:
ProjectHelper class org.apache.ant.javafront.helper.JavaFrontHelper can't parse Antlib descriptors,
falling back to ProjectHelper2.

hello:
     [echo] Hello, Welt!

BUILD SUCCESSFUL
Total time: 0 seconds

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


Mime
View raw message