I'm interested in a couple of ideas that are somewhat along the lines of what XSLT (XSL Transformations) is supposed to support. I'd like to be able to define tasks in XML that correspond to combinations of other tasks. For example, to build a tool for JShell, I have the following generic pattern:

<?xml version="1.0"?>

<!-- builds foo.jxe -->

<project name="wrap" default = "build" basedir = ".">
<property name = "tool" value = "foo" />
<property name = "classes" value = "${tool}.classes" />
<property
name = "jlink"
value = "jlink ${org.jxe.Tools}/${tool}.jxe ${tool}.properties ${classes}" />


        <target name = "classes">
                <mkdir dir = "${classes}" />
                <javac
                        srcdir = "."
                        destdir = "${classes}" />
        </target>

        <target name = "build" depends = "classes">
                <exec command = "echo ${jlink}" />
                <exec command = "${jlink}" />
        </target>

        <target name = "clean">
                <deltree dir = "${classes}" />
        </target>
</project>

What I'd really like to do is to define a task, say "buildtool" that would be composed of sub-tasks, mkdir, javac, and jlink. Of course, I'd want to define a jlink subtask in terms of exec, as I've done above. Is this possible with ant currently?

Another idea I'd like to explore is using Rhino JavaScript (big surprise) to provide scripting within a build.xml file. We could then define additional tasks dynamically in terms of scripts. Much of the currently built-in tasks could be recast in terms of scripts, where appropriate.

- Patrick
--

// Patrick C. Beard
// Java Runtime Enthusiast -- "Will invoke interfaces for food."
// mailto:[EMAIL PROTECTED]

Reply via email to