ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Scokart" <gscok...@gmail.com>
Subject RE: flexible cache management (IVY-399)
Date Thu, 03 Jan 2008 14:29:05 GMT

> -----Original Message-----
> From: Xavier Hanin [mailto:xavier.hanin@gmail.com]
> Sent: jeudi 3 janvier 2008 13:59
> To: Ant Developers List
> Subject: flexible cache management (IVY-399)
> 
> Hi,
> 
> Last week I've worked on the cache management to improve its flexibility.
> Now the two kind of caches (resolution and repository caches) are available,
> and the repository cache is now much more flexible: new implementation can
> be supplied by users, and one can choose which repository cache instance to
> use for each resolver.
> 
> By default only one repository cache instance is created, configured using
> defaults value which can be overridden. To ease the settings, any cache
> instance created by the user and relying the default repository cache
> implementation will use the same defaults, so that one can easily override
> the pattern used by all the cache instances used.
> 
> An example of how this can be configured in the current trunk is available
> here:
> https://svn.apache.org/repos/asf/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysetti
> ngs-cache.xml
> 
> The <cacheDefaults> element configures default values for both the
> repository and resolution cache:
> <cacheDefaults
>    resolutionDir="resolution"
>    repositoryDir="repository"
>    repositoryIvyPattern="[module]/ivys/ivy-[revision].xml"
>    repositoryArtifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
>    lockStrategy="artifact-lock"
> />
> 
> Note that unlike 2.0 beta 1, resolutionDir and repositoryDir are not
> relative to a common cache basedir, but are absolute paths. A default
> basedir can still be configured in cacheDefaults using defaultBasedir
> attribute, which is used as default value for both resolutionDir and
> repositoryDir if none is provided.
> 
> Then repository cache instances are configured in the <caches> element:
> <caches>
>   <cache name="mycache"
>      basedir="mycache"
>      ivyPattern="[module]/ivy-[revision].xml"
>      artifactPattern="[module]/[artifact]-[revision].[ext]"
>      lock="no-lock"
>    />
>    <cache name="mycache2" />
> </caches>
> 
> Here the cache named 'mycache' is configured extensively (no use of the
> defaults) while the cache 'mycache2' is only defining one new cache
> instance, using only default values for its base directory, patterns and
> lock strategy.
> 
> Then one can define the repository cache instance to use in one resolver by
> setting the cache attribute:
> <filesystem name="B" cache="mycache">
>   <ivy pattern="${libraries.dir
> }/[organisation]/[module]/ivys/ivy-[revision].xml"/>
>   <artifact pattern="${libraries.dir
> }/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
> </filesystem>
> 
> I'd like to gather some feedback about these changes:
> - Are attribute and element names well chosen? There is for example an
> inconsistency between lockStrategy on cacheDefaults and lock on a cache
> instance. I guess we should better be consistent, which one do you prefer?
> Is the use of cacheDefaults as element name good or should we use cache as
> introduced in 2.0 beta 1?
> - Is breaking the compatibility with 2.0 beta 1 a problem? In beta1 cache
> defaults were provided in a cache element, where resolution and repository
> basedir were relative to a common basedir.
> - Is the defaultBasedir attribute on cacheDefaults a good idea? It's
> basically provided as an equivalent to defaultCache attribute on the
> settings element, itself provided for backward compatibility reason. But I'm
> wondering if we shouldn't deprecate the defaultCache attribute on the
> settings element, and remove defaultBasedir on cacheDefaults, so that user
> configure both resolutionDir and repositoryDir explicitly to make people
> always aware of the two kind of caches.
> 
> WDYT?
> 
> Xavier

I'm actually wondering if we should keep the <cacheDefaults>.  

I mean, all the data that you can define there are actually replacement of some values you
could set in the settings tag
(and that are still documented there), or just default values to gain one or 2 attribute declaration
in the <cache> tag
itself.


PS: By the way, I didn't know that defaultCache in settings was only there for backward compatibility
reason.  I'm using
it in order to have one cache per group of similar project that I have on my machine.  Pretty
usefull!



Gilles



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message