Author: xavier
Date: Tue Jan 15 09:45:26 2008
New Revision: 612173
URL: http://svn.apache.org/viewvc?rev=612173&view=rev
Log:
IMPROVEMENT: Move useOrigin to repository cache manager (IVY-700)
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/use/cachepath.html
ant/ivy/core/trunk/doc/use/resolve.html
ant/ivy/core/trunk/doc/use/retrieve.html
ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Jan 15 09:45:26 2008
@@ -64,6 +64,7 @@
- NEW: Add ability for buildlist task to start build from specified module in
the list (IVY-697) (thanks to Mirko Bulovic)
- NEW: Cache dynamic revision resolution (IVY-694)
+- IMPROVEMENT: Move useOrigin to repository cache manager (IVY-700)
- 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)
Modified: ant/ivy/core/trunk/doc/configuration/caches.html
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/configuration/caches.html?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/configuration/caches.html (original)
+++ ant/ivy/core/trunk/doc/configuration/caches.html Tue Jan 15 09:45:26 2008
@@ -49,6 +49,8 @@
<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>
<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>
+ <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>
</tbody>
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=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/configuration/caches/cache.html (original)
+++ ant/ivy/core/trunk/doc/configuration/caches/cache.html Tue Jan 15 09:45:26
2008
@@ -45,6 +45,9 @@
<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>
<td>No, defaults to default cache artifact pattern as configured in
[[configuration/caches]]</td></tr>
+ <tr><td>useOrigin</td><td>true to avoid the copy of local artifacts to the
cache and use directly their original location, false otherwise.
+To know if an artifact is local ivy asks to the resolver. Only filesystem
resolver is considered local by default, but this can be disabled if you want
to force the copy on one filesystem resolver and use the original location on
another. Note that it is safe to use useOrigin even if you use the cache for
some non local resolvers. In this case the cache will behave as usual, copying
files to the cache. Note also that this only applies to artifacts, not to ivy
files, which are still copied in the cache.</td>
+ <td>No. defaults to the default value configured in
[[configuration/caches]]</td></tr>
<tr><td>lockStrategy</td><td>the name of the
[[configuration/lock-strategies lock strategy]] to use for this cache</td>
<td>No, defaults to default lock strategy as configured in
[[configuration/caches]]</td></tr>
<tr><td>defaultTTL</td><td>the default [[configuration/caches/ttl TTL]] to
use when no specific one is defined</td>
Modified: ant/ivy/core/trunk/doc/use/cachepath.html
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/cachepath.html?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/cachepath.html (original)
+++ ant/ivy/core/trunk/doc/use/cachepath.html Tue Jan 15 09:45:26 2008
@@ -32,13 +32,6 @@
Please prefer the use of retrieve + standard ant path creation, which make
your build more independent from ivy (once artifacts are properly retrieved,
ivy is not required any more).
Built path is registered in ant with a given id, and can thus be used like any
other ant path using refid.
-
-<span class="since">since 1.4</span> The behaviour is like this when
'useOrigin=true':
-<ul>
-<li>if the artifact is not local, the location from within the cache is
used</li>
-<li>if the artifact is a local artifact, it's original location is used</li>
-</ul>
-Note that if resolve has been called separately, the copy to the cache may
have occur normally if useOrigin was not set when calling [[ant:resolve]]. If
resolve has not been called, it will be called automatically with useOrigin set
to the value specified on this task.
<table class="ant">
<thead>
@@ -50,8 +43,6 @@
<tr><td>conf</td><td>a comma separated list of the configurations to put
in the created path</td>
<td>No. Defaults to the configurations resolved by the last resolve
call, or * if no resolve was explicitly called</td></tr>
<tr><td>type</td><td>comma separated list of artifact types to accept in
the path, * for all (<span class="since">since 1.2</span>)</td><td>No. Defaults
to *</td></tr>
- <tr><td>useOrigin</td><td>true to use original location of local
artifacts, false to use only cache locations <span class="since">since
1.4</span></td>
- <td>No. Defaults false</td></tr>
<tr><td>settingsRef</td><td><span class="since">(since 2.0)</span> A
reference to the ivy settings that must be used by this task</td><td>No,
'ivy.instance' is taken by default.</td></tr>
</tbody>
</table>
Modified: ant/ivy/core/trunk/doc/use/resolve.html
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/resolve.html?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/resolve.html (original)
+++ ant/ivy/core/trunk/doc/use/resolve.html Tue Jan 15 09:45:26 2008
@@ -100,9 +100,6 @@
<tr><td>conf</td><td>a comma separated list of the configurations to
resolve, or '*'.
<span class="since">Since 2.0</span>, you can also use '*(private)',
'*(public)'. Note that when inline is true, the configuration '*' is
equivalent as '*(public)'.</td><td>No. Defaults to
${ivy.configurations}</td></tr>
- <tr><td>useOrigin</td><td>true to avoid the copy of local artifacts to the
cache and use directly their original location, false otherwise <span
class="since">since 1.4</span>.
-To know if an artifact is local ivy asks to the resolver. Only filesystem
resolver is considered local by default, but this can be disabled if you want
to force the copy on one filesystem resolver and use the original location on
another. Note that it is safe to use useOrigin even if you some no local
resolvers, Ivy will behave as usual in this case. Note also that this only
applies to artifacts, not to ivy files, which are still copied in the
cache.</td><td>No. defaults to false</td></tr>
-
<tr><td>refresh</td><td>true to force Ivy to resolve dynamic revision in
this resolve process, false to use cached resolved revision <span
class="since">since 2.0</span></td><td>No. defaults to false</td></tr>
<tr><td>inline</td><td>true to use inline mode, false to resolve an ivy
file <span class="since">since 1.4</span></td><td>No. defaults to
false</td></tr>
Modified: ant/ivy/core/trunk/doc/use/retrieve.html
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/retrieve.html?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/retrieve.html (original)
+++ ant/ivy/core/trunk/doc/use/retrieve.html Tue Jan 15 09:45:26 2008
@@ -60,8 +60,6 @@
<td>No. Defaults to false</td></tr>
<tr><td>type</td><td>comma separated list of accepted artifact types <span
class="since">since 1.4</span></td>
<td>No. All artifact types are accepted by default.</td></tr>
- <tr><td>useOrigin</td><td>true to copy artifacts from their original
location for local artifacts, false to use only cache locations <span
class="since">since 1.4</span></td>
- <td>No. Defaults to false</td></tr>
<tr><td>symlink</td><td>true to create symbolic links, false to copy the
artifacts. The destination of the symbolic links depends on the value of the
useOrigin attribute <span class="since">(since 2.0)</span></td><td>No. Defaults
to false</td></tr>
<tr><td>settingsRef</td><td>A reference to the ivy settings that must be
used by this task <span class="since">(since 2.0)</span></td><td>No,
'ivy.instance' is taken by default.</td></tr></tbody>
</table>
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java Tue Jan 15 09:45:26
2008
@@ -47,6 +47,7 @@
import org.apache.ivy.core.sort.SilentNonMatchingVersionReporter;
import org.apache.ivy.plugins.matcher.PatternMatcher;
import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.util.Message;
import org.apache.ivy.util.filter.Filter;
import org.apache.ivy.util.filter.FilterHelper;
@@ -296,9 +297,12 @@
private ResolveOptions newResolveOptions(String[] confs, String revision,
File cache,
Date date, boolean validate, boolean useCacheOnly, boolean
transitive,
boolean useOrigin, boolean download, boolean outputReport, Filter
artifactFilter) {
+ if (useOrigin) {
+ ivy.getSettings().useDeprecatedUseOrigin();
+ }
return new ResolveOptions().setConfs(confs).setRevision(revision)
.setValidate(validate).setUseCacheOnly(useCacheOnly).setTransitive(transitive)
-
.setUseOrigin(useOrigin).setDownload(download).setOutputReport(outputReport)
+ .setDownload(download).setOutputReport(outputReport)
.setArtifactFilter(artifactFilter);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java Tue Jan 15 09:45:26
2008
@@ -133,7 +133,8 @@
options.addOption("error", false, "set message level to error");
options.addOption("novalidate", false, "do not validate ivy files
against xsd");
options.addOption("useOrigin", false,
- "use original artifact location with local resolvers instead of
copying to the cache");
+ "DEPRECATED: use original artifact location "
+ + "with local resolvers instead of copying to the cache");
options.addOption("sync", false, "in conjonction with -retrieve, does
a synced retrieve");
options.addOption("m2compatible", false, "use maven2 compatibility");
options.addOption("?", false, "display this help");
@@ -226,8 +227,11 @@
}
}
+ if (line.hasOption("useOrigin")) {
+ ivy.getSettings().useDeprecatedUseOrigin();
+ }
ResolveOptions resolveOptions = new
ResolveOptions().setConfs(confs)
-
.setValidate(validate).setUseOrigin(line.hasOption("useOrigin"));
+ .setValidate(validate);
ResolveReport report = ivy.resolve(ivyfile.toURL(),
resolveOptions);
if (report.hasError()) {
System.exit(1);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Tue Jan 15
09:45:26 2008
@@ -300,6 +300,9 @@
}
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs,
IvySettings settings) {
+ if (useOrigin) {
+ settings.useDeprecatedUseOrigin();
+ }
return new ResolveOptions()
.setConfs(confs)
.setValidate(doValidate(settings))
@@ -307,7 +310,6 @@
.setRevision(revision)
.setDate(getPubDate(pubdate, null))
.setUseCacheOnly(useCacheOnly)
- .setUseOrigin(useOrigin)
.setRefresh(refresh)
.setTransitive(transitive)
.setResolveId(resolveId);
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
Tue Jan 15 09:45:26 2008
@@ -19,17 +19,9 @@
public class CacheDownloadOptions {
- private boolean useOrigin = false;
private DownloadListener listener = null;
private boolean force = false;
-
- public boolean isUseOrigin() {
- return useOrigin;
- }
- public CacheDownloadOptions setUseOrigin(boolean useOrigin) {
- this.useOrigin = useOrigin;
- return this;
- }
+
public DownloadListener getListener() {
return listener;
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Tue Jan 15 09:45:26 2008
@@ -89,6 +89,8 @@
private String changingMatcherName = PatternMatcher.EXACT_OR_REGEXP;
private Boolean checkmodified;
+
+ private Boolean useOrigin;
private ModuleRules/*<Long>*/ ttlRules = new ModuleRules();
@@ -263,7 +265,7 @@
}
/**
- * True if this resolver should check lastmodified date to know if ivy
files are up to date.
+ * True if this cache should check lastmodified date to know if ivy files
are up to date.
*
* @return
*/
@@ -285,6 +287,26 @@
}
/**
+ * True if this cache should use artifacts original location when
possible, false if they should
+ * be copied to cache.
+ */
+ public boolean isUseOrigin() {
+ if (useOrigin == null) {
+ if (getSettings() != null) {
+ return getSettings().isDefaultUseOrigin();
+ } else {
+ return false;
+ }
+ } else {
+ return useOrigin.booleanValue();
+ }
+ }
+
+ public void setUseOrigin(boolean b) {
+ useOrigin = Boolean.valueOf(b);
+ }
+
+ /**
* Returns a File object pointing to where the artifact can be found on
the local file system.
* This is usually in the cache, but it can be directly in the repository
if it is local and if
* the resolve has been done with useOrigin = true
@@ -317,7 +339,8 @@
* provided as parameter and the setting of useOrigin. If useOrigin is
false, this method will
* always return the file in the cache.
*/
- public File getArchiveFileInCache(Artifact artifact, ArtifactOrigin
origin, boolean useOrigin) {
+ private File getArchiveFileInCache(
+ Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
if (useOrigin && origin != null && origin != ArtifactOrigin.UNKNOWN &&
origin.isLocal()) {
return new File(origin.getLocation());
} else {
@@ -661,7 +684,7 @@
ResourceDownloader resourceDownloader,
CacheDownloadOptions options) {
final ArtifactDownloadReport adr = new
ArtifactDownloadReport(artifact);
- boolean useOrigin = options.isUseOrigin();
+ boolean useOrigin = isUseOrigin();
// TODO: see if we could lock on the artifact to download only,
instead of the module
// metadata artifact. We'd need to store artifact origin and is local
in artifact specific
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
Tue Jan 15 09:45:26 2008
@@ -129,7 +129,7 @@
report.setDependencies(Arrays.asList(dependencies),
artifactFilter);
Message.info(":: downloading artifacts to cache ::");
- resolveEngine.downloadArtifacts(report, false, artifactFilter);
+ resolveEngine.downloadArtifacts(report, artifactFilter);
// now that everything is in cache, we can publish all these
modules
Message.info(":: installing in " + to + " ::");
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
Tue Jan 15 09:45:26 2008
@@ -64,6 +64,9 @@
* This engine is not intended to be used concurrently with publish, the order
of repository loaded
* being undeterministic and long, it could end up in having an inconsistent
in memory state.
* </p>
+ * <p>
+ * For better performance, we strongly suggest using this engine with cache in
useOrigin mode.
+ * </p>
*/
public class RepositoryManagementEngine {
private static final double THOUSAND = 1000.0;
@@ -314,8 +317,7 @@
}
private ResolveData newResolveData() {
- return new ResolveData(resolveEngine,
- new ResolveOptions().setUseOrigin(true));
+ return new ResolveData(resolveEngine, new ResolveOptions());
}
private void ensureAnalyzed() {
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
Tue Jan 15 09:45:26 2008
@@ -19,13 +19,7 @@
public class DownloadOptions {
- private boolean useOrigin = false;
- public DownloadOptions(boolean useOrigin) {
- this.useOrigin = useOrigin;
- }
-
- public boolean isUseOrigin() {
- return useOrigin;
+ public DownloadOptions() {
}
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
Tue Jan 15 09:45:26 2008
@@ -274,7 +274,7 @@
if (options.isDownload()) {
Message.verbose(":: downloading artifacts ::");
- downloadArtifacts(report, options.isUseOrigin(),
options.getArtifactFilter());
+ downloadArtifacts(report, options.getArtifactFilter());
}
if (options.isOutputReport()) {
@@ -305,8 +305,7 @@
report.output(settings.getReportOutputters(), cacheMgr);
}
- public void downloadArtifacts(ResolveReport report,
- boolean useOrigin, Filter artifactFilter) {
+ public void downloadArtifacts(ResolveReport report, Filter artifactFilter)
{
long start = System.currentTimeMillis();
IvyNode[] dependencies = (IvyNode[]) report.getDependencies().toArray(
new IvyNode[report.getDependencies().size()]);
@@ -323,7 +322,7 @@
.getArtifactResolver();
Artifact[] selectedArtifacts =
dependencies[i].getSelectedArtifacts(artifactFilter);
DownloadReport dReport = resolver.download(selectedArtifacts,
- new DownloadOptions(useOrigin));
+ new DownloadOptions());
ArtifactDownloadReport[] adrs = dReport.getArtifactsReports();
for (int j = 0; j < adrs.length; j++) {
if (adrs[j].getDownloadStatus() == DownloadStatus.FAILED) {
@@ -371,7 +370,7 @@
public ArtifactDownloadReport download(Artifact artifact, boolean
useOrigin) {
DependencyResolver resolver =
settings.getResolver(artifact.getModuleRevisionId());
DownloadReport r = resolver.download(new Artifact[] {artifact},
- new DownloadOptions(useOrigin));
+ new DownloadOptions());
return r.getArtifactReport(artifact);
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
Tue Jan 15 09:45:26 2008
@@ -80,13 +80,6 @@
private boolean outputReport = true;
/**
- * True if the original files from the repositories should be used instead
of downloaded ones,
- * false otherwise. This means that artifacts which can be used directory
in their original
- * location won't be downloaded if this option is set to true
- */
- private boolean useOrigin = false;
-
- /**
* A filter to use to avoid downloading all artifacts.
*/
private Filter artifactFilter = FilterHelper.NO_FILTER;
@@ -111,7 +104,6 @@
transitive = options.transitive;
download = options.download;
outputReport = options.outputReport;
- useOrigin = options.useOrigin;
artifactFilter = options.artifactFilter;
resolveId = options.resolveId;
}
@@ -230,15 +222,6 @@
public ResolveOptions setRevision(String revision) {
this.revision = revision;
- return this;
- }
-
- public boolean isUseOrigin() {
- return useOrigin;
- }
-
- public ResolveOptions setUseOrigin(boolean useOrigin) {
- this.useOrigin = useOrigin;
return this;
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
Tue Jan 15 09:45:26 2008
@@ -197,6 +197,8 @@
private String defaultCacheArtifactPattern;
+ private boolean defaultUseOrigin;
+
public IvySettings() {
this(new IvyVariableContainerImpl());
}
@@ -1289,5 +1291,20 @@
public String getDefaultCacheArtifactPattern() {
return defaultCacheArtifactPattern;
+ }
+
+ public void setDefaultUseOrigin(boolean useOrigin) {
+ defaultUseOrigin = useOrigin;
+ }
+
+ public boolean isDefaultUseOrigin() {
+ return defaultUseOrigin;
+ }
+
+ public void useDeprecatedUseOrigin() {
+ Message.deprecated("useOrigin option is deprecated when calling
resolve, use useOrigin"
+ + " setting on the cache implementation instead");
+ setDefaultUseOrigin(true);
+
}
}
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=612173&r1=612172&r2=612173&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
Tue Jan 15 09:45:26 2008
@@ -337,6 +337,10 @@
defaultLock = (String) attributes.get("lockStrategy");
defaultCacheManager = (String) attributes.get("default");
+ String useOrigin = (String) attributes.get("useOrigin");
+ if (useOrigin != null) {
+
ivy.setDefaultUseOrigin(Boolean.valueOf(useOrigin).booleanValue());
+ }
String cacheIvyPattern = (String) attributes.get("ivyPattern");
if (cacheIvyPattern != null) {
ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
Tue Jan 15 09:45:26 2008
@@ -183,7 +183,7 @@
* avoid the download
*/
public boolean exists(Artifact artifact) {
- DownloadReport dr = download(new Artifact[] {artifact}, new
DownloadOptions(true));
+ DownloadReport dr = download(new Artifact[] {artifact}, new
DownloadOptions());
ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
return adr.getDownloadStatus() != DownloadStatus.FAILED;
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
Tue Jan 15 09:45:26 2008
@@ -574,8 +574,7 @@
for (int i = 0; i < artifacts.length; i++) {
ArtifactDownloadReport adr = cacheManager.download(
artifacts[i], artifactResourceResolver, downloader,
- getCacheDownloadOptions()
- .setUseOrigin(options.isUseOrigin()));
+ getCacheDownloadOptions());
if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
if
(!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
Message.warn("\t" + adr);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
Tue Jan 15 09:45:26 2008
@@ -180,9 +180,12 @@
}
public void testUseOrigin() throws Exception {
+ ((DefaultRepositoryCacheManager)
ivy.getSettings().getDefaultRepositoryCacheManager())
+ .setUseOrigin(true);
+
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
getResolveOptions(
- new String[] {"default"}).setUseOrigin(true));
+ new String[] {"default"}));
assertNotNull(report);
ArtifactDownloadReport[] dReports =
report.getConfigurationReport("default")
@@ -3750,10 +3753,10 @@
ModuleRevisionId module = ModuleRevisionId.newInstance("org1",
"mod1.1", "1.+");
- // use a non-default cache
+ // use non-default options and settings
+ ivy.getSettings().setDefaultUseOrigin(true);
ResolveOptions options = getResolveOptions(ivy.getSettings(), new
String[] {"*"});
options.setTransitive(false);
- options.setUseOrigin(true);
options.setDownload(false);
ResolveReport report = ivy.getResolveEngine().resolve(module, options,
false);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
Tue Jan 15 09:45:26 2008
@@ -175,6 +175,7 @@
assertEquals("[module]/ivys/ivy-[revision].xml",
settings.getDefaultCacheIvyPattern());
assertEquals("[module]/[type]s/[artifact]-[revision].[ext]", settings
.getDefaultCacheArtifactPattern());
+ assertEquals(true, settings.isDefaultUseOrigin());
DefaultRepositoryCacheManager c = (DefaultRepositoryCacheManager)
settings.getRepositoryCacheManager("mycache");
assertNotNull(c);
@@ -188,6 +189,7 @@
assertEquals(60 * 3600 * 1000, // 2d 12h = 60h
c.getTTL(ModuleRevisionId.newInstance("org3", "A", "A")));
assertEquals(new File("mycache"), c.getBasedir());
+ assertEquals(false, c.isUseOrigin());
assertEquals("no-lock", c.getLockStrategy().getName());
assertEquals("[module]/ivy-[revision].xml", c.getIvyPattern());
@@ -201,6 +203,8 @@
assertEquals("[module]/ivys/ivy-[revision].xml", c2.getIvyPattern());
assertEquals("[module]/[type]s/[artifact]-[revision].[ext]",
c2.getArtifactPattern());
+
+ assertEquals(true, c2.isUseOrigin());
assertEquals(c2,
settings.getResolver("A").getRepositoryCacheManager());
assertEquals(c, settings.getResolver("B").getRepositoryCacheManager());
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=612173&r1=612172&r2=612173&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
Tue Jan 15 09:45:26 2008
@@ -22,11 +22,13 @@
basedir="repository"
ivyPattern="[module]/ivys/ivy-[revision].xml"
artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
+ useOrigin="true"
lockStrategy="artifact-lock">
<cache name="mycache"
basedir="mycache"
ivyPattern="[module]/ivy-[revision].xml"
artifactPattern="[module]/[artifact]-[revision].[ext]"
+ useOrigin="false"
lockStrategy="no-lock"
defaultTTL="1s">
<ttl revision="latest.integration" duration="200ms" />
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java
Tue Jan 15 09:45:26 2008
@@ -24,7 +24,7 @@
public class AbstractDependencyResolverTest extends TestCase {
protected DownloadOptions downloadOptions() {
- return new DownloadOptions(false);
+ return new DownloadOptions();
}
}
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
Tue Jan 15 09:45:26 2008
@@ -534,7 +534,7 @@
new Artifact[] {new DefaultArtifact(
ModuleRevisionId.parse("org1#mod1.1;1.0"),
new Date(), "mod1.1", "jar", "jar")},
- new DownloadOptions(false));
+ new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
assertEquals(DownloadStatus.SUCCESSFUL,
report.getArtifactsReports()[0].getDownloadStatus());
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
Tue Jan 15 09:45:26 2008
@@ -123,7 +123,7 @@
// test to ask to download
DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate,
"mod1.1", "jar", "jar");
DownloadReport report = resolver.download(new Artifact[] {artifact},
- getDownloadOptions(false));
+ getDownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
@@ -135,7 +135,7 @@
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// test to ask to download again, should use cache
- report = resolver.download(new Artifact[] {artifact},
getDownloadOptions(false));
+ report = resolver.download(new Artifact[] {artifact},
getDownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
@@ -164,8 +164,8 @@
ivyRef.getResource().getName().replace('\\', '/'));
}
- private DownloadOptions getDownloadOptions(boolean useOrigin) {
- return new DownloadOptions(useOrigin);
+ private DownloadOptions getDownloadOptions() {
+ return new DownloadOptions();
}
public void testMaven2() throws Exception {
@@ -211,7 +211,7 @@
false), data);
assertNotNull(rmr);
DownloadReport dr =
resolver.download(rmr.getDescriptor().getAllArtifacts(),
- getDownloadOptions(false));
+ getDownloadOptions());
assertEquals(2,
dr.getArtifactsReports(DownloadStatus.SUCCESSFUL).length);
resolver.setChecksums("md5");
@@ -222,7 +222,7 @@
rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNotNull(rmr);
dr = resolver.download(new Artifact[] {new DefaultArtifact(mrid,
rmr.getPublicationDate(),
- mrid.getName(), "jar", "jar")}, getDownloadOptions(false));
+ mrid.getName(), "jar", "jar")}, getDownloadOptions());
assertEquals(1,
dr.getArtifactsReports(DownloadStatus.SUCCESSFUL).length);
resolver.setChecksums("md5");
@@ -230,14 +230,14 @@
rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNotNull(rmr);
dr = resolver.download(new Artifact[] {new DefaultArtifact(mrid,
rmr.getPublicationDate(),
- mrid.getName(), "jar", "jar")}, getDownloadOptions(false));
+ mrid.getName(), "jar", "jar")}, getDownloadOptions());
assertEquals(1, dr.getArtifactsReports(DownloadStatus.FAILED).length);
resolver.setChecksums("");
rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
false), data);
assertNotNull(rmr);
dr = resolver.download(new Artifact[] {new DefaultArtifact(mrid,
rmr.getPublicationDate(),
- mrid.getName(), "jar", "jar")}, getDownloadOptions(false));
+ mrid.getName(), "jar", "jar")}, getDownloadOptions());
assertEquals(1,
dr.getArtifactsReports(DownloadStatus.SUCCESSFUL).length);
}
@@ -321,7 +321,7 @@
Artifact[] artifacts = rmr.getDescriptor().getArtifacts("default");
File archiveFileInCache =
cacheManager.getArchiveFileInCache(artifacts[0]);
- resolver.download(artifacts, getDownloadOptions(false));
+ resolver.download(artifacts, getDownloadOptions());
assertTrue(archiveFileInCache.exists());
BufferedReader r = new BufferedReader(new
FileReader(archiveFileInCache));
assertEquals("before", r.readLine());
@@ -352,7 +352,7 @@
// should download the new artifact
artifacts = rmr.getDescriptor().getArtifacts("default");
- resolver.download(artifacts, getDownloadOptions(false));
+ resolver.download(artifacts, getDownloadOptions());
assertTrue(archiveFileInCache.exists());
r = new BufferedReader(new FileReader(archiveFileInCache));
assertEquals("after", r.readLine());
@@ -390,7 +390,7 @@
assertEquals(pubdate, rmr.getPublicationDate());
Artifact[] artifacts = rmr.getDescriptor().getArtifacts("default");
- resolver.download(artifacts, getDownloadOptions(false));
+ resolver.download(artifacts, getDownloadOptions());
File archiveFileInCache =
cacheManager.getArchiveFileInCache(artifacts[0]);
assertTrue(archiveFileInCache.exists());
BufferedReader r = new BufferedReader(new
FileReader(archiveFileInCache));
@@ -431,7 +431,7 @@
assertFalse(archiveFileInCache.exists());
artifacts = rmr.getDescriptor().getArtifacts("default");
- resolver.download(artifacts, getDownloadOptions(false));
+ resolver.download(artifacts, getDownloadOptions());
assertTrue(archiveFileInCache.exists());
r = new BufferedReader(new FileReader(archiveFileInCache));
assertEquals("after", r.readLine());
@@ -827,6 +827,7 @@
FileSystemResolver resolver = new FileSystemResolver();
resolver.setName("test");
resolver.setSettings(settings);
+ ((DefaultRepositoryCacheManager)
resolver.getRepositoryCacheManager()).setUseOrigin(true);
assertEquals("test", resolver.getName());
resolver.addIvyPattern(IVY_PATTERN);
@@ -847,7 +848,7 @@
// test to ask to download
DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate,
"mod1.1", "jar", "jar");
DownloadReport report = resolver.download(new Artifact[] {artifact},
- getDownloadOptions(true));
+ getDownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java?rev=612173&r1=612172&r2=612173&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
Tue Jan 15 09:45:26 2008
@@ -21,6 +21,7 @@
import java.util.Date;
import java.util.GregorianCalendar;
+import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
@@ -312,6 +313,7 @@
resolver.addArtifactPattern("file:" + rootpath
+
"/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setName("test");
+ ((DefaultRepositoryCacheManager)
resolver.getRepositoryCacheManager()).setUseOrigin(true);
assertEquals("test", resolver.getName());
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1",
"1.0");
@@ -326,7 +328,7 @@
// test to ask to download
DefaultArtifact artifact = new DefaultArtifact(mrid, pubdate,
"mod1.1", "jar", "jar");
DownloadReport report = resolver.download(new Artifact[] {artifact},
- new DownloadOptions(true));
+ new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);