ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gscok...@apache.org
Subject svn commit: r629817 - in /ant/ivy/core/trunk: ./ doc/configuration/ doc/configuration/caches/ src/java/org/apache/ivy/core/settings/ test/java/org/apache/ivy/ant/ test/java/org/apache/ivy/core/settings/ test/repositories/ test/repositories/extra-attrib...
Date Thu, 21 Feb 2008 15:00:08 GMT
Author: gscokart
Date: Thu Feb 21 07:00:07 2008
New Revision: 629817

URL: http://svn.apache.org/viewvc?rev=629817&view=rev
Log:
Flexible cache management (IVY-399) apply patch of Adrian Sandor

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/doc/configuration/caches.html
    ant/ivy/core/trunk/doc/configuration/caches/cache.html
    ant/ivy/core/trunk/doc/configuration/conf.html
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-test.xml
    ant/ivy/core/trunk/test/repositories/extra-attributes/ivysettings.xml
    ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Feb 21 07:00:07 2008
@@ -9,7 +9,7 @@
  	Maarteen Coene
  	Xavier Hanin
  	Gilles Scokart
- 
+  
  Contributors
  	Ingo Adler
 	Stephane Bailliez
@@ -51,6 +51,7 @@
 	Geoff Reedy
 	Christian Riege
 	Andreas Sahlbach
+	Adrian Sandor 	
 	Ruslan Shevchenko
 	John Shields
 	Johan Stuyts
@@ -73,7 +74,7 @@
 - IMPROVEMENT: Make IBiblio resolver compatible with maven proxy (IVY-466)
 - IMPROVEMENT: Use namespace aware validation (IVY-553)
 - IMPROVEMENT: use ModuleRevisionId instead of ModuleId in IvySettings#getResolver (IVY-691)
-- IMPROVEMENT: Flexible cache management (IVY-399 - not completed yet)
+- IMPROVEMENT: Flexible cache management (IVY-399) (With contribution of Adrian Sandor)
 - IMPROVEMENT: Decrease memory footprint (IVY-662)
 - IMPROVEMENT: Downgrade Ant version requirement to 1.6 to build Ivy (IVY-687)
 - IMPROVEMENT: In the ResolveReport class, add the possibility to filter the evicted module
while getting the list of DownloadArtifact (IVY-704) (thanks to Nicolas Lalevée)

Modified: ant/ivy/core/trunk/doc/configuration/caches.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/configuration/caches.html?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/configuration/caches.html (original)
+++ ant/ivy/core/trunk/doc/configuration/caches.html Thu Feb 21 07:00:07 2008
@@ -27,14 +27,20 @@
 	<textarea id="xooki-source">
 <b>Tag:</b> caches
 
-Defines the list of available repository cache instances. <span class="since">since
2.0</span>.
+Configures the Ivy cache system. <span class="since">since 2.0</span>.
+See <a href="../concept.html#cache">cache concept</a> for details on the Ivy
cache concept.
 
-By default, Ivy defines one repository cache instance, called 'default-cache', and using
the defaults cache settings defined using attributes on this tag. This default instance is
defined as long as you don't define your own default cache using the 'default' attribute,
and have at least one dependency resolver which doesn't specify which cache instance to use.
+By default, Ivy defines one repository cache instance, called 'default-cache', which uses
the default cache settings defined using attributes on this tag. This default instance is
defined as long as you don't define your own default cache using the 'default' attribute,
and have at least one dependency resolver which doesn't specify which cache instance to use.
 
-Since repository cache implementation are pluggable, you can either define new cache instances
based on the default implementation provided in Ivy using the cache child element, or use
custom cache implementations using child elements as you have defined using [[configuration/typedef]].
+<em>defaultCacheDir</em> is the default directory used for both the resolution
and repository cache(s). It usually points to a directory in your filesystem. If you want
to isolate resolution cache from repository cache, we recommend setting both the resolutionCacheDir
and repositoryCacheDir attributes on this tag instead of using defaultCacheDir.
+
+Since repository cache implementations are pluggable, you can either define new cache instances
based on the default implementation provided in Ivy using the [[configuration/caches/cache]]
child element, or use custom cache implementations using child elements as you have defined
using [[configuration/typedef]].
 
 <em>ivyPattern</em> and <em>artifactPattern</em> are used to configure
