Added documentation about defaultconf and defaultconfmapping (IVY-1135) (thanks to Jon Schneider)

git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@829247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maarten Coene 2009-10-23 21:26:10 +00:00
parent 05712301fc
commit c80ba54609
3 changed files with 32 additions and 20 deletions

View File

@ -29,12 +29,17 @@
A container for configuration elements. If this container is not present, it is assumed that the module has one public configuration called 'default'.
<span class="since">since 1.3</span> You can define a new default conf mapping on this container by specifying the defaultconfmapping attribute.
<span class="since">since 2.2</span> You can define the default conf on this container by specifying the defaultconf attribute. This attribute defines the conf mapping to use when no conf mapping is specified for a dependency in this ivy file.
A default conf mapping is very similar to the defaultconf which can be set on the dependencies tag, but it has a slightly different behaviour.
The default conf mapping not only defines the conf mapping to use when no conf mapping is specified for a dependency in this ivy file, but it also modify the way ivy interprets conf mapping with no mapped conf. In this case, Ivy will look in the default conf mapping and use the conf mapping defined in the default conf mapping for the conf for which there is no mapped conf.
<span class="since">since 1.3</span> You can define a default conf mapping on this container by specifying the defaultconfmapping attribute.
See <a href="../ivyfile/dependency.html#defaultconfmapping">examples on the dependency</a> page.
This attribute modifies the way ivy interprets conf mapping with no mapped conf. In this case, Ivy will look in the default conf mapping and use the conf mapping defined in the default conf mapping for the conf for which there is no mapped conf.
In order to maintain backwards compatibility with Ivy 2.1.0 and earlier, the defaultconfmapping also provides one additional function. If no defaultconf is specified (on either the configurations tag or the dependencies tag), the defaultconfmapping becomes the default configuration for dependencies in this ivy file when no configuration is specified. In other words, in addition to altering the interpretation of individual configurations with no mapping, defaultconfmapping also performs exactly like defaultconf in the absence of a definition for defaultconf.
If several defaultconfmapping or defaultconf attributes are defined (in the configurations tag, one or several in an included configurations file, and/or in the dependency tag, then it's only the last definition of each property which is taken into account. The others will have no effect at all.
See <a href="#defaultconfmapping">examples below</a> to clarify the behavior of these two attributes together.
<span class="since">since 1.4</span> You can activate a confmappingoverride mode for all configurations, in which case the extending configurations will override the mappings of the configurations they extend from.
@ -45,6 +50,7 @@ See <a href="../ivyfile/dependency.html#defaultconfmapping">examples on the depe
<tr><th class="ivy-att">Attribute</th><th class="ivy-att-desc">Description</th><th class="ivy-att-req">Required</th></tr>
</thead>
<tbody>
<tr><td>defaultconf</td><td>the default conf to use in this ivy file <span class="since">since 2.2</span></td><td>No, defaults to no default conf</td></tr>
<tr><td>defaultconfmapping</td><td>the default conf mapping to use in this ivy file <span class="since">since 1.3</span></td>
<td>No, defaults to no default conf mapping</td></tr>
<tr><td>confmappingoverride</td><td>true to activate configuration mapping override, false otherwise <span class="since">since 1.4</span></td>
@ -86,6 +92,22 @@ But when you set confmappingoverride to true, Ivy will construct the following d
As you can see, the defaultmappings of the extending configurations are also added (although you didn't explicitly defined them)
When you now resolve the conf2 configuration, you'll get the other2 dependencies of your other-module.
<h1>Examples involving defaultconf and defaultconfmapping</h1>
<a name="defaultconfmapping"/>The table below indicates how Ivy interprets the conf attribute according to how [[ivyfile/configurations defaultconfmapping]] and [[ivyfile/configurations defaultconf]] are set:<table class="ivy-attributes"><thead><tr><th>defaultconf</th><th>defaultconfmapping</th><th>conf</th><th>ivy interpretation</th></tr>
</thead>
<tbody>
<tr><td></td><td></td><td></td><td><code>*->*</code></td></tr>
<tr><td></td><td></td><td>runtime</td><td><code>runtime->runtime</code></td></tr>
<tr><td></td><td></td><td>test</td><td><code>test->test</code></td></tr>
<tr><td><code>runtime</code></td><td></td><td></td><td><code>runtime->runtime</code></td></tr>
<tr><td><code>runtime</code></td><td><code>runtime->*;test->default</code></td><td></td><td>runtime->*</td></tr>
<tr><td><code>runtime</code></td><td><code>runtime->*;test->default</code></td><td>test</td><td>test->default</td></tr>
<tr><td></td><td><code>runtime->*;test->default</code></td><td></td><td><code>runtime->*;test->default</code></td></tr>
<tr><td></td><td><code>runtime->*;test->default</code></td><td>runtime</td><td><code>runtime->*</code></td></tr>
<tr><td></td><td><code>runtime->*;test->default</code></td><td>test</td><td><code>test->default</code></td></tr>
</tbody>
</table>
</textarea>
<script type="text/javascript">xooki.postProcess();</script>
</body>

View File

@ -30,13 +30,14 @@
Container for dependency elements, used to describe the dependencies of this module.
If this container is not present, it is assumed that the module has no dependency at all.
This container let the possibility to define two very similar things: defaultconf and defaultconfmapping.
This container provides for two similar behaviors. An overview is given here. (See [[ivyfile/configurations configurations doc page]] for more details about these behaviors).
<code>defaultconf</code> exists since Ivy 1.1 and enables to define the default conf attribute to use when no conf is defined for a dependency in this ivy file. It is only used when no conf mapping is defined, and has no influence in other cases.
<span class="since">since 1.1</span><code>defaultconf</code>Defines the conf attribute to use when no conf is defined for a dependency in this ivy file. It is only used when no conf mapping is defined, and has no influence in other cases.
<code>defaultconfmapping</code> exists since Ivy 1.3 and enables not only to define the default conf mapping when no conf is specified for a dependency in this ivy file, but it also influence the way conf mapping with no mapped conf are interpreted (see [[ivyfile/configurations configurations doc page]] for details about this).
<span class="since">since 1.3</span><code>defaultconfmapping</code> Influences the way that a conf mapping with no mapped conf is interpreted.
In Ivy 2.1.0 and earlier, if both defaultconf and defaultconfmapping are defined, it's the defaultconfmapping that is used. Since Ivy 2.2.0, these attributes can be used together.
Note that if both defaultconf and defaultconfmapping are defined, it's the defaultconfmapping that is used. Note also that if several defaultconfmapping are defined (one in the configurations tag, one or several in included configurations file, and/or one in the dependency tag, then it's only the last which is taken into account, the others will have no effect at all.
<h1>Attributes</h1>
<table class="ivy-attributes">
<thead>

View File

@ -70,18 +70,7 @@ The first way to declare this mapping is called the inline mapping. It is maybe
<li>Specify one configuration name</li> This means that in this master configuration the same dependency configuration is needed (except if a defaultconfmapping has been specified in this ivy file, see [[ivyfile/configurations configurations]] for details, or table below for examples).
For instance, if the current module has defined a configuration named 'runtime', and the dependency too, then having an inline mapping configuration set to 'runtime' means that in the runtime master configuration the runtime dependency configuration is required.
<a name="defaultconfmapping"/>More examples:
The table below indicates how ivy interpret the conf attribute according to how [[ivyfile/configurations defaultconfmapping]] is set:<table class="ivy-attributes"><thead><tr><th>defaultconfmapping</th><th>conf</th><th>ivy interpretation</th></tr>
</thead>
<tbody>
<tr><td></td><td></td><td><code>*->*</code></td></tr>
<tr><td></td><td>runtime</td><td><code>runtime->runtime</code></td></tr>
<tr><td></td><td>test</td><td><code>test->test</code></td></tr>
<tr><td><code>runtime->*;test->default</code></td><td></td><td><code>runtime->*;test->default</code></td></tr>
<tr><td><code>runtime->*;test->default</code></td><td>runtime</td><td><code>runtime->*</code></td></tr>
<tr><td><code>runtime->*;test->default</code></td><td>test</td><td><code>test->default</code></td></tr>
</tbody>
</table>
The <a href="../ivyfile/configurations.html#defaultconfmapping">examples on the dependency on the configurations page</a> explain how ivy interprets the conf attribute according to how [[ivyfile/configurations defaultconfmapping]] and [[ivyfile/configurations defaultconf]] is set.
<br/>
<li>Specify a configuration mapping using the '->' operator separating a comma separated list of master configurations (left operand) of a comma separated list of dependency configurations (right operand).</li>
A good way to remember which side is for the master configuration (i.e. the configuration of the module defining the dependency) and which side is for the dependency configuration is to read the '->' as 'depends on'.