[
https://issues.apache.org/jira/browse/IVY-324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474989
]
John Gill commented on IVY-324:
-------------------------------
To be perfectly honest, I nearly didn't submit my previous comment, because
even while I was typing it in, I could feel the beginnings of ideas where
someone might want to use all the constructs that I said you wouldn't use.
Personally, I like to keep things simple, and try not to go for infinite
configurability, but instead try to offer feature that encourage people to do
things "the proper way". Unfortunately that is nearly impossible, because there
are so many opinions on what the proper way is.
I agree that a more fully fledged syntax is needed (and actually forgot
completely about people adding their own extra attribute), but it would be nice
to support at least the '{{type=""}}' option as I feel that would be used
fairly often (well at least I would use it anyway :-) )
As far as a full blown if.. then... else... and... or... not implementation,
that's fine, except that I would say I think if XML is going to be used, then
use XML like XML (if you know what I mean). In other words, I would prefer not
to see something like the example below either as I think it is totally
unreadable, and is just a syntax within no way of checking the grammar easily.
{code:title=Please don't do this|xml}
<artifact pattern="${build.dir}/pkg/[type]/[artifact]-[revision].[ext]"
if="type=jar or (type=source and ext != zip) and artifact !=readme.*"/>
{code}
If your going to support something this rich in syntax, then you might as well
use something that's already out there like jelly, groovy, etc.
Another alternative would be to use <if> <then> <else> <and> <or> <not> tags
like antcontrib uses
(http://ant-contrib.sourceforge.net/tasks/tasks/index.html). If you use that
then you get to use the power of ant conditions. I think including antcontrib
would be quite lightweight as it is very small.
> Conditional patterns
> --------------------
>
> Key: IVY-324
> URL: https://issues.apache.org/jira/browse/IVY-324
> Project: Ivy
> Issue Type: Improvement
> Affects Versions: 1.4
> Reporter: Xavier Hanin
> Assigned To: Xavier Hanin
>
> For the moment Ivy supports optional parts in patterns, but sometimes pattern
> need to be truly conditional.
> Two solutions can be considered:
> - add a condition attribute on patterns occuring in a list, like for all
> resource based dependency resolvers. For instance:
> <artifact
> pattern="path/to/[organisation]/[module]/[revision]/[artifact].[ext]"
> if="type=jar"/>
> <artifact
> pattern="path/to/[organisation]/[module]/[revision]/[artifact]-src.[ext]"
> if="type=source"/>
> - add a special syntax to allow conditional patterns everywhere. The drawback
> of this solution is that it may be difficult to read. The advantage is that
> it could be used wherever patterns are used (without requiring an additional
> attribute). Example:
> <artifact
> pattern="path/to/[organisation]/[module]/[revision]/[artifact]-src.[ext](if
> type=source)|path/to/[organisation]/[module]/[revision]/[artifact].[ext](if
> type=jar)"/>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.