ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Rosenberg" <>
Subject Re: Parameterized "task-function"
Date Fri, 12 Jan 2001 20:14:25 GMT

----- Original Message ----- 
From: "Rosen, Alex" <>
To: "'ant-dev'" <>
Sent: Friday, January 12, 2001 1:01 PM
Subject: RE: Parameterized "task-function"

> OK, switching over to ant-dev...

Now the fun is beginning

> > >You want to use a
> > >declarative language to figure out what to build, but you
> > really want to use a
> > >procedural language to describe how to build it.
> >
> > essentially. All procedural-ness is hidden in tasks and tasks
> > should NOT
> > interact with each other.
> I understand what you mean, but that's clearly not the case in one sense. When
> I execute a <javac> task and then a <jar> task, these tasks do "interact"
> some sense, in that the <jar> task wouldn't do anything useful if it were not
> preceeded by the <javac> task. If I switch the order of these XML elements, it
> breaks.

Yep, when things are order dependent, they are procedural, you're prescribing
a process.

> Here's a radical idea (though I wouldn't be surprised if it's been thought of
> before and rejected). What if *all* procedural-ness had to be written in Java,
> but that Java could go in the same file as the declarative statements? Then
> your earlier example might become something like:
> <target name="foo">
>   <java>
> buildJar("bean1");
> buildJar("bean2");
> buildJar("bean3");
> </java>
> </target>
> <java>
> private void buildJar(String name)
> {
> javac("src/java/" + name, "build/" + name);
> jar(name + ".jar", "build/" + name);
> signjar(name + ".jar");
> cab(name + ".cab", "build/" + name);
> signcab(name + ".cab");
> }
> </java>

In one sense, I like this embedded java idea.  It takes away the need
for having the <script> task, and having to include all the bsf and
rhino stuff to get it all to work, etc.

But there are probably serious caveats.  You probably will need to
ensure that there are rules for what kinds of java can be written.
You might get into trouble if you start accessing Ant internals
via java code, etc., or if you start trying to use externally defined
java classes which may or may not be in your classpath, etc.

You might try to have a pre-processing step which disallows
any import statements, or fully qualified references to anything
but a set of agreed upon Ant functions, such as javac, jar, signjar,

But all in all, I am liking the possibilities with this idea.


View raw message