You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2015/09/06 17:28:32 UTC
ant-ivy git commit: IVY-1515 : useCacheOnly should allow lookup of
changing dependencies in cache
Repository: ant-ivy
Updated Branches:
refs/heads/master 3fd058c02 -> 12e1aaf5f
IVY-1515 : useCacheOnly should allow lookup of changing dependencies in cache
Thanks to Ilya
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/12e1aaf5
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/12e1aaf5
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/12e1aaf5
Branch: refs/heads/master
Commit: 12e1aaf5f6df97584e795b5e2cfedf5c5f180455
Parents: 3fd058c
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Sun Sep 6 17:28:23 2015 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Sun Sep 6 17:28:23 2015 +0200
----------------------------------------------------------------------
doc/release-notes.html | 2 ++
.../ivy/core/cache/CacheMetadataOptions.java | 11 ++++++++
.../cache/DefaultRepositoryCacheManager.java | 2 +-
.../ivy/plugins/resolver/AbstractResolver.java | 1 +
.../apache/ivy/core/resolve/ResolveTest.java | 21 +++++++++++++++
.../1/usecacheonly/mod4/ivys/ivy-1.0.xml | 27 ++++++++++++++++++++
.../1/usecacheonly/mod4/jars/mod4-1.0.jar | 1 +
.../mod5/ivys/ivy-1.0.0-SNAPSHOT.xml | 24 +++++++++++++++++
.../mod5/jars/mod5-1.0.0-SNAPSHOT.jar | 1 +
9 files changed, 89 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/doc/release-notes.html
----------------------------------------------------------------------
diff --git a/doc/release-notes.html b/doc/release-notes.html
index 0c34994..3c514c0 100644
--- a/doc/release-notes.html
+++ b/doc/release-notes.html
@@ -62,6 +62,7 @@ List of changes since Ivy 2.4.0:
- FIX: PomModuleDescriptorParser should parse licenses from parent POM (IVY-1526) (Thanks to Jaikiran Pai)
- FIX: dynamic revisions are not cached per resolver (IVY-1430) (Thanks to Stephen Haberman)
- FIX: Dependencies failed using branch attribute (and extra attributes) (IVY-1141) (Thanks to Stephen Haberman)
+- FIX: useCacheOnly should allow lookup of changing dependencies in cache (IVY-1515) (Thanks to Ilya)
- IMPROVEMENT: Optimization: limit the revision numbers scanned if revision prefix is specified (Thanks to Ernestas Vaiciukevičius)
@@ -141,6 +142,7 @@ Here is the list of people who have contributed source code and documentation up
<li>Scott Hebert</li>
<li>Payam Hekmat</li>
<li>Achim Huegen</li>
+<li>Ilya</li>
<li>Matt Inger</li>
<li>Anders Jacobsson</li>
<li>Anders Janmyr</li>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java b/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
index a1c77b4..8f827c4 100644
--- a/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
+++ b/src/java/org/apache/ivy/core/cache/CacheMetadataOptions.java
@@ -32,6 +32,8 @@ public class CacheMetadataOptions extends CacheDownloadOptions {
private boolean checkTTL = true;
+ private boolean useCacheOnly = false;
+
public Namespace getNamespace() {
return namespace;
}
@@ -85,4 +87,13 @@ public class CacheMetadataOptions extends CacheDownloadOptions {
public boolean isCheckTTL() {
return checkTTL;
}
+
+ public CacheMetadataOptions setUseCacheOnly(boolean useCacheOnly) {
+ this.useCacheOnly = useCacheOnly;
+ return this;
+ }
+
+ public boolean isUseCacheOnly() {
+ return useCacheOnly;
+ }
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java b/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
index f6b2206..d6f33b7 100644
--- a/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
@@ -686,7 +686,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
Message.verbose("don't use cache for " + mrid + ": checkModified=true");
return null;
}
- if (isChanging(dd, requestedRevisionId, options)) {
+ if (!options.isUseCacheOnly() && isChanging(dd, requestedRevisionId, options)) {
Message.verbose("don't use cache for " + mrid + ": changing=true");
return null;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java b/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
index ef422d4..7c5af9e 100644
--- a/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
@@ -435,6 +435,7 @@ public abstract class AbstractResolver implements DependencyResolver, HasLatestS
.setCheckmodified(
data.getOptions().isUseCacheOnly() ? Boolean.FALSE : checkmodified)
.setValidate(doValidate(data)).setNamespace(getNamespace())
+ .setUseCacheOnly(data.getOptions().isUseCacheOnly())
.setForce(data.getOptions().isRefresh())
.setListener(getDownloadListener(getDownloadOptions(data.getOptions())));
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/test/java/org/apache/ivy/core/resolve/ResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveTest.java b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
index 234e469..7f734d4 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
@@ -5599,6 +5599,27 @@ public class ResolveTest extends TestCase {
assertFalse(report.hasError());
}
+ public void testUseCacheOnlyWithChanging() throws Exception {
+ ResolveOptions option = getResolveOptions(new String[] {"*"});
+ option.setValidate(false);
+
+ ivy.getSettings().setDefaultUseOrigin(true);
+
+ URL url = new File("test/repositories/1/usecacheonly/mod4/ivys/ivy-1.0.xml").toURI()
+ .toURL();
+
+ // normal resolve, the file goes in the cache
+ ResolveReport report = ivy.resolve(url, option);
+ assertFalse(report.hasError());
+
+ option.setUseCacheOnly(true);
+
+ // use cache only, hit the cache
+ report = ivy.resolve(url, option);
+ assertFalse(report.hasError());
+
+ }
+
public void testUnpack() throws Exception {
ResolveOptions options = getResolveOptions(new String[] {"*"});
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/test/repositories/1/usecacheonly/mod4/ivys/ivy-1.0.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/usecacheonly/mod4/ivys/ivy-1.0.xml b/test/repositories/1/usecacheonly/mod4/ivys/ivy-1.0.xml
new file mode 100644
index 0000000..233e65e
--- /dev/null
+++ b/test/repositories/1/usecacheonly/mod4/ivys/ivy-1.0.xml
@@ -0,0 +1,27 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ivy-module version="1.0">
+ <info organisation="usecacheonly" module="mod4" revision="1.0" />
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <dependencies>
+ <dependency org="usecacheonly" name="mod5" rev="[1.0, 2.0)" changing="true" />
+ </dependencies>
+</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/test/repositories/1/usecacheonly/mod4/jars/mod4-1.0.jar
----------------------------------------------------------------------
diff --git a/test/repositories/1/usecacheonly/mod4/jars/mod4-1.0.jar b/test/repositories/1/usecacheonly/mod4/jars/mod4-1.0.jar
new file mode 100644
index 0000000..945c9b4
--- /dev/null
+++ b/test/repositories/1/usecacheonly/mod4/jars/mod4-1.0.jar
@@ -0,0 +1 @@
+.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/test/repositories/1/usecacheonly/mod5/ivys/ivy-1.0.0-SNAPSHOT.xml
----------------------------------------------------------------------
diff --git a/test/repositories/1/usecacheonly/mod5/ivys/ivy-1.0.0-SNAPSHOT.xml b/test/repositories/1/usecacheonly/mod5/ivys/ivy-1.0.0-SNAPSHOT.xml
new file mode 100644
index 0000000..16e0415
--- /dev/null
+++ b/test/repositories/1/usecacheonly/mod5/ivys/ivy-1.0.0-SNAPSHOT.xml
@@ -0,0 +1,24 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<ivy-module version="1.0">
+ <info organisation="usecacheonly" module="mod5" revision="1.0.0-SNAPSHOT" />
+ <configurations>
+ <conf name="default" />
+ </configurations>
+</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/12e1aaf5/test/repositories/1/usecacheonly/mod5/jars/mod5-1.0.0-SNAPSHOT.jar
----------------------------------------------------------------------
diff --git a/test/repositories/1/usecacheonly/mod5/jars/mod5-1.0.0-SNAPSHOT.jar b/test/repositories/1/usecacheonly/mod5/jars/mod5-1.0.0-SNAPSHOT.jar
new file mode 100644
index 0000000..945c9b4
--- /dev/null
+++ b/test/repositories/1/usecacheonly/mod5/jars/mod5-1.0.0-SNAPSHOT.jar
@@ -0,0 +1 @@
+.
\ No newline at end of file