the default way Ivy stores ivy files and artifacts in repository cache(s). Usually you do
not have to change this, unless you want to use the cache directly from another tool, which
is not recommended. These patterns are relative to the repository cache base directory.
 
+<em>checkUpToDate</em> indicates to ivy if it must check date of artifacts before
retrieving them (i.e. copying them from
+cache to another place in your filesystem). Usually it is a good thing to check date to avoid
unnecessary copy, even if it's most of the time a local copy.
+
 <h1>Attributes</h1>
 <table class="ivy-attributes">
 <thead>
@@ -43,13 +49,20 @@
 <tbody>
     <tr><td>default</td><td>the name of the default cache to use
on all resolvers not defining the cache instance to use</td>
         <td>No, defaults to a default cache manager instance named 'default-cache'</td></tr>
-    <tr><td>basedir</td><td>the path of the default directory to
use to put repository cache data. <strong>This should not point to a directory used
as a repository!</strong></td>
-        <td>No, defaults to defaultCache defined in [[configuration/conf]]</td></tr>
+    <tr><td>defaultCacheDir</td><td>a path to a directory to use
as default basedir for both resolution and repository cache(s)</td>
+        <td>No, defaults to .ivy2/cache in the user's home directory</td></tr>
+    <tr><td>resolutionCacheDir</td><td>the path of the directory
to use for all resolution cache data</td>
+        <td>No, defaults to defaultCacheDir</td></tr>
+    <tr><td>repositoryCacheDir</td><td>the path of the default directory
to use for repository cache data. <strong>This should not point to a directory used
as a repository!</strong></td>
+        <td>No, defaults to defaultCacheDir</td></tr>
     <tr><td>ivyPattern</td><td>default pattern used to indicate where
ivy files should be put in the repository cache(s)</td>
         <td>No, defaults to [organisation]/[module]/ivy-[revision].xml</td></tr>
-    <tr><td>artifactPattern</td><td>default pattern used to indicate
where artifact files should be put in repository cache(s)</td>
+    <tr><td>artifactPattern</td><td>default pattern used to indicate
where artifact files should be put in the repository cache(s)</td>
         <td>No, defaults to [organisation]/[module]/[type]s/[artifact]-[revision].[ext]</td></tr>
-    <tr><td>useOrigin</td><td>the default value to use for useOrigin
for caches in which it isn't specifically defined</td>
+    <tr><td>checkUpToDate</td><td>Indicates if date should be checked
before retrieving artifacts from cache</td>
+        <td>No, defaults to true</td></tr>
+    <tr><td>useOrigin</td><td>the default value to use for useOrigin
for caches in which it isn't specifically defined.
+    	Use true to avoid the copy of local artifacts to the cache and use directly their original
location.</td>
         <td>No, defaults to false</td></tr>
     <tr><td>lockStragegy</td><td>the name of the default [[configuration/lock-strategies
lock strategy]] to use when accessing repository cache(s)</td>
         <td>No, defaults to <em>no-lock</em></td></tr>
@@ -62,8 +75,6 @@
 </thead>
 <tbody>
     <tr><td><a href="caches/cache.html">cache</a></td><td>defines
a new repository cache instance, based on the default repository cache implementation</td>
-        <td>0..n</td></tr>
-    <tr><td><em>any cache</em></td><td>defines a new
repository cache instance</td>
         <td>0..n</td></tr>
 </tbody>
 </table>

Modified: ant/ivy/core/trunk/doc/configuration/caches/cache.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/configuration/caches/cache.html?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/configuration/caches/cache.html (original)
+++ ant/ivy/core/trunk/doc/configuration/caches/cache.html Thu Feb 21 07:00:07 2008
@@ -40,7 +40,7 @@
     <tr><td>name</td><td>name of the cache instance</td>
         <td>Yes</td></tr>
     <tr><td>basedir</td><td>the path of the base directory to use
