ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marc.deboeck" <marc.debo...@syntigo.com>
Subject Questions about post-resolve tasks
Date Tue, 29 Mar 2011 13:32:17 GMT

Hello,

I have some questions/issues about the post-resolve tasks (we are using Ivy
2.2.0 and Ant 1.8.2). It is not clear to me when a resolve is executed and
when not, and which resolve-result Ivy uses in which situation.

the Ivy doc mentions the following about this:
{quote}
All the post-resolve tasks will trigger automatically a resolve if:
* none has already been called in the current build with the attribute keep
set to true (see below)
* organisation and module are not set
{quote}

First simple question: should I read the two bullets above as an "AND"
statement or an "OR" statement ?

I can not derive the answer from the tests I have made so far:
In my build-environment, I hav a target "ivy:resolve", which is executed
prior to any post-resolve task. This ivy:resolve target is a wrapper around
the ivy:resolve task. The ivy:resolve reads the default dependency file
(ivy.xml):

    <target name="ivy:resolve" description="resolve dependencies with ivy
and copy them to your ivy cache" depends="ivy:init">
		    <ivy:resolve conf="runtime" />
    </target>

However, before doing any post-resolve task related to that resolve, some
other resolve and post-resolve tasks are executed in our build. When calling
these tasks, org and module are either set inline or another (non-default)
dependency file is used.
Now when I execute later in the build a post-resolve task without specifying
a dependency file, the behaviour was not what I expected. Below are some
different cases and the results I obtained from them:

1. ivy:retrieve without any particular attributes
=================================================
extract from the buildfile:
    <target name="ivy:retrieve" description="copy dependencies"
depends="ivy:resolve,other_targets">
         <ivy:retrieve pattern="${project.target.dir}/[artifact].[ext]"
conf="runtime" />
    </target>

=> in the output, I can see that the retrieve-task uses the resolve-results
from the last resolve that was executed. This makes sense, because the
documentation mentions for the file-attribute of a post-resolve task
"Defaults to the previous resolved Ivy file or to ${ivy.dep.file}".

2. ivy.retrieve using ${ivy.dep.file} or resolveId
==================================================
extract from the buildfile:
    <target name="ivy:retrieve" description="copy dependencies"
depends="ivy:resolve,other_targets">
         <ivy:retrieve pattern="${project.target.dir}/[artifact].[ext]"
conf="runtime" file="${ivy.dep.file}"/>
    </target>

=> in the output, I can see that the retrieve-task uses the correct org and
module, but that it starts resolving again (I see it is checking the
ivy-repositories), which takes time...
=> Is there any reason why in this case a new resolve is executed ? Since
there was already a resolve made in this build, I expected that there would
be no additional resolve. Is there otherwise another why of using the
resolve that was previously made when calling the target"ivy:resolve" ?

Note: the same happens in case I use the attribute resolveId:
resolveId="[org]-[module]"

3. ivy.retrieve with transitive attribute different from previous resolve
=========================================================================
In this case, it seems that the post-resolve tasks uses anyway the results
from the previous resolve, even if the value of transitive is different for
the resolve and the post-resolve tasks. So in such cases, I have to execute
a resolve anyway, which will "override" my initial resolve.

My conclusions so far are that it's not worth the effort of doing a resolve
in the beginning of a build and expecting that you can re-use that resolve
throughout the execution of the build. Other resolves may have been done in
between, which seem to override the previous resolve (even if they are for
another ivy-file). Secondly, attributes for the post-resolve task (such as
the transitive-attribute) are not always taken into account and may cause
unexpected results.

Are my conclusions correct, or am I missing something ?

Thanks,
Marc
-- 
View this message in context: http://old.nabble.com/Questions-about-post-resolve-tasks-tp31267659p31267659.html
Sent from the ivy-user mailing list archive at Nabble.com.


Mime
View raw message