ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: svn commit: r1032922 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BindTargets.java
Date Tue, 09 Nov 2010 17:45:52 GMT
On 2010-11-09, Nicolas Lalevée wrote:

> Le 9 nov. 2010 à 13:39, Stefan Bodewig a écrit :

>> On 2010-11-09, <hibou@apache.org> wrote:

>>> Add a task to bind a target to an extension point.

>> Might be controversial.

I've peeked into the thread that followed but not read everything, yet.
In no way did I want to imply you should have asked before you committed
the task.  I used "controversial" to raise a flag, that's all.

And I may have been too quick with my response to the commit so you
didn't stand a chance of explaining the task.

Historically we have a task by Nikola Ken Barrozzi lurking in bugzilla,
<depend> 12-thousand-and-something (No, I don't know all bug numbers,
I'm cheating, I looked it up earlier when I wrote my first response).
That was turned down and not committed because it would rewrite the
dependency graph at runtime.  Your task seems to do the same.

>> What is the use-case?

> The use case is that I have some common shared build files.

> One is a build file which is taking care of publishing artifacts into
> a repository, so have an extension point "ready-to-be-published".  I
> also have some other build file which is building a jar, and another
> which is building the source jar, and yet another one which is about
> building the javadoc.

> And now I have two different projects.

> In the first one I want to build a jar, its source and its javadoc,
> and publish all of them. So I my build.xml I import my common-jar.xml,
> common-src-jar.xml common-javadoc-jar.xml and common-publish.xml, and
> "bind" the targets "jar", "src-jar" and "javadoc-jar" to the extension
> "ready-to-be-published". So when calling the target "publish", the 3
> jars will be build and published.

> In the second project I want to be able to build the jar, its source
> and its javadoc, and publish only the jar. So I import my
> common-jar.xml, common-src-jar.xml common-javadoc-jar.xml and
> common-publish.xml, and "bind" only the target "jar" to the extension
> "ready-to-be-published". So when calling the target "publish", only
> the binary jar will be build and published.

To recap whether I understand this.  You have a bunch of targets that
you want to add to an extension point.  But which target you want to add
depends on some other context, that's why the targets cannot specify the
extension point themselves.  Right?

Wouldn't a target that depended on the targets you want to add and adds
itself to the extension point achieve the same effect as your task?
That way the graph would still be static.

So rather than a task

<bindtargets targets="jar,src-jar,javadoc-jar" extensionPoint="publish" />

you'd use

<target name="mypublish" depends="jar,src-jar,javadoc-jar"
        extensionOf="publish"/>

>>>   public void setTargets(String target) {
>>>       String[] inputs = target.split(",");

>> Wouldn't a nested element like <ant>'s nested <target> be the better
>> choice?

> I found it more simple and concise to be just one attribute, like de
> "depends" on the target. Do you think there will be issues with the
> attribute where there won't be with a nested element ?

target names containing commas - they are very uncommon because you
can't use them in depends lists, but still.  No, no real issues, just a
matter of style.

Stefan

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


Mime
View raw message