to put repository cache data. <strong>This should not point to a directory used as a
repository!</strong></td>
-        <td>No, defaults to basedir defined in [[configuration/caches]]</td></tr>
+        <td>No, defaults to repositoryCacheDir defined in [[configuration/caches]]</td></tr>
     <tr><td>ivyPattern</td><td>the pattern to use to store cached
ivy files</td>
         <td>No, defaults to default cache ivy pattern as configured in [[configuration/caches]]</td></tr>
     <tr><td>artifactPattern</td><td>the pattern to use to store cached
artifacts</td>

Modified: ant/ivy/core/trunk/doc/configuration/conf.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/configuration/conf.html?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/configuration/conf.html (original)
+++ ant/ivy/core/trunk/doc/configuration/conf.html Thu Feb 21 07:00:07 2008
@@ -27,22 +27,16 @@
 	<textarea id="xooki-source">
 <b>Tag:</b> settings
 
-Configures some important ivy info: default cache, default resolver, ...
+Configures some important ivy info: default resolver, latest strategy, conflict manager...
 
-Default cache is the default directory used for both the resolution and repository cache(s).
It usually points to a directory in your filesystem. If you want to isolate resolution cache
from repository cache, we recommend setting both the resolutionCacheDir attribute on this
tag and the basedir attribute on [[configuration/caches]] instead of using defaultCache.
-See [[concept cache concept]] for details on Ivy cache concept.
-
-Default resolver is used whenever nothing else is configured in the modules section of the
configuration file. It should give the name of a dependency resolver defined in the resolvers
section of the configuration file.
+Default resolver is used whenever nothing else is configured in the modules section of the
settings file. It should give the name of a dependency resolver defined in the [[configuration/resolvers]]
section of the settings file.
 
 Default latest strategy and conflict manager can also be configured here.
 
-validate indicates if ivy files should generally be validate against xsd or not. This setting
is only a default value, and can be overriden :
+<em>validate</em> indicates if ivy files should generally be validated against
the xsd or not. This setting is only a default value, and can be overridden:
 1) in ant tasks
 2) in resolvers
-So if there is a setting in the resolver, it always win against all other settings.
-
-checkUpToDate indicates to ivy if it must check date of artifacts before retrieving them
(i.e. copying them from
-cache to another place in your filesystem). Usually it is a good thing to check date to avoid
unnecessary copy, even if it's most of the time a local copy.
+So if there is a setting in the resolver, it always wins against all other settings.
 
 <h1>Attributes</h1>
 <table class="ivy-attributes">
@@ -50,10 +44,6 @@
     <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>defaultCache</td><td>a path to a directory to use as
default basedir for both resolution and repository cache(s)</td>
-        <td>No, defaults to .ivy2/cache in user home</td></tr>
-    <tr><td>resolutionCacheDir</td><td>the path of the directory
to use to put all resolution cache data <span class="since">since 2.0</span></td>
-        <td>No, defaults to defaultCache</td></tr>
     <tr><td>defaultResolver</td><td>the name of the default resolver
to use</td>
         <td>No, but all modules should be configured in the modules section if not
provided</td></tr>
     <tr><td>defaultLatestStrategy</td><td>the name of the default
latest strategy to use</td>
@@ -66,14 +56,20 @@
         <td>No, defaults to warn</td></tr>
     <tr><td>validate</td><td>Indicates if ivy files should be validated
against ivy.xsd or not.</td>
         <td>No, defaults to true</td></tr>
-    <tr><td>checkUpToDate</td><td>Indicates if date should be checked
before retrieving artifacts from cache</td>
+    <tr><td>useRemoteConfig</td><td>true to configure ivyrep and
ibiblio resolver from a remote configuration file (updated with changes in those repository
structure if any) (<span class="since">since 1.2</span>)</td>
+        <td>No, defaults to false</td></tr>
+    <tr><td><s>defaultCache</s></td><td>a path to a directory
to use as default basedir for both resolution and repository cache(s).
+	    <i>Deprecated, we recommend using defaultCacheDir on the [[configuration/caches]]
tag instead</i></td>
+        <td>No, defaults to .ivy2/cache in user home</td></tr>
+    <tr><td><s>checkUpToDate</s></td><td>Indicates if
date should be checked before retrieving artifacts from cache.
+    	<i>Deprecated, we recommend using checkUpToDate on the [[configuration/caches]]
tag instead</i></td>
         <td>No, defaults to true</td></tr>
