From 2eab3e96c1a1a20354be86002eac6a6aead9bd58 Mon Sep 17 00:00:00 2001 From: Scokart Gilles Date: Thu, 21 Feb 2008 15:00:07 +0000 Subject: [PATCH] Flexible cache management (IVY-399) apply patch of Adrian Sandor git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@629817 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 5 +-- doc/configuration/caches.html | 29 ++++++++++----- doc/configuration/caches/cache.html | 2 +- doc/configuration/conf.html | 36 +++++++++---------- .../ivy/core/settings/XmlSettingsParser.java | 22 +++++++++--- .../apache/ivy/ant/ivysettings-cleancache.xml | 5 ++- .../ivy/core/settings/ivysettings-cache.xml | 5 ++- .../ivy/core/settings/ivysettings-test.xml | 9 ++--- .../extra-attributes/ivysettings.xml | 7 ++-- test/repositories/ivysettings-multicache.xml | 4 +-- 10 files changed, 68 insertions(+), 56 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 646048b1..e548c0b8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -9,7 +9,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br Maarteen Coene Xavier Hanin Gilles Scokart - + Contributors Ingo Adler Stephane Bailliez @@ -51,6 +51,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br Geoff Reedy Christian Riege Andreas Sahlbach + Adrian Sandor Ruslan Shevchenko John Shields Johan Stuyts @@ -73,7 +74,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br - 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) diff --git a/doc/configuration/caches.html b/doc/configuration/caches.html index 0c8a8412..dc11aa2a 100644 --- a/doc/configuration/caches.html +++ b/doc/configuration/caches.html @@ -27,14 +27,20 @@ diff --git a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java index 59d56b0c..ee115335 100644 --- a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java +++ b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java @@ -287,6 +287,8 @@ public class XmlSettingsParser extends DefaultHandler { } 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 @@ public class XmlSettingsParser extends DefaultHandler { } 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 @@ public class XmlSettingsParser extends DefaultHandler { 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 @@ public class XmlSettingsParser extends DefaultHandler { 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 @@ public class XmlSettingsParser extends DefaultHandler { if (cacheArtPattern != null) { ivy.setDefaultCacheArtifactPattern(cacheArtPattern); } - String repositoryDir = (String) attributes.get("basedir"); + String repositoryDir = (String) attributes.get("repositoryCacheDir"); if (repositoryDir != null) { ivy.setDefaultRepositoryCacheBasedir(repositoryDir); } diff --git a/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml b/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml index 2e1dd292..22c4a5a4 100644 --- a/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml +++ b/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml @@ -17,10 +17,9 @@ under the License. --> - - + - diff --git a/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml b/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml index 5de6a1f2..c1b3b879 100644 --- a/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml +++ b/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml @@ -17,9 +17,8 @@ under the License. --> - - - - + diff --git a/test/repositories/extra-attributes/ivysettings.xml b/test/repositories/extra-attributes/ivysettings.xml index e421a953..89d13e98 100644 --- a/test/repositories/extra-attributes/ivysettings.xml +++ b/test/repositories/extra-attributes/ivysettings.xml @@ -17,11 +17,8 @@ under the License. --> - - + diff --git a/test/repositories/ivysettings-multicache.xml b/test/repositories/ivysettings-multicache.xml index 98e45c33..4be83264 100644 --- a/test/repositories/ivysettings-multicache.xml +++ b/test/repositories/ivysettings-multicache.xml @@ -18,8 +18,8 @@ --> - - +