incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Gill (JIRA)" <j...@apache.org>
Subject [jira] Commented: (IVY-324) Conditional patterns
Date Wed, 21 Feb 2007 14:10:05 GMT

    [ https://issues.apache.org/jira/browse/IVY-324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474705
] 

John Gill commented on IVY-324:
-------------------------------

Not sure I like the {{'if="type=jar"'}} syntax and I agree that IVY shouldn't need a whole
bunch of other libraries, as it is just another thing to deploy in your build system.

What I need to be able to do is publish some artifacts as versioned artifacts, and others
as unversioned artifacts.

Initially, I was thinking of something like this:
{code:xml}
<artifact pattern="${build.dir}/pkg/[type:jar]/[artifact]-[revision].[ext]"/>
<artifact pattern="${build.dir}/pkg/[type:*]/[artifact].[ext]"/>
{code} 
Basically the first artifact pattern would apply to jar types (I was thinking that you could
also do stuff like {{[type:jar,zip]}} to mean that it applies to multiple types) , while the
second pattern would apply to all others.  However, the requirement in the example in the
issue description doesn't include the type, so that wouldn't work, hence the suggestion of:

{code:xml}
<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"/>
{code}

If you think about it, are there really that many combinations? The things you can put in
the artifact pattern are:
# [organisation]
# [module]
# [branch]
# [revision]
# [artifact]
# [type]
# [ext]
# [conf]
# [originalname] 

Is it likely that you would want to use all of the above in the suggested 'if' syntax? I tend
to think that you wouldn't want to as it would probably lead to almost all published packages
have come bizarre layout for all the projects, rather than encouraging come kind of standard.
Probably what is most likely would be to want to use [type], [ext].
Using [revision] in the conditional pattern doesn't make sense at all, and [originalname]
probably doesn't either.
I am also not convinced that you would want to have conditional patterns that use [organisation]
or [module].
I also find it difficult to visualise using [artifact] conditionally.
Would use conditional patterns for [branch]? Not sure! What about [conf]? Maybe!

So to my mind, the only items in a pattern that probably need to be conditional are:
* [type]
* [ext]
and maybe
* [conf]
* [branch]
If that is the case, then couldn't ivy just support these 4 things as attributes on the <artifact>
tag? Something like this:

{code:xml}
<artifact pattern="path/to/[organisation]/[module]/[revision]/[artifact].[ext]" type="jar"/>
<artifact pattern="path/to/[organisation]/[module]/[revision]/[artifact]-src.[ext]" type="source"/>
{code}

To do what I want to do, I could use this:

{code:xml}
<artifact pattern="${build.dir}/pkg/[type]/[artifact]-[revision].[ext]" type="jar"/>
<artifact pattern="${build.dir}/pkg/[type]/[artifact].[ext]"/> <!-- used for everything
else -->
{code} 

I guess it could support multiple types (using commas) and allow for things like this:

{code:xml}
<artifact pattern="${build.dir}/pkg/[type]/[artifact]-[revision].[ext]" type="jar,src"/>
<artifact pattern="${build.dir}/pkg/[type]-[revision]/[artifact].[ext]" type="doc" ext="html,gif,jpg"/>
<artifact pattern="${build.dir}/pkg/[type]/[artifact].[ext]"/> <!-- used for everything
else -->
{code} 
Am I talking any kind of sense at all? The reason I ask is that I'm actually not sure :-)

> 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.


Mime
View raw message