-    <tr><td>cacheIvyPattern</td><td>a pattern to indicate where ivy
files should be put in cache. <i>We recommend using the repositoryIvyPattern on the
[[configuration/cache]] tag instead</i></td>
+    <tr><td><s>cacheIvyPattern</s></td><td>a pattern
to indicate where ivy files should be put in cache.
+    	<i>Deprecated, we recommend using ivyPattern on the [[configuration/caches]] tag
instead</i></td>
         <td>No, defaults to [organisation]/[module]/ivy-[revision].xml</td></tr>
-    <tr><td>cacheArtifactPattern</td><td>a pattern to indicate where
artifact files should be put in cache. <i>We recommend using the repositoryArtifactPattern
on the [[configuration/cache]] tag instead</i></td>
+    <tr><td><s>cacheArtifactPattern</s></td><td>a pattern
to indicate where artifact files should be put in cache.
+    	<i>Deprecated, we recommend using artifactPattern on the [[configuration/caches]]
tag instead</i></td>
         <td>No, defaults to [organisation]/[module]/[type]s/[artifact]-[revision].[ext]</td></tr>
-    <tr><td>useRemoteConfig</td><td>true to configure ivyrep and
ibiblio resolver from a remote configuration file (updated with changes in those repository
structure if any) (<span class="since">since 1.2</span>)</td>
-        <td>No, defaults to false</td></tr>
 </tbody>
 </table>
 </textarea>

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Thu Feb
21 07:00:07 2008
@@ -287,6 +287,8 @@
                 }
                 String cache = (String) attributes.get("defaultCache");
                 if (cache != null) {
+                    Message.deprecated("'defaultCache' is deprecated, "
+                        + "use 'caches[@defaultCacheDir]' instead (" + settings + ")");
                     ivy.setDefaultCache(new File(cache));
                 }
                 String defaultBranch = (String) attributes.get("defaultBranch");
@@ -299,6 +301,8 @@
                 }
                 String up2d = (String) attributes.get("checkUpToDate");
                 if (up2d != null) {
+                    Message.deprecated("'checkUpToDate' is deprecated, "
+                        + "use 'caches[@checkUpToDate]' instead (" + settings + ")");
                     ivy.setCheckUpToDate(Boolean.valueOf(up2d).booleanValue());
                 }
                 String useRemoteConfig = (String) attributes.get("useRemoteConfig");
@@ -306,10 +310,6 @@
                     ivy.setUseRemoteConfig(Boolean.valueOf(useRemoteConfig)
                             .booleanValue());
                 }
