ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Korobskiy <dkro...@gmail.com>
Subject Re: Configurations really hard to understand
Date Tue, 14 Aug 2007 21:03:42 GMT
Hi, Andy
Re: your e-mail from Tuesday, August 14, 2007 7:36 AM

> Every time I think I have understood configurations my more 
> sophisticated attempts to use them result in resolution errors in 
> ivy. I have been through the tutorial and the docs many times. Does 
> anyone have a good write-up of configuration usage other than the one 
> on the website?

I think I grok Ivy configurations. I'll try to explain the gist of them below.

> In particular I am having problems with "default". This is implicitly 
> defined unless you create your own configurations. If I add my other 
> configuration how do I specify some of the dependencies to have the 
> default configuration? "default", "default->default"?

It is important to keep in mind that configurations of your module are *not*
automatically related to configurations of your dependencies. So, you might have
configurations "test" and "default" in your module, "x","y" and "z" in "foo.bar"
and only "default" in "foo.baz" (if, say, "foo.baz" does not have an Ivy file
whatsoever).

The crux of handling configurations is to understand configuration mappings.
Configuration mappings should define for *each* dependency, how configurations
of your module *map* to configurations of dependent modules. For example,
configuration "test" of your module maps to configurations of "x,y" of "foo.bar"
and "default" of "foo.baz". There are two questions here:

1. What does it mean?
a) then you resolve "test" configuration of your module - аll the artifacts
and dependencies for "x" and "y" configuration of "foo.bar" and "default" of
"foo.baz" would be in the dep. graph
b) when a consuming (parent) module consumes configuration "test" of your module
in a transitive way - ditto

2. How to specify this mapping? There are many ways in Ivy to do it. Let's start
with explicit abbreviated mapping for each dependency:

<dependencies>
    <dependency org="foo" name="bar" rev="1.0" conf="test->x,y"/>
    <dependency org="foo" name="baz" rev="1.0" conf="test->default"/>
</dependencies>

Now, this specification can be optimized further in multiple ways:

a. If *all* configurations are mapped to, say, "default" of "foo.baz", it'd mean
"*->default" or "*->*". In that case the mapping could be omitted altogether.

b. The same mapping for multiple dependencies can be specified as defaultconf:

<dependencies defaultconf="test->x,y">
    <dependency org="foo" name="bar" rev="1.0"/>
    <dependency org="foo" name="baz" rev="1.0" conf="test->default"/>
</dependencies>

c. There is also defaulconfmapping, but I'd not go there - let's leave it for an
advanced course. :)

> In particular lets say I have module A and module B. Both of these 
> have some shared dependencies that should be available at build-time 
> but not test time. My naive configuration would look something like this:

>    <configurations>
>        <conf name="test"/>
>        <conf name="default"/>
>     </configurations>
>     <dependencies defaultconf="default">
>         <dependency org="foo" name="bar" rev="1.0" conf="test->default"/>
>         <dependency org="foo" name="baz" rev="1.0"/>
>    </dependencies>

> But this seems to do something subtly different to what I intend. In 
> particular the definition of foo.bar seems to require a definition of 
> the default configuration.

> Any help or insights appreciated. Apologies for the somewhat random 
> stream of consciousness.

> [Note I don't think the current configuration syntax is particularly 
> intuitive, but I'm not sure what I would suggest as an alternative.]

> andy

I hope it helps.

Dmitriy <1-127-441 @ICQ, DKroot @Skype>
<DKroot1 @AIM, dkroot1_at_gmail_dot_com @Google Talk or @MSN, dk_root @Yahoo>


Mime
View raw message