You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/02/03 18:25:29 UTC
svn commit: r618033 - in /ant/ivy/core/trunk: ./ doc/use/
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/install/
src/java/org/apache/ivy/core/report/ src/java/org/apache/ivy/core/resolv...
Author: xavier
Date: Sun Feb 3 09:25:22 2008
New Revision: 618033
URL: http://svn.apache.org/viewvc?rev=618033&view=rev
Log:
NEW: Make resolve console output configurable per resolve (IVY-715)
Added:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java (with props)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/doc/use/postresolvetask.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/Ivy.java
ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.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/IvyNode.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/retrieve/RetrieveEngine.java
ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ReportOutputter.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.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
Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sun Feb 3 09:25:22 2008
@@ -65,6 +65,7 @@
- NEW: Add support for importing environment variables (IVY-608)
- 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)
+- NEW: Make resolve console output configurable per resolve (IVY-715)
- IMPROVEMENT: Review settings loading in Ant (IVY-703)
- IMPROVEMENT: Move useOrigin to repository cache manager (IVY-700)
Modified: ant/ivy/core/trunk/doc/use/postresolvetask.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/postresolvetask.html?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/postresolvetask.html (original)
+++ ant/ivy/core/trunk/doc/use/postresolvetask.html Sun Feb 3 09:25:22 2008
@@ -69,6 +69,12 @@
<tr><td>file</td><td>the file to resolve if a resolve is necessary <span class="since">since 2.0</span></td><td>No. Defaults to the previous resolved Ivy file or to ${ivy.dep.file}</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>
<tr><td>resolveId</td><td>The id which was used for a previous resolve, or the resolveId if a new resolve is performed <span class="since">(since 2.0)</span></td><td>No, defaults to '[org]-[module]'.</td></tr>
+ <tr><td>log</td><td>the log setting to use during the resolve process. <span class="since">(since 2.0)</span><br/>
+Available options are:
+<ul><li>default</li> the default log settings, where all usual messages are output to the console
+<li>download-only</li> disable all usual messages but download ones. A resolve with everything in cache won't output any message.
+<li>quiet</li> disable all usual messages, making the whole resolve process quiet unless errors occur
+</ul></td><td>No, defaults to 'default'.</td></tr>
</tbody>
</table>
<h1>Examples</h1>
Modified: ant/ivy/core/trunk/doc/use/resolve.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/resolve.html?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/resolve.html (original)
+++ ant/ivy/core/trunk/doc/use/resolve.html Sun Feb 3 09:25:22 2008
@@ -126,6 +126,13 @@
<tr><td>resolveId</td><td>An id which can be used later to refer to the results of this resolve <span class="since">(since 2.0)</span></td><td>No, defaults to '[org]-[module]'.</td></tr>
+ <tr><td>log</td><td>the log setting to use during the resolve process. <span class="since">(since 2.0)</span><br/>
+Available options are:
+<ul><li>default</li> the default log settings, where all usual messages are output to the console
+<li>download-only</li> disable all usual messages but download ones. A resolve with everything in cache won't output any message.
+<li>quiet</li> disable all usual messages, making the whole resolve process quiet unless errors occur
+</ul></td><td>No, defaults to 'default'.</td></tr>
+
</tbody>
</table>
<h1>Examples</h1>
Modified: ant/ivy/core/trunk/doc/use/retrieve.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/retrieve.html?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/retrieve.html (original)
+++ ant/ivy/core/trunk/doc/use/retrieve.html Sun Feb 3 09:25:22 2008
@@ -38,12 +38,6 @@
pattern: lib/[conf]/[artifact].[ext]
root: lib
-<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>
@@ -62,6 +56,11 @@
<td>No. All artifact types are accepted by default.</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>
+ <tr><td>log</td><td>the log setting to use during the resolve and retrieve process. <span class="since">(since 2.0)</span><br/>
+Available options are the same as for [[ant:resolve]] when used to trigger resolve automatically (see [[ant:postresolvetask]]), or the following for the retrieve process only:
+<ul><li>default</li> the default log settings, where all usual messages are output to the console
+<li>quiet</li> disable all usual messages, making the whole retrieve process quiet unless errors occur
+</ul></td><td>No, defaults to 'default'.</td></tr>
</table>
<h1>Examples</h1>
<code type="xml">
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java Sun Feb 3 09:25:22 2008
@@ -30,6 +30,7 @@
import java.util.Properties;
import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.cache.DefaultResolutionCacheManager;
import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.cache.ResolutionCacheManager;
@@ -45,6 +46,7 @@
import org.apache.ivy.core.publish.PublishOptions;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.repository.RepositoryManagementEngine;
+import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
@@ -304,12 +306,21 @@
eventManager.addTransferListener(new TransferListener() {
public void transferProgress(TransferEvent evt) {
+ ResolveData resolve;
switch (evt.getEventType()) {
case TransferEvent.TRANSFER_PROGRESS:
- Message.progress();
+ resolve = IvyContext.getContext().getResolveData();
+ if (resolve == null || !LogOptions.LOG_QUIET.equals(
+ resolve.getOptions().getLog())) {
+ Message.progress();
+ }
break;
case TransferEvent.TRANSFER_COMPLETED:
- Message.endProgress(" (" + (evt.getTotalLength() / KILO) + "kB)");
+ resolve = IvyContext.getContext().getResolveData();
+ if (resolve == null || !LogOptions.LOG_QUIET.equals(
+ resolve.getOptions().getLog())) {
+ Message.endProgress(" (" + (evt.getTotalLength() / KILO) + "kB)");
+ }
break;
default:
break;
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -37,6 +37,7 @@
import org.apache.ivy.core.publish.PublishOptions;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.DownloadOptions;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
@@ -138,7 +139,9 @@
}
public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
- return ivy.getResolveEngine().download(artifact, useOrigin);
+ Message.deprecated(
+ "using cache and useOrigin when calling download is not supported anymore");
+ return ivy.getResolveEngine().download(artifact, new DownloadOptions());
}
public ResolvedModuleRevision findModule(ModuleRevisionId id) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java Sun Feb 3 09:25:22 2008
@@ -26,6 +26,7 @@
import org.apache.ivy.core.module.id.ModuleId;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.StringUtils;
@@ -62,6 +63,8 @@
private boolean useOrigin = false;
private Boolean keep = null;
+
+ private String log = ResolveOptions.LOG_DEFAULT;
public boolean isUseOrigin() {
return useOrigin;
@@ -70,6 +73,14 @@
public void setUseOrigin(boolean useOrigin) {
this.useOrigin = useOrigin;
}
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
protected void prepareAndCheck() {
Ivy ivy = getIvyInstance();
@@ -257,6 +268,7 @@
resolve.setUseOrigin(useOrigin);
resolve.setValidate(isValidate());
resolve.setKeep(isKeep());
+ resolve.setLog(getLog());
return resolve;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java Sun Feb 3 09:25:22 2008
@@ -106,7 +106,7 @@
.setValidate(doValidate(settings)));
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
- new XmlReportOutputter().output(report, cacheMgr);
+ new XmlReportOutputter().output(report, cacheMgr, new ResolveOptions());
if (graph) {
gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
.getModuleRevisionId().getName());
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -20,8 +20,11 @@
import java.io.File;
import java.net.MalformedURLException;
import java.text.ParseException;
+import java.util.Arrays;
+import java.util.Collection;
import org.apache.ivy.Ivy;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ResolveReport;
@@ -70,6 +73,8 @@
private boolean useOrigin = false;
private String resolveId = null;
+
+ private String log = ResolveOptions.LOG_DEFAULT;
public boolean isUseOrigin() {
return useOrigin;
@@ -150,6 +155,14 @@
public void setRefresh(boolean refresh) {
this.refresh = refresh;
}
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
/**
* @deprecated Use {@link #setFailureProperty(String)} instead
@@ -187,6 +200,10 @@
if (file != null) {
throw new BuildException("'file' not allowed when using inline mode");
}
+ if (!getAllowedLogOptions().contains(log)) {
+ throw new BuildException("invalid option for 'log': " + log
+ + ". Available options are " + getAllowedLogOptions());
+ }
for (int i = 0; i < confs.length; i++) {
if ("*".equals(confs[i])) {
confs[i] = "*(public)";
@@ -299,11 +316,17 @@
}
}
+ protected Collection/*<String>*/ getAllowedLogOptions() {
+ return Arrays.asList(new String [] {
+ LogOptions.LOG_DEFAULT, LogOptions.LOG_DOWNLOAD_ONLY, LogOptions.LOG_QUIET});
+ }
+
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs, IvySettings settings) {
if (useOrigin) {
settings.useDeprecatedUseOrigin();
}
- return new ResolveOptions()
+ return ((ResolveOptions) new ResolveOptions()
+ .setLog(log))
.setConfs(confs)
.setValidate(doValidate(settings))
.setArtifactFilter(FilterHelper.getArtifactTypeFilter(type))
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java Sun Feb 3 09:25:22 2008
@@ -17,6 +17,10 @@
*/
package org.apache.ivy.ant;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.retrieve.RetrieveOptions;
import org.apache.ivy.util.filter.Filter;
import org.apache.tools.ant.BuildException;
@@ -44,13 +48,19 @@
public void doExecute() throws BuildException {
prepareAndCheck();
+ if (!getAllowedLogOptions().contains(getLog())) {
+ throw new BuildException("invalid option for 'log': " + getLog()
+ + ". Available options are " + getAllowedLogOptions());
+ }
+
pattern = getProperty(pattern, getSettings(), "ivy.retrieve.pattern");
try {
Filter artifactFilter = getArtifactFilter();
int targetsCopied = getIvyInstance().retrieve(
getResolvedMrid(),
pattern,
- new RetrieveOptions()
+ ((RetrieveOptions) new RetrieveOptions()
+ .setLog(getLog()))
.setConfs(splitConfs(getConf()))
.setDestIvyPattern(ivypattern)
.setArtifactFilter(artifactFilter)
@@ -64,6 +74,11 @@
} catch (Exception ex) {
throw new BuildException("impossible to ivy retrieve: " + ex, ex);
}
+ }
+
+ protected Collection/*<String>*/ getAllowedLogOptions() {
+ return Arrays.asList(new String [] {
+ LogOptions.LOG_DEFAULT, LogOptions.LOG_DOWNLOAD_ONLY, LogOptions.LOG_QUIET});
}
public String getIvypattern() {
Added: ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java?rev=618033&view=auto
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java (added)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java Sun Feb 3 09:25:22 2008
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.ivy.core;
+
+
+
+public class LogOptions {
+ /**
+ * Defaults log settings. Output all usual messages during the resolve process.
+ */
+ public static final String LOG_DEFAULT = "default";
+ /**
+ * This log setting disable all usual messages but download ones.
+ */
+ public static final String LOG_DOWNLOAD_ONLY = "download-only";
+ /**
+ * This log setting disable all usual messages during the resolve process.
+ */
+ public static final String LOG_QUIET = "quiet";
+
+ /**
+ * The log settings to use.
+ * One of {@link #LOG_DEFAULT}, {@link #LOG_DOWNLOAD_ONLY}, {@link #LOG_QUIET}
+ */
+ private String log = LOG_DEFAULT;
+
+ public LogOptions() {
+ }
+
+ public LogOptions(LogOptions options) {
+ log = options.log;
+ }
+
+ public String getLog() {
+ return log;
+ }
+
+ public LogOptions setLog(String log) {
+ this.log = log;
+ return this;
+ }
+}
Propchange: ant/ivy/core/trunk/src/java/org/apache/ivy/core/LogOptions.java
------------------------------------------------------------------------------
svn:eol-style = native
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -33,6 +33,7 @@
import org.apache.ivy.core.publish.PublishEngine;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.DownloadOptions;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
@@ -124,12 +125,13 @@
ResolveReport report = new ResolveReport(md, resolveId);
Message.info(":: resolving dependencies ::");
- IvyNode[] dependencies = resolveEngine.getDependencies(md, new ResolveOptions()
- .setResolveId(resolveId).setConfs(new String[] {"default"}), report);
+ ResolveOptions options = new ResolveOptions()
+ .setResolveId(resolveId).setConfs(new String[] {"default"});
+ IvyNode[] dependencies = resolveEngine.getDependencies(md, options, report);
report.setDependencies(Arrays.asList(dependencies), artifactFilter);
Message.info(":: downloading artifacts to cache ::");
- resolveEngine.downloadArtifacts(report, artifactFilter);
+ resolveEngine.downloadArtifacts(report, artifactFilter, new DownloadOptions());
// now that everything is in cache, we can publish all these modules
Message.info(":: installing in " + to + " ::");
@@ -171,7 +173,7 @@
Message.info(":: install resolution report ::");
// output report
- resolveEngine.outputReport(report, settings.getResolutionCacheManager());
+ resolveEngine.outputReport(report, settings.getResolutionCacheManager(), options);
return report;
} finally {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java Sun Feb 3 09:25:22 2008
@@ -92,10 +92,11 @@
return hasError;
}
- public void output(ReportOutputter[] outputters, ResolutionCacheManager cacheMgr)
+ public void output(
+ ReportOutputter[] outputters, ResolutionCacheManager cacheMgr, ResolveOptions options)
throws IOException {
for (int i = 0; i < outputters.length; i++) {
- outputters[i].output(this, cacheMgr);
+ outputters[i].output(this, cacheMgr, options);
}
}
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -17,8 +17,10 @@
*/
package org.apache.ivy.core.resolve;
+import org.apache.ivy.core.LogOptions;
-public class DownloadOptions {
+
+public class DownloadOptions extends LogOptions {
public DownloadOptions() {
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Sun Feb 3 09:25:22 2008
@@ -33,6 +33,7 @@
import java.util.regex.Pattern;
import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.event.resolve.EndResolveDependencyEvent;
import org.apache.ivy.core.event.resolve.StartResolveDependencyEvent;
import org.apache.ivy.core.module.descriptor.Artifact;
@@ -229,7 +230,8 @@
module.getDescriptor(),
module.getResolver().getName(),
module.getArtifactResolver().getName());
- if (settings.logModuleWhenFound()) {
+ if (settings.logModuleWhenFound()
+ && LogOptions.LOG_DEFAULT.equals(getData().getOptions().getLog())) {
Message.info("\tfound " + module.getId() + " in "
+ module.getResolver().getName());
} else {
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -201,6 +201,7 @@
public ResolveReport resolve(ModuleDescriptor md, ResolveOptions options)
throws ParseException, IOException {
DependencyResolver oldDictator = getDictatorResolver();
+ IvyContext context = IvyContext.getContext();
if (options.isUseCacheOnly()) {
setDictatorResolver(new CacheResolver(settings));
}
@@ -215,13 +216,23 @@
eventManager.fireIvyEvent(new StartResolveEvent(md, confs));
long start = System.currentTimeMillis();
- Message.info(":: resolving dependencies :: " + md.getResolvedModuleRevisionId()
+ if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
+ Message.info(":: resolving dependencies :: " + md.getResolvedModuleRevisionId()
+ + (options.isTransitive() ? "" : " [not transitive]"));
+ Message.info("\tconfs: " + Arrays.asList(confs));
+ } else {
+ Message.verbose(":: resolving dependencies :: " + md.getResolvedModuleRevisionId()
+ (options.isTransitive() ? "" : " [not transitive]"));
- Message.info("\tconfs: " + Arrays.asList(confs));
+ Message.verbose("\tconfs: " + Arrays.asList(confs));
+ }
Message.verbose("\tvalidate = " + options.isValidate());
Message.verbose("\trefresh = " + options.isRefresh());
+
ResolveReport report = new ResolveReport(md, options.getResolveId());
+ ResolveData data = new ResolveData(this, options);
+ context.setResolveData(data);
+
// resolve dependencies
IvyNode[] dependencies = getDependencies(md, options, report);
report.setDependencies(Arrays.asList(dependencies), options.getArtifactFilter());
@@ -275,11 +286,12 @@
if (options.isDownload()) {
Message.verbose(":: downloading artifacts ::");
- downloadArtifacts(report, options.getArtifactFilter());
+ downloadArtifacts(report, options.getArtifactFilter(),
+ (DownloadOptions) new DownloadOptions().setLog(options.getLog()));
}
if (options.isOutputReport()) {
- outputReport(report, cacheManager);
+ outputReport(report, cacheManager, options);
}
Message.verbose("\tresolve done (" + report.getResolveTime() + "ms resolve - "
@@ -293,20 +305,28 @@
Message.sumupProblems();
throw ex;
} finally {
+ context.setResolveData(null);
setDictatorResolver(oldDictator);
}
}
- public void outputReport(ResolveReport report, ResolutionCacheManager cacheMgr)
+ public void outputReport(
+ ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options)
throws IOException {
- Message.info(":: resolution report :: resolve " + report.getResolveTime() + "ms"
- + " :: artifacts dl " + report.getDownloadTime() + "ms");
+ if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
+ Message.info(":: resolution report :: resolve " + report.getResolveTime() + "ms"
+ + " :: artifacts dl " + report.getDownloadTime() + "ms");
+ } else {
+ Message.verbose(":: resolution report :: resolve " + report.getResolveTime() + "ms"
+ + " :: artifacts dl " + report.getDownloadTime() + "ms");
+ }
report.setProblemMessages(Message.getProblems());
// output report
- report.output(settings.getReportOutputters(), cacheMgr);
+ report.output(settings.getReportOutputters(), cacheMgr, options);
}
- public void downloadArtifacts(ResolveReport report, Filter artifactFilter) {
+ public void downloadArtifacts(
+ ResolveReport report, Filter artifactFilter, DownloadOptions options) {
long start = System.currentTimeMillis();
IvyNode[] dependencies = (IvyNode[]) report.getDependencies().toArray(
new IvyNode[report.getDependencies().size()]);
@@ -322,8 +342,7 @@
DependencyResolver resolver = dependencies[i].getModuleRevision()
.getArtifactResolver();
Artifact[] selectedArtifacts = dependencies[i].getSelectedArtifacts(artifactFilter);
- DownloadReport dReport = resolver.download(selectedArtifacts,
- new DownloadOptions());
+ DownloadReport dReport = resolver.download(selectedArtifacts, options);
ArtifactDownloadReport[] adrs = dReport.getArtifactsReports();
for (int j = 0; j < adrs.length; j++) {
if (adrs[j].getDownloadStatus() == DownloadStatus.FAILED) {
@@ -368,10 +387,9 @@
* the artifact to download
* @return a report concerning the download
*/
- public ArtifactDownloadReport download(Artifact artifact, boolean useOrigin) {
+ public ArtifactDownloadReport download(Artifact artifact, DownloadOptions options) {
DependencyResolver resolver = settings.getResolver(artifact.getModuleRevisionId());
- DownloadReport r = resolver.download(new Artifact[] {artifact},
- new DownloadOptions());
+ DownloadReport r = resolver.download(new Artifact[] {artifact}, options);
return r.getArtifactReport(artifact);
}
@@ -419,139 +437,144 @@
if (md == null) {
throw new NullPointerException("module descriptor must not be null");
}
- IvyContext context = IvyContext.getContext();
+ IvyContext context = IvyContext.pushNewCopyContext();
- String[] confs = options.getConfs(md);
- options.setConfs(confs);
-
- Date reportDate = new Date();
- ResolveData data = new ResolveData(this, options);
- context.setResolveData(data);
- IvyNode rootNode = new IvyNode(data, md);
-
- for (int i = 0; i < confs.length; i++) {
- if (confs[i] == null) {
- throw new NullPointerException("null conf not allowed: confs where: "
- + Arrays.asList(confs));
+ try {
+ String[] confs = options.getConfs(md);
+ options.setConfs(confs);
+
+ Date reportDate = new Date();
+ ResolveData data = context.getResolveData();
+ if (data == null) {
+ data = new ResolveData(this, options);
+ context.setResolveData(data);
}
-
- Message.verbose("resolving dependencies for configuration '" + confs[i] + "'");
- // for each configuration we clear the cache of what's been fetched
- fetchedSet.clear();
-
- Configuration configuration = md.getConfiguration(confs[i]);
- if (configuration == null) {
- Message.error("asked configuration not found in " + md.getModuleRevisionId() + ": "
- + confs[i]);
- } else {
- ConfigurationResolveReport confReport = null;
- if (report != null) {
- confReport = report.getConfigurationReport(confs[i]);
- if (confReport == null) {
- confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate,
- options);
- report.addReport(confs[i], confReport);
- }
+ IvyNode rootNode = new IvyNode(data, md);
+
+ for (int i = 0; i < confs.length; i++) {
+ if (confs[i] == null) {
+ throw new NullPointerException("null conf not allowed: confs where: "
+ + Arrays.asList(confs));
}
- // we reuse the same resolve data with a new report for each conf
- data.setReport(confReport);
-
- // update the root module conf we are about to fetch
- VisitNode root = new VisitNode(data, rootNode, null, confs[i], null);
- root.setRequestedConf(confs[i]);
- rootNode.updateConfsToFetch(Collections.singleton(confs[i]));
-
- // go fetch !
- boolean fetched = false;
- while (!fetched) {
- try {
- fetchDependencies(root, confs[i], false);
- fetched = true;
- } catch (RestartResolveProcess restart) {
- Message.verbose("=======================================================");
- Message.verbose("= RESTARTING RESOLVE PROCESS");
- Message.verbose("= " + restart.getMessage());
- Message.verbose("=======================================================");
- fetchedSet.clear();
+
+ Message.verbose("resolving dependencies for configuration '" + confs[i] + "'");
+ // for each configuration we clear the cache of what's been fetched
+ fetchedSet.clear();
+
+ Configuration configuration = md.getConfiguration(confs[i]);
+ if (configuration == null) {
+ Message.error("asked configuration not found in "
+ + md.getModuleRevisionId() + ": " + confs[i]);
+ } else {
+ ConfigurationResolveReport confReport = null;
+ if (report != null) {
+ confReport = report.getConfigurationReport(confs[i]);
+ if (confReport == null) {
+ confReport = new ConfigurationResolveReport(
+ this, md, confs[i], reportDate, options);
+ report.addReport(confs[i], confReport);
+ }
+ }
+ // we reuse the same resolve data with a new report for each conf
+ data.setReport(confReport);
+
+ // update the root module conf we are about to fetch
+ VisitNode root = new VisitNode(data, rootNode, null, confs[i], null);
+ root.setRequestedConf(confs[i]);
+ rootNode.updateConfsToFetch(Collections.singleton(confs[i]));
+
+ // go fetch !
+ boolean fetched = false;
+ while (!fetched) {
+ try {
+ fetchDependencies(root, confs[i], false);
+ fetched = true;
+ } catch (RestartResolveProcess restart) {
+ Message.verbose("====================================================");
+ Message.verbose("= RESTARTING RESOLVE PROCESS");
+ Message.verbose("= " + restart.getMessage());
+ Message.verbose("====================================================");
+ fetchedSet.clear();
+ }
+ }
+
+ // clean data
+ for (Iterator iter = data.getNodes().iterator(); iter.hasNext();) {
+ IvyNode dep = (IvyNode) iter.next();
+ dep.clean();
}
- }
-
- // clean data
- for (Iterator iter = data.getNodes().iterator(); iter.hasNext();) {
- IvyNode dep = (IvyNode) iter.next();
- dep.clean();
}
}
- }
-
- // prune and reverse sort fectched dependencies
- Collection nodes = data.getNodes();
- // use a Set to avoid duplicates, linked to preserve order
- Collection dependencies = new LinkedHashSet(nodes.size());
- for (Iterator iter = nodes.iterator(); iter.hasNext();) {
- IvyNode node = (IvyNode) iter.next();
- if (node != null && !node.isRoot() && !node.isCompletelyBlacklisted()) {
- dependencies.add(node);
+
+ // prune and reverse sort fectched dependencies
+ Collection nodes = data.getNodes();
+ // use a Set to avoid duplicates, linked to preserve order
+ Collection dependencies = new LinkedHashSet(nodes.size());
+ for (Iterator iter = nodes.iterator(); iter.hasNext();) {
+ IvyNode node = (IvyNode) iter.next();
+ if (node != null && !node.isRoot() && !node.isCompletelyBlacklisted()) {
+ dependencies.add(node);
+ }
}
- }
- List sortedDependencies = sortEngine.sortNodes(dependencies);
- Collections.reverse(sortedDependencies);
-
- // handle transitive eviction now:
- // if a module has been evicted then all its dependencies required
- // only by it should be evicted too. Since nodes are now sorted from the more dependent to
- // the less one, we can traverse the list and check only the direct parent and not all
- // the ancestors
- for (ListIterator iter = sortedDependencies.listIterator(); iter.hasNext();) {
- IvyNode node = (IvyNode) iter.next();
- if (!node.isCompletelyEvicted()) {
- for (int i = 0; i < confs.length; i++) {
- IvyNodeCallers.Caller[] callers = node.getCallers(confs[i]);
- if (settings.debugConflictResolution()) {
- Message.debug("checking if " + node.getId()
- + " is transitively evicted in " + confs[i]);
- }
- boolean allEvicted = callers.length > 0;
- for (int j = 0; j < callers.length; j++) {
- if (callers[j].getModuleRevisionId().equals(md.getModuleRevisionId())) {
- // the caller is the root module itself, it can't be evicted
- allEvicted = false;
- break;
- } else {
- IvyNode callerNode = data.getNode(callers[j].getModuleRevisionId());
- if (callerNode == null) {
- Message.warn("ivy internal error: no node found for "
- + callers[j].getModuleRevisionId() + ": looked in "
- + data.getNodeIds() + " and root module id was "
- + md.getModuleRevisionId());
- } else if (!callerNode.isEvicted(confs[i])) {
+ List sortedDependencies = sortEngine.sortNodes(dependencies);
+ Collections.reverse(sortedDependencies);
+
+ // handle transitive eviction now:
+ // if a module has been evicted then all its dependencies required only by it should be
+ // evicted too. Since nodes are now sorted from the more dependent to the less one, we
+ // can traverse the list and check only the direct parent and not all the ancestors
+ for (ListIterator iter = sortedDependencies.listIterator(); iter.hasNext();) {
+ IvyNode node = (IvyNode) iter.next();
+ if (!node.isCompletelyEvicted()) {
+ for (int i = 0; i < confs.length; i++) {
+ IvyNodeCallers.Caller[] callers = node.getCallers(confs[i]);
+ if (settings.debugConflictResolution()) {
+ Message.debug("checking if " + node.getId()
+ + " is transitively evicted in " + confs[i]);
+ }
+ boolean allEvicted = callers.length > 0;
+ for (int j = 0; j < callers.length; j++) {
+ if (callers[j].getModuleRevisionId().equals(md.getModuleRevisionId())) {
+ // the caller is the root module itself, it can't be evicted
allEvicted = false;
break;
} else {
- if (settings.debugConflictResolution()) {
- Message.debug("caller " + callerNode.getId() + " of "
- + node.getId() + " is evicted");
+ IvyNode callerNode = data.getNode(callers[j].getModuleRevisionId());
+ if (callerNode == null) {
+ Message.warn("ivy internal error: no node found for "
+ + callers[j].getModuleRevisionId() + ": looked in "
+ + data.getNodeIds() + " and root module id was "
+ + md.getModuleRevisionId());
+ } else if (!callerNode.isEvicted(confs[i])) {
+ allEvicted = false;
+ break;
+ } else {
+ if (settings.debugConflictResolution()) {
+ Message.debug("caller " + callerNode.getId() + " of "
+ + node.getId() + " is evicted");
+ }
}
}
}
- }
- if (allEvicted) {
- Message.verbose("all callers are evicted for " + node + ": evicting too");
- node.markEvicted(confs[i], null, null, null);
- } else {
- if (settings.debugConflictResolution()) {
- Message.debug(node.getId()
- + " isn't transitively evicted, at least one caller was"
- + " not evicted");
+ if (allEvicted) {
+ Message.verbose("all callers are evicted for "
+ + node + ": evicting too");
+ node.markEvicted(confs[i], null, null, null);
+ } else {
+ if (settings.debugConflictResolution()) {
+ Message.debug(node.getId()
+ + " isn't transitively evicted, at least one caller was"
+ + " not evicted");
+ }
}
}
}
}
+
+ return (IvyNode[]) dependencies.toArray(new IvyNode[dependencies.size()]);
+ } finally {
+ IvyContext.popContext();
}
-
- context.setResolveData(null);
-
- return (IvyNode[]) dependencies.toArray(new IvyNode[dependencies.size()]);
}
private void fetchDependencies(VisitNode node, String conf, boolean shouldBePublic) {
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -19,6 +19,7 @@
import java.util.Date;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleId;
import org.apache.ivy.util.ConfigurationUtils;
@@ -30,7 +31,8 @@
*
* @see ResolveEngine
*/
-public class ResolveOptions {
+public class ResolveOptions extends LogOptions {
+
/**
* an array of configuration names to resolve - must not be null nor empty
*/
@@ -95,6 +97,7 @@
}
public ResolveOptions(ResolveOptions options) {
+ super(options);
confs = options.confs;
revision = options.revision;
date = options.date;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Sun Feb 3 09:25:22 2008
@@ -35,6 +35,7 @@
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.event.retrieve.EndRetrieveEvent;
@@ -74,7 +75,11 @@
public int retrieve(ModuleRevisionId mrid, String destFilePattern, RetrieveOptions options)
throws IOException {
ModuleId moduleId = mrid.getModuleId();
- Message.info(":: retrieving :: " + moduleId + (options.isSync() ? " [sync]" : ""));
+ if (LogOptions.LOG_DEFAULT.equals(options.getLog())) {
+ Message.info(":: retrieving :: " + moduleId + (options.isSync() ? " [sync]" : ""));
+ } else {
+ Message.verbose(":: retrieving :: " + moduleId + (options.isSync() ? " [sync]" : ""));
+ }
Message.verbose("\tcheckUpToDate=" + settings.isCheckUpToDate());
long start = System.currentTimeMillis();
@@ -84,7 +89,11 @@
settings.getVariables());
String[] confs = getConfs(mrid, options);
- Message.info("\tconfs: " + Arrays.asList(confs));
+ if (LogOptions.LOG_DEFAULT.equals(options.getLog())) {
+ Message.info("\tconfs: " + Arrays.asList(confs));
+ } else {
+ Message.verbose("\tconfs: " + Arrays.asList(confs));
+ }
if (this.eventManager != null) {
this.eventManager.fireIvyEvent(new StartRetrieveEvent(mrid, confs, options));
}
@@ -159,12 +168,17 @@
}
}
long elapsedTime = System.currentTimeMillis() - start;
- Message.info("\t"
- + targetsCopied
- + " artifacts copied"
- + (settings.isCheckUpToDate() ? (", " + targetsUpToDate + " already retrieved")
- : "")
- + " (" + (totalCopiedSize / KILO) + "kB/" + elapsedTime + "ms)");
+ String msg = "\t"
+ + targetsCopied
+ + " artifacts copied"
+ + (settings.isCheckUpToDate() ? (", " + targetsUpToDate + " already retrieved")
+ : "")
+ + " (" + (totalCopiedSize / KILO) + "kB/" + elapsedTime + "ms)";
+ if (LogOptions.LOG_DEFAULT.equals(options.getLog())) {
+ Message.info(msg);
+ } else {
+ Message.verbose(msg);
+ }
Message.verbose("\tretrieve done (" + (elapsedTime) + "ms)");
if (this.eventManager != null) {
this.eventManager.fireIvyEvent(new EndRetrieveEvent(
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java Sun Feb 3 09:25:22 2008
@@ -17,6 +17,7 @@
*/
package org.apache.ivy.core.retrieve;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.util.filter.Filter;
import org.apache.ivy.util.filter.FilterHelper;
@@ -25,7 +26,7 @@
*
* @see RetrieveEngine
*/
-public class RetrieveOptions {
+public class RetrieveOptions extends LogOptions {
/**
* The names of configurations to retrieve. If the array consists only of '*', then all
* configurations of the module will be retrieved.
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java Sun Feb 3 09:25:22 2008
@@ -30,6 +30,7 @@
import org.apache.ivy.core.report.ConfigurationResolveReport;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.util.Message;
@@ -43,9 +44,11 @@
return CONSOLE;
}
- public void output(ResolveReport report, ResolutionCacheManager cacheMgr) throws IOException {
+ public void output(
+ ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options)
+ throws IOException {
IvySettings settings = IvyContext.getContext().getSettings();
- if (settings.logModulesInUse()) {
+ if (settings.logModulesInUse() && ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info("\t:: modules in use:");
List dependencies = new ArrayList(report.getDependencies());
Collections.sort(dependencies);
@@ -74,7 +77,7 @@
IvyNode[] evicted = report.getEvictedNodes();
- if (evicted.length > 0) {
+ if (evicted.length > 0 && ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info("\t:: evicted modules:");
for (int i = 0; i < evicted.length; i++) {
Collection allEvictingNodes = evicted[i].getAllEvictingNodesDetails();
@@ -100,37 +103,39 @@
}
}
- //CheckStyle:MagicNumber| OFF
- char[] sep = new char[69];
- Arrays.fill(sep, '-');
- Message.rawinfo("\t" + new String(sep));
- StringBuffer line = new StringBuffer("\t");
- append(line, "", 18);
- append(line, "modules", 31);
- line.append("|");
- append(line, "artifacts", 15);
- line.append("|");
- Message.rawinfo(line.toString());
-
- line = new StringBuffer("\t");
- append(line, "conf", 18);
- append(line, "number", 7);
- append(line, "search", 7);
- append(line, "dwnlded", 7);
- append(line, "evicted", 7);
- line.append("|");
- append(line, "number", 7);
- append(line, "dwnlded", 7);
- //CheckStyle:MagicNumber| ON
- line.append("|");
- Message.rawinfo(line.toString());
- Message.rawinfo("\t" + new String(sep));
-
- String[] confs = report.getConfigurations();
- for (int i = 0; i < confs.length; i++) {
- output(report.getConfigurationReport(confs[i]));
+ if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
+ //CheckStyle:MagicNumber| OFF
+ char[] sep = new char[69];
+ Arrays.fill(sep, '-');
+ Message.rawinfo("\t" + new String(sep));
+ StringBuffer line = new StringBuffer("\t");
+ append(line, "", 18);
+ append(line, "modules", 31);
+ line.append("|");
+ append(line, "artifacts", 15);
+ line.append("|");
+ Message.rawinfo(line.toString());
+
+ line = new StringBuffer("\t");
+ append(line, "conf", 18);
+ append(line, "number", 7);
+ append(line, "search", 7);
+ append(line, "dwnlded", 7);
+ append(line, "evicted", 7);
+ line.append("|");
+ append(line, "number", 7);
+ append(line, "dwnlded", 7);
+ //CheckStyle:MagicNumber| ON
+ line.append("|");
+ Message.rawinfo(line.toString());
+ Message.rawinfo("\t" + new String(sep));
+
+ String[] confs = report.getConfigurations();
+ for (int i = 0; i < confs.length; i++) {
+ output(report.getConfigurationReport(confs[i]));
+ }
+ Message.rawinfo("\t" + new String(sep));
}
- Message.rawinfo("\t" + new String(sep));
IvyNode[] unresolved = report.getUnresolvedDependencies();
if (unresolved.length > 0) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ReportOutputter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ReportOutputter.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ReportOutputter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ReportOutputter.java Sun Feb 3 09:25:22 2008
@@ -21,6 +21,7 @@
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
/**
*
@@ -30,7 +31,8 @@
public static final String XML = "xml";
- public abstract void output(ResolveReport report, ResolutionCacheManager cacheMgr)
+ public abstract void output(
+ ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options)
throws IOException;
public abstract String getName();
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java?rev=618033&r1=618032&r2=618033&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java Sun Feb 3 09:25:22 2008
@@ -25,6 +25,7 @@
import org.apache.ivy.core.cache.ResolutionCacheManager;
import org.apache.ivy.core.report.ConfigurationResolveReport;
import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.util.FileUtil;
import org.apache.ivy.util.Message;
@@ -39,7 +40,9 @@
return XML;
}
- public void output(ResolveReport report, ResolutionCacheManager cacheMgr) throws IOException {
+ public void output(
+ ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options)
+ throws IOException {
String[] confs = report.getConfigurations();
for (int i = 0; i < confs.length; i++) {
output(report.getConfigurationReport(confs[i]), report.getResolveId(), confs, cacheMgr);
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -22,6 +22,7 @@
import java.util.Map;
import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.cache.ArtifactOrigin;
import org.apache.ivy.core.cache.CacheDownloadOptions;
import org.apache.ivy.core.cache.CacheMetadataOptions;
@@ -41,6 +42,7 @@
import org.apache.ivy.core.resolve.DownloadOptions;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.core.search.ModuleEntry;
import org.apache.ivy.core.search.OrganisationEntry;
@@ -350,11 +352,15 @@
.setValidate(doValidate(data))
.setNamespace(getNamespace())
.setForce(data.getOptions().isRefresh())
- .setListener(downloadListener);
+ .setListener(getDownloadListener(getDownloadOptions(data.getOptions())));
}
- protected CacheDownloadOptions getCacheDownloadOptions() {
- return new CacheDownloadOptions().setListener(downloadListener);
+ protected CacheDownloadOptions getCacheDownloadOptions(DownloadOptions options) {
+ return new CacheDownloadOptions().setListener(getDownloadListener(options));
+ }
+
+ protected DownloadOptions getDownloadOptions(ResolveOptions options) {
+ return (DownloadOptions) new DownloadOptions().setLog(options.getLog());
}
public void abortPublishTransaction() throws IOException {
@@ -370,35 +376,38 @@
/* Default implementation is a no-op */
}
- private final DownloadListener downloadListener = new DownloadListener() {
- public void needArtifact(RepositoryCacheManager cache, Artifact artifact) {
- if (eventManager != null) {
- eventManager.fireIvyEvent(new NeedArtifactEvent(AbstractResolver.this, artifact));
+ private DownloadListener getDownloadListener(final DownloadOptions options) {
+ return new DownloadListener() {
+ public void needArtifact(RepositoryCacheManager cache, Artifact artifact) {
+ if (eventManager != null) {
+ eventManager.fireIvyEvent(
+ new NeedArtifactEvent(AbstractResolver.this, artifact));
+ }
}
- }
- public void startArtifactDownload(
- RepositoryCacheManager cache, ResolvedResource rres,
- Artifact artifact, ArtifactOrigin origin) {
- if (artifact.isMetadata()) {
- Message.verbose("downloading " + rres.getResource() + " ...");
- } else {
- Message.info("downloading " + rres.getResource() + " ...");
+ public void startArtifactDownload(
+ RepositoryCacheManager cache, ResolvedResource rres,
+ Artifact artifact, ArtifactOrigin origin) {
+ if (artifact.isMetadata() || LogOptions.LOG_QUIET.equals(options.getLog())) {
+ Message.verbose("downloading " + rres.getResource() + " ...");
+ } else {
+ Message.info("downloading " + rres.getResource() + " ...");
+ }
+ if (eventManager != null) {
+ eventManager.fireIvyEvent(
+ new StartArtifactDownloadEvent(
+ AbstractResolver.this, artifact, origin));
+ }
}
- if (eventManager != null) {
- eventManager.fireIvyEvent(
- new StartArtifactDownloadEvent(
- AbstractResolver.this, artifact, origin));
- }
- }
- public void endArtifactDownload(
- RepositoryCacheManager cache, Artifact artifact,
- ArtifactDownloadReport adr, File archiveFile) {
- if (eventManager != null) {
- eventManager.fireIvyEvent(
- new EndArtifactDownloadEvent(
- AbstractResolver.this, artifact, adr, archiveFile));
+ public void endArtifactDownload(
+ RepositoryCacheManager cache, Artifact artifact,
+ ArtifactDownloadReport adr, File archiveFile) {
+ if (eventManager != null) {
+ eventManager.fireIvyEvent(
+ new EndArtifactDownloadEvent(
+ AbstractResolver.this, artifact, adr, archiveFile));
+ }
}
- }
- };
+ };
+ }
}
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=618033&r1=618032&r2=618033&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 Sun Feb 3 09:25:22 2008
@@ -35,6 +35,7 @@
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.LogOptions;
import org.apache.ivy.core.cache.ArtifactOrigin;
import org.apache.ivy.core.cache.CacheDownloadOptions;
import org.apache.ivy.core.cache.CacheMetadataOptions;
@@ -576,12 +577,14 @@
for (int i = 0; i < artifacts.length; i++) {
ArtifactDownloadReport adr = cacheManager.download(
artifacts[i], artifactResourceResolver, downloader,
- getCacheDownloadOptions());
+ getCacheDownloadOptions(options));
if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
Message.warn("\t" + adr);
}
} else if (DownloadStatus.NO == adr.getDownloadStatus()) {
+ Message.verbose("\t" + adr);
+ } else if (LogOptions.LOG_QUIET.equals(options.getLog())) {
Message.verbose("\t" + adr);
} else {
Message.info("\t" + adr);