-                String resolutionDir = (String) attributes.get("resolutionCacheDir");
-                if (resolutionDir != null) {
-                    ivy.setDefaultResolutionCacheBasedir(resolutionDir);
-                }
                 String cacheIvyPattern = (String) attributes.get("cacheIvyPattern");
                 if (cacheIvyPattern != null) {
                     Message.deprecated(
@@ -337,6 +337,18 @@
                 defaultLock = (String) attributes.get("lockStrategy");
                 defaultCacheManager = (String) attributes.get("default");
                 
+                String cache = (String) attributes.get("defaultCacheDir");
+                if (cache != null) {
+                    ivy.setDefaultCache(new File(cache));
+                }
+                String up2d = (String) attributes.get("checkUpToDate");
+                if (up2d != null) {
+                    ivy.setCheckUpToDate(Boolean.valueOf(up2d).booleanValue());
+                }
+                String resolutionDir = (String) attributes.get("resolutionCacheDir");
+                if (resolutionDir != null) {
+                    ivy.setDefaultResolutionCacheBasedir(resolutionDir);
+                }
                 String useOrigin = (String) attributes.get("useOrigin");
                 if (useOrigin != null) {
                     ivy.setDefaultUseOrigin(Boolean.valueOf(useOrigin).booleanValue());
@@ -349,7 +361,7 @@
                 if (cacheArtPattern != null) {
                     ivy.setDefaultCacheArtifactPattern(cacheArtPattern);
                 }
-                String repositoryDir = (String) attributes.get("basedir");
+                String repositoryDir = (String) attributes.get("repositoryCacheDir");
                 if (repositoryDir != null) {
                     ivy.setDefaultRepositoryCacheBasedir(repositoryDir); 
                 }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml Thu Feb 21
07:00:07 2008
@@ -17,10 +17,9 @@
    under the License.    
 -->
 <ivysettings>
-	<settings resolutionCacheDir="${cache}/resolution" />
-	<caches basedir="${cache}/repository">
+	<caches resolutionCacheDir="${cache}/resolution" repositoryCacheDir="${cache}/repository">
 		<cache name="mycache" />
-		<cache name="mycache2" 
+		<cache name="mycache2"
 				basedir="${cache}/repository2"
 		/>
 	</caches>

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml Thu Feb
21 07:00:07 2008
@@ -17,9 +17,8 @@
    under the License.    
 -->
 <ivysettings>
-	<settings resolutionCacheDir="resolution" />
-	<caches default="mycache2" 
-	        basedir="repository" 
+	<caches default="mycache2" resolutionCacheDir="resolution"
+	        repositoryCacheDir="repository" 
 	        ivyPattern="[module]/ivys/ivy-[revision].xml" 
 	        artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
 	        useOrigin="true"

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-test.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-test.xml?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-test.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-test.xml Thu Feb
21 07:00:07 2008
@@ -19,12 +19,9 @@
 <ivysettings>
 	<property name="shared" value="sharedrep"/>
 	<properties file="test/java/org/apache/ivy/core/settings/ivysettings.properties"/>
-	<settings   defaultCache="mycache" 
-	        defaultResolver="libraries" 
-			validate="false"
-			checkUpToDate="false"
-			/>
-	<caches ivyPattern="[module]/ivys/ivy-[revision].xml" 
+	<settings defaultResolver="libraries" validate="false" />
+	<caches defaultCacheDir="mycache" checkUpToDate="false"
+			ivyPattern="[module]/ivys/ivy-[revision].xml" 
 			artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]" />
 	<latest-strategies>
 	    <latest-revision name="mylatest-revision">

Modified: ant/ivy/core/trunk/test/repositories/extra-attributes/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/extra-attributes/ivysettings.xml?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/extra-attributes/ivysettings.xml (original)
+++ ant/ivy/core/trunk/test/repositories/extra-attributes/ivysettings.xml Thu Feb 21 07:00:07
2008
@@ -17,11 +17,8 @@
    under the License.    
 -->
 <ivysettings>
-   <settings 
-     defaultCache="${ivy.settings.dir}/cache" 
-	 defaultResolver="default" 
-	 />
-   <caches      
+   <settings defaultResolver="default" />
+   <caches defaultCacheDir="${ivy.settings.dir}/cache" 
    	 ivyPattern="[organisation]/[module]/[eatt]/[revision]/ivy.xml"
      artifactPattern="[organisation]/[module]/[eatt]/[revision]/[artifact]-[platform].[ext]"
    />

Modified: ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml?rev=629817&r1=629816&r2=629817&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml (original)
+++ ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml Thu Feb 21 07:00:07 2008
@@ -18,8 +18,8 @@
 -->
 <ivysettings>
 	<properties file="${ivy.settings.dir}/ivysettings.properties" />
-	<settings defaultResolver="test" resolutionCacheDir="${cache.dir}/wkspace"/>
-	<caches basedir="${cache.dir}/repo1"  
+	<settings defaultResolver="test"/>
+	<caches resolutionCacheDir="${cache.dir}/wkspace" repositoryCacheDir="${cache.dir}/repo1"
 
 	        ivyPattern="[module]/ivy-[revision].xml">
 		
 		<cache name="cache2" basedir="${cache.dir}/repo2" 



Mime
View raw message