You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/14 09:27:43 UTC
svn commit: r1557968 [8/26] - in /ant/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/
src/...
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=1557968&r1=1557967&r2=1557968&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 14 08:27:37 2014
@@ -104,7 +104,7 @@ public class ResolveEngine {
* report. Must not be null.
*/
public ResolveEngine(ResolveEngineSettings settings, EventManager eventManager,
- SortEngine sortEngine) {
+ SortEngine sortEngine) {
this.settings = settings;
this.eventManager = eventManager;
this.sortEngine = sortEngine;
@@ -155,20 +155,21 @@ public class ResolveEngine {
ResolvedModuleRevision rmr = findModule(mrid, new ResolveOptions(options));
if (rmr == null) {
Message.verbose("module not found " + mrid);
-
+
// we will continue the resolve anyway to get a nice error message back
// to the user, however reduce the amount of logging in this case
optionsToUse.setLog(LogOptions.LOG_DOWNLOAD_ONLY);
- md = DefaultModuleDescriptor.newCallerInstance(mrid,
- new String[] {"default"}, options.isTransitive(), changing);
+ md = DefaultModuleDescriptor.newCallerInstance(mrid, new String[] {"default"},
+ options.isTransitive(), changing);
} else {
String[] confs = options.getConfs(rmr.getDescriptor());
- md = DefaultModuleDescriptor.newCallerInstance(ModuleRevisionId.newInstance(mrid,
- rmr.getId().getRevision()), confs, options.isTransitive(), changing);
+ md = DefaultModuleDescriptor.newCallerInstance(
+ ModuleRevisionId.newInstance(mrid, rmr.getId().getRevision()), confs,
+ options.isTransitive(), changing);
}
} else {
- md = DefaultModuleDescriptor.newCallerInstance(mrid, options.getConfs()
- , options.isTransitive(), changing);
+ md = DefaultModuleDescriptor.newCallerInstance(mrid, options.getConfs(),
+ options.isTransitive(), changing);
}
return resolve(md, optionsToUse);
@@ -219,21 +220,21 @@ public class ResolveEngine {
Message.info("\tconfs: " + Arrays.asList(confs));
} else {
Message.verbose(":: resolving dependencies :: " + md.getResolvedModuleRevisionId()
- + (options.isTransitive() ? "" : " [not transitive]"));
+ + (options.isTransitive() ? "" : " [not transitive]"));
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());
-
+
if (options.getCheckIfChanged()) {
report.checkIfChanged();
}
@@ -245,21 +246,22 @@ public class ResolveEngine {
// we store the resolved dependencies revisions and statuses per asked dependency
// revision id, for direct dependencies only.
// this is used by the deliver task to resolve dynamic revisions to static ones
- File ivyPropertiesInCache = cacheManager.getResolvedIvyPropertiesInCache(
- md.getResolvedModuleRevisionId());
+ File ivyPropertiesInCache = cacheManager.getResolvedIvyPropertiesInCache(md
+ .getResolvedModuleRevisionId());
Properties props = new Properties();
if (dependencies.length > 0) {
Map forcedRevisions = new HashMap();
for (int i = 0; i < dependencies.length; i++) {
if (dependencies[i].getModuleRevision() != null
&& dependencies[i].getModuleRevision().isForce()) {
- forcedRevisions.put(dependencies[i].getModuleId(), dependencies[i].getResolvedId());
+ forcedRevisions.put(dependencies[i].getModuleId(),
+ dependencies[i].getResolvedId());
}
}
-
+
IvyNode root = dependencies[0].getRoot();
- // <ModuleId,IvyNode>();
+ // <ModuleId,IvyNode>();
Map topLevelDeps = new HashMap(); //
for (int i = 0; i < dependencies.length; i++) {
if (!dependencies[i].hasProblem()) {
@@ -276,7 +278,7 @@ public class ResolveEngine {
DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
if (dd == null) {
ModuleId mid = dependencies[i].getModuleId();
- IvyNode tlDep = (IvyNode)topLevelDeps.get(mid);
+ IvyNode tlDep = (IvyNode) topLevelDeps.get(mid);
if (tlDep != null) {
dd = tlDep.getDependencyDescriptor(root);
}
@@ -285,35 +287,37 @@ public class ResolveEngine {
ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
- ModuleRevisionId forcedRevisionId = (ModuleRevisionId)
- forcedRevisions.get(dependencies[i].getModuleId());
-
+ ModuleRevisionId forcedRevisionId = (ModuleRevisionId) forcedRevisions
+ .get(dependencies[i].getModuleId());
+
if (dependencies[i].getModuleRevision() != null
&& dependencies[i].getModuleRevision().isForce()
&& !depResolvedId.equals(depRevisionId)
&& !settings.getVersionMatcher().isDynamic(depRevisionId)) {
- // if we were forced to this revision and we
- // are not a dynamic revision, reset to the
+ // if we were forced to this revision and we
+ // are not a dynamic revision, reset to the
// asked revision
depResolvedId = depRevisionId;
depDescriptor = null;
}
-
+
if (depResolvedId == null) {
- throw new NullPointerException("getResolvedId() is null for "
- + dependencies[i].toString());
+ throw new NullPointerException("getResolvedId() is null for "
+ + dependencies[i].toString());
}
if (depRevisionId == null) {
throw new NullPointerException("getDependencyRevisionId() "
- + "is null for " + dd.toString());
+ + "is null for " + dd.toString());
}
String rev = depResolvedId.getRevision();
- String forcedRev = forcedRevisionId == null ? rev : forcedRevisionId.getRevision();
-
+ String forcedRev = forcedRevisionId == null ? rev : forcedRevisionId
+ .getRevision();
+
// The evicted modules have no description, so we can't put the status
String status = depDescriptor == null ? "?" : depDescriptor.getStatus();
Message.debug("storing dependency " + depResolvedId + " in props");
- props.put(depRevisionId.encodeToString(), rev + " " + status + " " + forcedRev + " " + depResolvedId.getBranch());
+ props.put(depRevisionId.encodeToString(), rev + " " + status + " "
+ + forcedRev + " " + depResolvedId.getBranch());
}
}
}
@@ -354,23 +358,22 @@ public class ResolveEngine {
}
}
- public void outputReport(
- ResolveReport report, ResolutionCacheManager cacheMgr, ResolveOptions options)
- throws IOException {
+ public void outputReport(ResolveReport report, ResolutionCacheManager cacheMgr,
+ ResolveOptions options) throws IOException {
if (ResolveOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info(":: resolution report :: resolve " + report.getResolveTime() + "ms"
- + " :: artifacts dl " + report.getDownloadTime() + "ms");
+ + " :: artifacts dl " + report.getDownloadTime() + "ms");
} else {
Message.verbose(":: resolution report :: resolve " + report.getResolveTime() + "ms"
- + " :: artifacts dl " + report.getDownloadTime() + "ms");
+ + " :: artifacts dl " + report.getDownloadTime() + "ms");
}
report.setProblemMessages(Message.getProblems());
// output report
report.output(settings.getReportOutputters(), cacheMgr, options);
}
- public void downloadArtifacts(
- ResolveReport report, Filter artifactFilter, DownloadOptions options) {
+ public void downloadArtifacts(ResolveReport report, Filter artifactFilter,
+ DownloadOptions options) {
long start = System.currentTimeMillis();
IvyNode[] dependencies = (IvyNode[]) report.getDependencies().toArray(
new IvyNode[report.getDependencies().size()]);
@@ -393,8 +396,8 @@ public class ResolveEngine {
if (adrs[j].getDownloadStatus() == DownloadStatus.FAILED) {
if (adrs[j].getArtifact().getExtraAttribute("ivy:merged") != null) {
Message.warn("\tmerged artifact not found: " + adrs[j].getArtifact()
- + ". It was required in "
- + adrs[j].getArtifact().getExtraAttribute("ivy:merged"));
+ + ". It was required in "
+ + adrs[j].getArtifact().getExtraAttribute("ivy:merged"));
} else {
Message.warn("\t" + adrs[j]);
resolver.reportFailure(adrs[j].getArtifact());
@@ -409,7 +412,7 @@ public class ResolveEngine {
// the report itself is responsible to take into account only
// artifacts required in its corresponding configuration
// (as described by the Dependency object)
- if (dependencies[i].isEvicted(dconfs[j])
+ if (dependencies[i].isEvicted(dconfs[j])
|| dependencies[i].isBlacklisted(dconfs[j])) {
report.getConfigurationReport(dconfs[j]).addDependency(dependencies[i]);
} else {
@@ -444,7 +447,7 @@ public class ResolveEngine {
DownloadReport r = resolver.download(new Artifact[] {artifact}, options);
return r.getArtifactReport(artifact);
}
-
+
/**
* Locates an artifact in dependency resolvers, and return its location if it can be located and
* actually exists, or an unknown {@link ArtifactOrigin} in other cases.
@@ -459,7 +462,7 @@ public class ResolveEngine {
DependencyResolver resolver = settings.getResolver(artifact.getModuleRevisionId());
return resolver.locate(artifact);
}
-
+
/**
* Materialize an artifact already located.
* <p>
@@ -482,11 +485,10 @@ public class ResolveEngine {
* @see #locate(Artifact)
*/
public ArtifactDownloadReport download(ArtifactOrigin origin, DownloadOptions options) {
- DependencyResolver resolver = settings.getResolver(
- origin.getArtifact().getModuleRevisionId());
+ DependencyResolver resolver = settings.getResolver(origin.getArtifact()
+ .getModuleRevisionId());
return resolver.download(origin, options);
}
-
/**
* Resolve the dependencies of a module without downloading corresponding artifacts. The module
@@ -509,8 +511,9 @@ public class ResolveEngine {
*/
public IvyNode[] getDependencies(URL ivySource, ResolveOptions options) throws ParseException,
IOException {
- return getDependencies(ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
- settings, ivySource, options.isValidate()), options, null);
+ return getDependencies(
+ ModuleDescriptorParserRegistry.getInstance().parseDescriptor(settings, ivySource,
+ options.isValidate()), options, null);
}
/**
@@ -549,16 +552,15 @@ public class ResolveEngine {
}
}
if (!missingConfs.isEmpty()) {
- throw new IllegalArgumentException(
- "requested configuration" + (missingConfs.size() > 1 ? "s" : "")
- + " not found in "
- + md.getModuleRevisionId() + ": " + missingConfs);
+ throw new IllegalArgumentException("requested configuration"
+ + (missingConfs.size() > 1 ? "s" : "") + " not found in "
+ + md.getModuleRevisionId() + ": " + missingConfs);
}
IvyContext context = IvyContext.pushNewCopyContext();
try {
options.setConfs(confs);
-
+
Date reportDate = new Date();
ResolveData data = context.getResolveData();
if (data == null) {
@@ -566,18 +568,18 @@ public class ResolveEngine {
context.setResolveData(data);
}
IvyNode rootNode = new IvyNode(data, md);
-
+
for (int i = 0; i < confs.length; i++) {
Message.verbose("resolving dependencies for configuration '" + confs[i] + "'");
// for each configuration we clear the cache of what's been fetched
fetchedSet.clear();
-
+
ConfigurationResolveReport confReport = null;
if (report != null) {
confReport = report.getConfigurationReport(confs[i]);
if (confReport == null) {
- confReport = new ConfigurationResolveReport(
- this, md, confs[i], reportDate, options);
+ confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate,
+ options);
report.addReport(confs[i], confReport);
}
}
@@ -610,11 +612,11 @@ public class ResolveEngine {
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());
+ 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()) {
@@ -623,17 +625,17 @@ public class ResolveEngine {
}
List sortedDependencies = sortEngine.sortNodes(dependencies, SortOptions.SILENT);
Collections.reverse(sortedDependencies);
-
- handleTransiviteEviction(md, confs, data, sortedDependencies);
-
+
+ handleTransiviteEviction(md, confs, data, sortedDependencies);
+
return (IvyNode[]) dependencies.toArray(new IvyNode[dependencies.size()]);
} finally {
IvyContext.popContext();
}
}
- private void handleTransiviteEviction(
- ModuleDescriptor md, String[] confs, ResolveData data, List sortedDependencies) {
+ private void handleTransiviteEviction(ModuleDescriptor md, String[] confs, ResolveData data,
+ List 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
@@ -672,14 +674,13 @@ public class ResolveEngine {
}
}
if (allEvicted) {
- Message.verbose("all callers are evicted for "
- + node + ": evicting too");
+ 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");
+ + " isn't transitively evicted, at least one caller was"
+ + " not evicted");
}
}
}
@@ -698,13 +699,13 @@ public class ResolveEngine {
}
ResolveData data = node.getNode().getData();
VisitNode parentVisitNode = data.getCurrentVisitNode();
-
+
data.setCurrentVisitNode(node);
DependencyDescriptor dd = node.getDependencyDescriptor();
VersionMatcher versionMatcher = node.getNode().getData().getSettings().getVersionMatcher();
- if (dd != null
- && !(node.getRoot() == node.getParent()
- && versionMatcher.isDynamic(dd.getDependencyRevisionId()))) {
+ if (dd != null
+ && !(node.getRoot() == node.getParent() && versionMatcher.isDynamic(dd
+ .getDependencyRevisionId()))) {
/*
* we don't resolve conflicts before loading data for direct dependencies on dynamic
* revisions, so that direct dynamic revisions are always resolved, which is mandatory
@@ -717,7 +718,7 @@ public class ResolveEngine {
// we resolve conflict again now that we have all information loaded
// indeed in some cases conflict manager need more information than just asked
// dependency to take the decision
- resolveConflict(node, conf);
+ resolveConflict(node, conf);
if (!node.isEvicted() && !node.isCircular()) {
String[] confs = node.getRealConfs(conf);
for (int i = 0; i < confs.length; i++) {
@@ -791,7 +792,7 @@ public class ResolveEngine {
// now we can actually resolve this configuration dependencies
if (!isDependenciesFetched(node.getNode(), conf) && node.isTransitive()) {
- Collection/*<VisitNode>*/ dependencies = node.getDependencies(conf);
+ Collection/* <VisitNode> */dependencies = node.getDependencies(conf);
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
VisitNode dep = (VisitNode) iter.next();
dep.useRealNode(); // the node may have been resolved to another real one while
@@ -805,11 +806,11 @@ public class ResolveEngine {
// been updated when evicting another module), we fetch them now
confs = dep.getConfsToFetch();
for (int i = 0; i < confs.length; i++) {
- //shouldBeFixed=false to because some of those dependencies might
- //be private when they were actually extending public conf.
- //Should we keep two list of confs to fetch (private&public)?
- //I don't think, visibility is already checked, and a change in the
- //configuration between version might anyway have worse problems.
+ // shouldBeFixed=false to because some of those dependencies might
+ // be private when they were actually extending public conf.
+ // Should we keep two list of confs to fetch (private&public)?
+ // I don't think, visibility is already checked, and a change in the
+ // configuration between version might anyway have worse problems.
fetchDependencies(dep, confs[i], false);
}
}
@@ -837,7 +838,7 @@ public class ResolveEngine {
String key = getDependenciesFetchedKey(node, conf);
return fetchedSet.contains(key);
}
-
+
private void markDependenciesFetched(IvyNode node, String conf) {
String key = getDependenciesFetchedKey(node, conf);
fetchedSet.add(key);
@@ -905,22 +906,22 @@ public class ResolveEngine {
}
// compute conflicts
- Set resolvedNodes = ancestor.getNode().getResolvedNodes(node.getModuleId(),
- node.getRootModuleConf());
+ Set resolvedNodes = ancestor.getNode().getResolvedNodes(node.getModuleId(),
+ node.getRootModuleConf());
resolvedNodes.addAll(ancestor.getNode().getPendingConflicts(node.getRootModuleConf(),
node.getModuleId()));
Collection conflicts = computeConflicts(node, ancestor, conf, toevict, resolvedNodes);
ConflictManager conflictManager = ancestor.getNode().getConflictManager(node.getModuleId());
-
+
Collection resolved = resolveConflicts(node, ancestor, conflicts, conflictManager);
if (resolved == null) {
if (debugConflictResolution) {
Message.debug("impossible to resolve conflicts for " + node + " in " + ancestor
+ " yet");
- Message.debug("setting all nodes as pending conflicts for later conflict"
- + " resolution: " + conflicts);
+ Message.debug("setting all nodes as pending conflicts for later conflict"
+ + " resolution: " + conflicts);
}
ancestor.getNode().setPendingConflicts(node.getModuleId(), node.getRootModuleConf(),
conflicts);
@@ -1001,8 +1002,8 @@ public class ResolveEngine {
for (Iterator iter = resolved.iterator(); iter.hasNext();) {
IvyNode sel = (IvyNode) iter.next();
if (!prevResolved.contains(sel)) {
- solved &= resolveConflict(node.gotoNode(sel), ancestor.getParent(),
- conf, toevict);
+ solved &= resolveConflict(node.gotoNode(sel), ancestor.getParent(), conf,
+ toevict);
}
}
}
@@ -1012,23 +1013,24 @@ public class ResolveEngine {
private Collection resolveConflicts(VisitNode node, VisitNode ancestor, Collection conflicts,
ConflictManager conflictManager) {
- if (node.getParent() != ancestor
- // we are not handling the direct parent
-
+ if (node.getParent() != ancestor
+ // we are not handling the direct parent
+
&& conflictManager == settings.getConflictManager(node.getModuleId())
// the conflict manager is the default one
-
- && node.getParent().getNode().getResolvedNodes(
- node.getModuleId(), node.getRootModuleConf()).equals(conflicts)
- // there is no new conflict in this ancestor
-
- ) {
+
+ && node.getParent().getNode()
+ .getResolvedNodes(node.getModuleId(), node.getRootModuleConf())
+ .equals(conflicts)
+ // there is no new conflict in this ancestor
+
+ ) {
// IVY-465 case
if (settings.debugConflictResolution()) {
Message.debug("no new conflicting revisions for " + node + " in " + ancestor + ": "
+ conflicts);
}
-
+
return conflicts;
} else {
if (settings.debugConflictResolution()) {
@@ -1052,8 +1054,8 @@ public class ResolveEngine {
* the configuration of the node in which conflicts should be computed
* @param toevict
* a collection of nodes which have been evicted during conflict resolution at lower
- * level. It may be empty if no conflict resolution has occurred for this node yet, or
- * if no node has been evicted.
+ * level. It may be empty if no conflict resolution has occurred for this node yet,
+ * or if no node has been evicted.
* @param selectedNodes
* a collection of nodes selected during previous conflict resolution for the given
* node and ancestor. This collection is updated by this call, removing nodes which
@@ -1075,25 +1077,25 @@ public class ResolveEngine {
* Another case where we need to deeply compute selected nodes is when selectedNodes is
* empty (not computed yet) and we aren't in the context of the direct parent of the node.
*/
- if (evictedInSelected || (selectedNodes.isEmpty()
- && !node.getParent().getNode().equals(ancestor.getNode()))) {
+ if (evictedInSelected
+ || (selectedNodes.isEmpty() && !node.getParent().getNode()
+ .equals(ancestor.getNode()))) {
IvyContext context = IvyContext.getContext();
ResolveData data = context.getResolveData();
VisitNode oldVisitNode = data.getCurrentVisitNode();
data.setCurrentVisitNode(ancestor);
try {
// In this case we need to compute selected nodes again.
- Collection deps = ancestor.getNode().getDependencies(
- node.getRootModuleConf(),
- ancestor.getNode().getConfigurations(node.getRootModuleConf()),
+ Collection deps = ancestor.getNode().getDependencies(node.getRootModuleConf(),
+ ancestor.getNode().getConfigurations(node.getRootModuleConf()),
ancestor.getRequestedConf());
for (Iterator iter = deps.iterator(); iter.hasNext();) {
IvyNode dep = (IvyNode) iter.next();
if (dep.getModuleId().equals(node.getModuleId())) {
conflicts.add(dep);
}
- conflicts.addAll(
- dep.getResolvedNodes(node.getModuleId(), node.getRootModuleConf()));
+ conflicts.addAll(dep.getResolvedNodes(node.getModuleId(),
+ node.getRootModuleConf()));
}
} finally {
data.setCurrentVisitNode(oldVisitNode);
@@ -1106,8 +1108,8 @@ public class ResolveEngine {
*/
VisitNode parent = node.getParent();
Collection parentDepIvyNodes = parent.getNode().getDependencies(
- node.getRootModuleConf(),
- parent.getNode().getConfigurations(node.getRootModuleConf()),
+ node.getRootModuleConf(),
+ parent.getNode().getConfigurations(node.getRootModuleConf()),
parent.getRequestedConf());
for (Iterator it = parentDepIvyNodes.iterator(); it.hasNext();) {
IvyNode parentDep = (IvyNode) it.next();
@@ -1178,21 +1180,20 @@ public class ResolveEngine {
* the resolve options to use
* @return the mediated {@link DependencyDescriptor}.
*/
- public DependencyDescriptor mediate(
- DependencyDescriptor dd, ResolveOptions options) {
+ public DependencyDescriptor mediate(DependencyDescriptor dd, ResolveOptions options) {
if (dd == null) {
return null;
}
- String resolveMode = options.getResolveMode() == null
- ? settings.getResolveMode(dd.getDependencyId())
- : options.getResolveMode();
+ String resolveMode = options.getResolveMode() == null ? settings.getResolveMode(dd
+ .getDependencyId()) : options.getResolveMode();
if (ResolveOptions.RESOLVEMODE_DYNAMIC.equals(resolveMode)
- && !dd.getDynamicConstraintDependencyRevisionId()
- .equals(dd.getDependencyRevisionId())) {
+ && !dd.getDynamicConstraintDependencyRevisionId().equals(
+ dd.getDependencyRevisionId())) {
// the dynamicRevId can contain a null branch, so make sure this
// has been replaced by the default branch (if any!)
- return dd.clone(ModuleRevisionId.newInstance(dd.getDynamicConstraintDependencyRevisionId(),
- dd.getDynamicConstraintDependencyRevisionId().getRevision()));
+ return dd.clone(ModuleRevisionId.newInstance(dd
+ .getDynamicConstraintDependencyRevisionId(), dd
+ .getDynamicConstraintDependencyRevisionId().getRevision()));
} else {
return dd;
}
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=1557968&r1=1557967&r2=1557968&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 14 08:27:37 2014
@@ -32,20 +32,22 @@ import org.apache.ivy.util.filter.Filter
* @see ResolveEngine
*/
public class ResolveOptions extends LogOptions {
-
+
/**
* Default resolve mode, using default revision constraints in dependency descriptors.
*/
public static final String RESOLVEMODE_DEFAULT = "default";
+
/**
* Dynamic resolve mode, using dynamic revision constraints in dependency descriptors.
*/
public static final String RESOLVEMODE_DYNAMIC = "dynamic";
+
/**
* Array of all available resolve modes.
*/
- public static final String[] RESOLVEMODES =
- new String[] {RESOLVEMODE_DEFAULT, RESOLVEMODE_DYNAMIC};
+ public static final String[] RESOLVEMODES = new String[] {RESOLVEMODE_DEFAULT,
+ RESOLVEMODE_DYNAMIC};
/**
* an array of configuration names to resolve - must not be null nor empty
@@ -99,10 +101,10 @@ public class ResolveOptions extends LogO
* A filter to use to avoid downloading all artifacts.
*/
private Filter artifactFilter = FilterHelper.NO_FILTER;
-
+
/**
- * The resolve mode to use. Should be one of {@link #RESOLVEMODES}, or <code>null</code> to
- * use settings configured resolve mode.
+ * The resolve mode to use. Should be one of {@link #RESOLVEMODES}, or <code>null</code> to use
+ * settings configured resolve mode.
*/
private String resolveMode;
@@ -112,10 +114,10 @@ public class ResolveOptions extends LogO
private String resolveId;
private boolean refresh;
-
+
/**
- * True if the resolve should compare the new resolution against the previous report
- **/
+ * True if the resolve should compare the new resolution against the previous report
+ **/
private boolean checkIfChanged = false;
public ResolveOptions() {
@@ -146,7 +148,7 @@ public class ResolveOptions extends LogO
this.artifactFilter = artifactFilter;
return this;
}
-
+
/**
* Returns the resolve mode to use, or <code>null</code> to use settings configured resolve
* mode.
@@ -156,17 +158,17 @@ public class ResolveOptions extends LogO
public String getResolveMode() {
return resolveMode;
}
-
+
public ResolveOptions setResolveMode(String resolveMode) {
this.resolveMode = resolveMode;
return this;
}
/**
- * Indicates if the configurations use a special configuration
- * * , *(private) or *(public).
- * When special configurations are used, you must have the module
- * descriptor in order to get the list of configurations.
+ * Indicates if the configurations use a special configuration * , *(private) or *(public). When
+ * special configurations are used, you must have the module descriptor in order to get the list
+ * of configurations.
+ *
* @see #getConfs()
* @see #getConfs(ModuleDescriptor)
*/
@@ -180,24 +182,26 @@ public class ResolveOptions extends LogO
}
/**
- * @pre can only be called if useSpecialConfs()==false. When it is true,
- * you have to provide a module desciptor so that configurations can be resolved.
+ * @pre can only be called if useSpecialConfs()==false. When it is true, you have to provide a
+ * module desciptor so that configurations can be resolved.
* @see #getConfs(ModuleDescriptor)
*/
public String[] getConfs() {
if (useSpecialConfs()) {
- throw new AssertionError("ResolveOptions.getConfs() "
- + "can not be used for options used special confs.");
+ throw new AssertionError("ResolveOptions.getConfs() "
+ + "can not be used for options used special confs.");
}
return confs;
}
- /**
- * Get the aksed confs. Special confs (like *) use the moduleDescriptor to find the values *
- * @param md Used to get the exact values for special confs.
+ /**
+ * Get the aksed confs. Special confs (like *) use the moduleDescriptor to find the values *
+ *
+ * @param md
+ * Used to get the exact values for special confs.
* */
public String[] getConfs(ModuleDescriptor md) {
- //TODO add isInline, in that case, replace * by *(public).
+ // TODO add isInline, in that case, replace * by *(public).
return ConfigurationUtils.replaceWildcards(confs, md);
}
@@ -282,7 +286,7 @@ public class ResolveOptions extends LogO
this.refresh = refresh;
return this;
}
-
+
public boolean isRefresh() {
return refresh;
}
@@ -291,12 +295,11 @@ public class ResolveOptions extends LogO
this.checkIfChanged = checkIfChanged;
return this;
}
-
+
public boolean getCheckIfChanged() {
return checkIfChanged;
}
-
public static String getDefaultResolveId(ModuleDescriptor md) {
ModuleId module = md.getModuleRevisionId().getModuleId();
return getDefaultResolveId(module);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolvedModuleRevision.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolvedModuleRevision.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolvedModuleRevision.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolvedModuleRevision.java Tue Jan 14 08:27:37 2014
@@ -28,7 +28,7 @@ import org.apache.ivy.plugins.resolver.D
* Represents a module revision provisioned on the local filesystem.
*/
public class ResolvedModuleRevision {
-
+
private DependencyResolver resolver;
private DependencyResolver artifactResolver;
@@ -36,7 +36,7 @@ public class ResolvedModuleRevision {
private ModuleDescriptor descriptor;
private MetadataArtifactDownloadReport report;
-
+
private boolean force = false;
public ResolvedModuleRevision(DependencyResolver resolver, DependencyResolver artifactResolver,
@@ -65,7 +65,6 @@ public class ResolvedModuleRevision {
return descriptor.getResolvedModuleRevisionId();
}
-
/**
* Returns the date of publication of the resolved module.
*
@@ -74,7 +73,6 @@ public class ResolvedModuleRevision {
public Date getPublicationDate() {
return descriptor.getResolvedPublicationDate();
}
-
/**
* Returns the descriptor of the resolved module.
@@ -85,7 +83,6 @@ public class ResolvedModuleRevision {
return descriptor;
}
-
/**
* The resolver which resolved this ResolvedModuleRevision
*
@@ -104,7 +101,6 @@ public class ResolvedModuleRevision {
return artifactResolver;
}
-
/**
* Returns a report of the resolved module metadata artifact provisioning.
*
@@ -113,17 +109,17 @@ public class ResolvedModuleRevision {
public MetadataArtifactDownloadReport getReport() {
return report;
}
-
+
/**
- * Returns <code>true</code> if this resolved module revision should be forced as the one
- * being returned.
+ * Returns <code>true</code> if this resolved module revision should be forced as the one being
+ * returned.
* <p>
* This is used as an indication for CompositeResolver, to know if they should continue to look
* for a better ResolvedModuleRevision if possible, or stop with this instance.
* </p>
*
- * @return <code>true</code> if this resolved module revision should be forced as the one
- * being returned.
+ * @return <code>true</code> if this resolved module revision should be forced as the one being
+ * returned.
*/
public boolean isForce() {
return force;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/VisitNode.java Tue Jan 14 08:27:37 2014
@@ -99,11 +99,11 @@ public class VisitNode {
* the current path. null if not computed yet Boolean.FALSE otherwise
*/
private Boolean isCircular;
-
+
/**
- * IvyNode usage information to update when visiting the underlying IvyNode.
- * This is usually the main IvyNodeUsage of the underlying node, except when we are visiting it
- * coming from an evicted node replaced by the other one.
+ * IvyNode usage information to update when visiting the underlying IvyNode. This is usually the
+ * main IvyNodeUsage of the underlying node, except when we are visiting it coming from an
+ * evicted node replaced by the other one.
*/
private IvyNodeUsage usage;
@@ -117,7 +117,7 @@ public class VisitNode {
Checks.checkNotNull(data, "data");
Checks.checkNotNull(node, "node");
Checks.checkNotNull(rootModuleConf, "rootModuleConf");
-
+
this.data = data;
this.node = node;
this.parent = parent;
@@ -159,14 +159,14 @@ public class VisitNode {
*
* @return
*/
- public Collection/*<VisitNode>*/ getPath() {
+ public Collection/* <VisitNode> */getPath() {
if (path == null) {
path = computePath();
}
return path;
}
- private Collection/*<VisitNode>*/ computePath() {
+ private Collection/* <VisitNode> */computePath() {
if (parent != null) {
Collection p = new LinkedHashSet(parent.getPath());
p.add(this);
@@ -223,15 +223,15 @@ public class VisitNode {
// the root node is always considered transitive!
return true;
}
-
+
if (!data.isTransitive()) {
return false;
}
-
+
if (!isParentConfTransitive()) {
return false;
}
-
+
DependencyDescriptor dd = node.getDependencyDescriptor(getParentNode());
if ((dd != null) && dd.isTransitive()) {
return true;
@@ -289,18 +289,18 @@ public class VisitNode {
}
public boolean loadData(String conf, boolean shouldBePublic) {
- boolean loaded = node.loadData(
- rootModuleConf, getParentNode(), parentConf, conf, shouldBePublic, getUsage());
+ boolean loaded = node.loadData(rootModuleConf, getParentNode(), parentConf, conf,
+ shouldBePublic, getUsage());
if (loaded) {
useRealNode();
-
+
// if the loaded revision is different from original one
// we now register this node on the new resolved id
// this includes two cases:
// - the id refers to a dynamic revision, which has been resolved by loadData
- // - the loaded module descriptor has extra attributes in his info tag which are not
- // used when declaring the dependency
- if (data.getNode(node.getResolvedId()) == null
+ // - the loaded module descriptor has extra attributes in his info tag which are not
+ // used when declaring the dependency
+ if (data.getNode(node.getResolvedId()) == null
|| !data.getNode(node.getResolvedId()).getId().equals(node.getResolvedId())) {
data.register(node.getResolvedId(), this);
}
@@ -309,9 +309,9 @@ public class VisitNode {
return loaded;
}
- public Collection/*<VisitNode>*/ getDependencies(String conf) {
- Collection/*<IvyNode>*/ deps = node.getDependencies(rootModuleConf, conf, requestedConf);
- Collection/*<VisitNode>*/ ret = new ArrayList(deps.size());
+ public Collection/* <VisitNode> */getDependencies(String conf) {
+ Collection/* <IvyNode> */deps = node.getDependencies(rootModuleConf, conf, requestedConf);
+ Collection/* <VisitNode> */ret = new ArrayList(deps.size());
for (Iterator iter = deps.iterator(); iter.hasNext();) {
IvyNode depNode = (IvyNode) iter.next();
ret.add(traverseChild(conf, depNode));
@@ -321,7 +321,7 @@ public class VisitNode {
/**
* Returns a VisitNode for the given node. The given node must be a representation of the same
- * module (usually in another revision) as the one visited by this node.
+ * module (usually in another revision) as the one visited by this node.
*
* @param node
* the node to visit
@@ -360,11 +360,10 @@ public class VisitNode {
return traverse(parent, parentConf, child, null);
}
- private VisitNode traverse(
- VisitNode parent, String parentConf, IvyNode node, IvyNodeUsage usage) {
+ private VisitNode traverse(VisitNode parent, String parentConf, IvyNode node, IvyNodeUsage usage) {
if (getPath().contains(node)) {
- IvyContext.getContext().getCircularDependencyStrategy().handleCircularDependency(
- toMrids(getPath(), node.getId()));
+ IvyContext.getContext().getCircularDependencyStrategy()
+ .handleCircularDependency(toMrids(getPath(), node.getId()));
// we do not use the new parent, but the first one, to always be able to go up to the
// root
// parent = getVisitNode(depNode).getParent();
@@ -406,7 +405,7 @@ public class VisitNode {
public boolean hasProblem() {
return node.hasProblem();
}
-
+
public Configuration getConfiguration(String conf) {
return node.getConfiguration(conf);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/FileNameMapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/FileNameMapper.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/FileNameMapper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/FileNameMapper.java Tue Jan 14 08:27:37 2014
@@ -20,5 +20,5 @@ package org.apache.ivy.core.retrieve;
public interface FileNameMapper {
String[] mapFileName(String fileName);
-
+
}
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=1557968&r1=1557967&r2=1557968&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 Tue Jan 14 08:27:37 2014
@@ -69,10 +69,13 @@ public class RetrieveEngine {
* localCacheDirectory to determine an ivy report file, used as input for the copy If such a
* file does not exist for any conf (resolve has not been called before ?) then an
* IllegalStateException is thrown and nothing is copied.
- *
- * @deprecated Use {@link #retrieve(org.apache.ivy.core.module.id.ModuleRevisionId, RetrieveOptions)} instead
+ *
+ * @deprecated Use
+ * {@link #retrieve(org.apache.ivy.core.module.id.ModuleRevisionId, RetrieveOptions)}
+ * instead
*/
- public int retrieve(ModuleRevisionId mrid, String destFilePattern, RetrieveOptions options) throws IOException {
+ public int retrieve(ModuleRevisionId mrid, String destFilePattern, RetrieveOptions options)
+ throws IOException {
RetrieveOptions retieveOptions = new RetrieveOptions(options);
retieveOptions.setDestArtifactPattern(destFilePattern);
@@ -80,7 +83,8 @@ public class RetrieveEngine {
return result.getNbrArtifactsCopied();
}
- public RetrieveReport retrieve(ModuleRevisionId mrid, RetrieveOptions options) throws IOException {
+ public RetrieveReport retrieve(ModuleRevisionId mrid, RetrieveOptions options)
+ throws IOException {
RetrieveReport report = new RetrieveReport();
ModuleId moduleId = mrid.getModuleId();
@@ -92,8 +96,10 @@ public class RetrieveEngine {
Message.verbose("\tcheckUpToDate=" + settings.isCheckUpToDate());
long start = System.currentTimeMillis();
- String destFilePattern = IvyPatternHelper.substituteVariables(options.getDestArtifactPattern(), settings.getVariables());
- String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(), settings.getVariables());
+ String destFilePattern = IvyPatternHelper.substituteVariables(
+ options.getDestArtifactPattern(), settings.getVariables());
+ String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
+ settings.getVariables());
String[] confs = getConfs(mrid, options);
if (LogOptions.LOG_DEFAULT.equals(options.getLog())) {
@@ -106,14 +112,14 @@ public class RetrieveEngine {
}
try {
- Map/*<File, File>*/ destToSrcMap = null;
+ Map/* <File, File> */destToSrcMap = null;
// Map<ArtifactDownloadReport, Set<String>>
Map artifactsToCopy = determineArtifactsToCopy(mrid, destFilePattern, options);
- File fileRetrieveRoot = settings.resolveFile(
- IvyPatternHelper.getTokenRoot(destFilePattern));
+ File fileRetrieveRoot = settings.resolveFile(IvyPatternHelper
+ .getTokenRoot(destFilePattern));
report.setRetrieveRoot(fileRetrieveRoot);
- File ivyRetrieveRoot = destIvyPattern == null
- ? null : settings.resolveFile(IvyPatternHelper.getTokenRoot(destIvyPattern));
+ File ivyRetrieveRoot = destIvyPattern == null ? null : settings
+ .resolveFile(IvyPatternHelper.getTokenRoot(destIvyPattern));
Collection targetArtifactsStructure = new HashSet(); // Set(File) set of all paths
// which should be present at
// then end of retrieve (useful
@@ -198,13 +204,13 @@ public class RetrieveEngine {
if (options.isSync()) {
Message.verbose("\tsyncing...");
-
+
String[] ignorableFilenames = settings.getIgnorableFilenames();
Collection ignoreList = Arrays.asList(ignorableFilenames);
-
+
Collection existingArtifacts = FileUtil.listAll(fileRetrieveRoot, ignoreList);
- Collection existingIvys = ivyRetrieveRoot == null ? null : FileUtil
- .listAll(ivyRetrieveRoot, ignoreList);
+ Collection existingIvys = ivyRetrieveRoot == null ? null : FileUtil.listAll(
+ ivyRetrieveRoot, ignoreList);
if (fileRetrieveRoot.equals(ivyRetrieveRoot)) {
Collection target = targetArtifactsStructure;
@@ -221,11 +227,10 @@ public class RetrieveEngine {
}
long elapsedTime = System.currentTimeMillis() - start;
String msg = "\t"
- + report.getNbrArtifactsCopied()
- + " artifacts copied"
- + (settings.isCheckUpToDate() ? (", " + report.getNbrArtifactsUpToDate() + " already retrieved")
- : "")
- + " (" + (totalCopiedSize / KILO) + "kB/" + elapsedTime + "ms)";
+ + report.getNbrArtifactsCopied()
+ + " artifacts copied"
+ + (settings.isCheckUpToDate() ? (", " + report.getNbrArtifactsUpToDate() + " already retrieved")
+ : "") + " (" + (totalCopiedSize / KILO) + "kB/" + elapsedTime + "ms)";
if (LogOptions.LOG_DEFAULT.equals(options.getLog())) {
Message.info(msg);
} else {
@@ -233,9 +238,9 @@ public class RetrieveEngine {
}
Message.verbose("\tretrieve done (" + (elapsedTime) + "ms)");
if (this.eventManager != null) {
- this.eventManager.fireIvyEvent(new EndRetrieveEvent(
- mrid, confs, elapsedTime, report.getNbrArtifactsCopied(), report.getNbrArtifactsUpToDate(), totalCopiedSize,
- options));
+ this.eventManager.fireIvyEvent(new EndRetrieveEvent(mrid, confs, elapsedTime,
+ report.getNbrArtifactsCopied(), report.getNbrArtifactsUpToDate(),
+ totalCopiedSize, options));
}
return report;
@@ -249,7 +254,8 @@ public class RetrieveEngine {
if (confs == null || (confs.length == 1 && "*".equals(confs[0]))) {
try {
ModuleDescriptor md = getCache().getResolvedModuleDescriptor(mrid);
- Message.verbose("no explicit confs given for retrieve, using ivy file: " + md.getResource().getName());
+ Message.verbose("no explicit confs given for retrieve, using ivy file: "
+ + md.getResource().getName());
confs = md.getConfigurationsNames();
options.setConfs(confs);
} catch (IOException e) {
@@ -307,12 +313,12 @@ public class RetrieveEngine {
// ArtifactDownloadReport source -> Set (String copyDestAbsolutePath)
final Map artifactsToCopy = new HashMap();
// String copyDestAbsolutePath -> Set (ArtifactRevisionId source)
- final Map conflictsMap = new HashMap();
+ final Map conflictsMap = new HashMap();
// String copyDestAbsolutePath -> Set (ArtifactDownloadReport source)
- final Map conflictsReportsMap = new HashMap();
+ final Map conflictsReportsMap = new HashMap();
// String copyDestAbsolutePath -> Set (String conf)
- final Map conflictsConfMap = new HashMap();
-
+ final Map conflictsConfMap = new HashMap();
+
XmlReportParser parser = new XmlReportParser();
for (int i = 0; i < confs.length; i++) {
final String conf = confs[i];
@@ -337,9 +343,8 @@ public class RetrieveEngine {
ext = "";
}
- String destPattern = "ivy".equals(adr.getType()) ? destIvyPattern
- : destFilePattern;
-
+ String destPattern = "ivy".equals(adr.getType()) ? destIvyPattern : destFilePattern;
+
if (!"ivy".equals(adr.getType())
&& !options.getArtifactFilter().accept(adr.getArtifact())) {
continue; // skip this artifact, the filter didn't accept it!
@@ -388,7 +393,7 @@ public class RetrieveEngine {
}
}
}
-
+
// resolve conflicts if any
for (Iterator iter = conflictsMap.keySet().iterator(); iter.hasNext();) {
String copyDest = (String) iter.next();
@@ -399,11 +404,11 @@ public class RetrieveEngine {
// conflicts battle is resolved by a sort using a conflict resolving policy
// comparator which consider as greater a winning artifact
Collections.sort(artifactsList, getConflictResolvingPolicy());
-
+
// after the sort, the winning artifact is the greatest one, i.e. the last one
// we fail if different artifacts of the same module are mapped to the same file
- ArtifactDownloadReport winner = (ArtifactDownloadReport)
- artifactsList.get(artifactsList.size() - 1);
+ ArtifactDownloadReport winner = (ArtifactDownloadReport) artifactsList
+ .get(artifactsList.size() - 1);
ModuleRevisionId winnerMD = winner.getArtifact().getModuleRevisionId();
for (int i = artifactsList.size() - 2; i >= 0; i--) {
ArtifactDownloadReport current = (ArtifactDownloadReport) artifactsList.get(i);
@@ -413,20 +418,16 @@ public class RetrieveEngine {
+ " to fix this error.");
}
}
-
- Message.info("\tconflict on "
- + copyDest
- + " in "
- + conflictsConfs
- + ": "
+
+ Message.info("\tconflict on " + copyDest + " in " + conflictsConfs + ": "
+ winnerMD.getRevision() + " won");
// we now iterate over the list beginning with the artifact preceding the winner,
// and going backward to the least artifact
for (int i = artifactsList.size() - 2; i >= 0; i--) {
ArtifactDownloadReport looser = (ArtifactDownloadReport) artifactsList.get(i);
- Message.verbose("\t\tremoving conflict looser artifact: "
- + looser.getArtifact());
+ Message.verbose("\t\tremoving conflict looser artifact: "
+ + looser.getArtifact());
// for each loser, we remove the pair (loser - copyDest) in the artifactsToCopy
// map
Set dest = (Set) artifactsToCopy.get(looser);
@@ -444,20 +445,20 @@ public class RetrieveEngine {
if (!target.exists()) {
return false;
}
-
+
String overwriteMode = options.getOverwriteMode();
if (RetrieveOptions.OVERWRITEMODE_ALWAYS.equals(overwriteMode)) {
return false;
}
-
+
if (RetrieveOptions.OVERWRITEMODE_NEVER.equals(overwriteMode)) {
return true;
}
-
+
if (RetrieveOptions.OVERWRITEMODE_NEWER.equals(overwriteMode)) {
return source.lastModified() <= target.lastModified();
}
-
+
if (RetrieveOptions.OVERWRITEMODE_DIFFERENT.equals(overwriteMode)) {
return source.lastModified() == target.lastModified();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java Tue Jan 14 08:27:37 2014
@@ -25,7 +25,7 @@ public interface RetrieveEngineSettings
boolean isCheckUpToDate();
IvyVariableContainer getVariables();
-
+
String[] getIgnorableFilenames();
}
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=1557968&r1=1557967&r2=1557968&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 Tue Jan 14 08:27:37 2014
@@ -28,8 +28,11 @@ import org.apache.ivy.util.filter.Filter
*/
public class RetrieveOptions extends LogOptions {
public static final String OVERWRITEMODE_NEVER = "never";
+
public static final String OVERWRITEMODE_ALWAYS = "always";
+
public static final String OVERWRITEMODE_NEWER = "newer";
+
public static final String OVERWRITEMODE_DIFFERENT = "different";
/**
@@ -60,7 +63,7 @@ public class RetrieveOptions extends Log
* will be present in the destination directory, which means that some files may be deleted.
*/
private boolean sync = false;
-
+
private String overwriteMode = OVERWRITEMODE_NEWER;
/**
@@ -84,7 +87,7 @@ public class RetrieveOptions extends Log
* The id used to store the resolve information.
*/
private String resolveId;
-
+
private FileNameMapper mapper;
public RetrieveOptions() {
@@ -131,11 +134,11 @@ public class RetrieveOptions extends Log
this.confs = confs;
return this;
}
-
+
public String getOverwriteMode() {
return overwriteMode == null ? OVERWRITEMODE_NEWER : overwriteMode;
}
-
+
public RetrieveOptions setOverwriteMode(String overwriteMode) {
this.overwriteMode = overwriteMode;
return this;
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java Tue Jan 14 08:27:37 2014
@@ -28,9 +28,11 @@ import org.apache.ivy.core.report.Artifa
public class RetrieveReport {
- private Collection/*<File>*/ upToDateFiles = new HashSet();
- private Collection/*<File>*/ copiedFiles = new HashSet();
- private Map/*<File, ArtifactDownloadReport>*/ downloadReport = new HashMap();
+ private Collection/* <File> */upToDateFiles = new HashSet();
+
+ private Collection/* <File> */copiedFiles = new HashSet();
+
+ private Map/* <File, ArtifactDownloadReport> */downloadReport = new HashMap();
private File retrieveRoot;
@@ -64,22 +66,24 @@ public class RetrieveReport {
}
/**
- * Returns a collection of <tt>File</tt> objects who were actually copied during the retrieve process.
+ * Returns a collection of <tt>File</tt> objects who were actually copied during the retrieve
+ * process.
*/
public Collection getCopiedFiles() {
return new ArrayList(copiedFiles);
}
/**
- * Returns a collection of <tt>File</tt> objects who were actually copied during the retrieve process.
+ * Returns a collection of <tt>File</tt> objects who were actually copied during the retrieve
+ * process.
*/
public Collection getUpToDateFiles() {
return new ArrayList(upToDateFiles);
}
/**
- * Returns a collection of <tt>File</tt> objects who were retrieved during the retrieve process. This is
- * the union of the files being copied and the files that were up-to-date.
+ * Returns a collection of <tt>File</tt> objects who were retrieved during the retrieve process.
+ * This is the union of the files being copied and the files that were up-to-date.
*/
public Collection getRetrievedFiles() {
Collection result = new ArrayList(upToDateFiles.size() + copiedFiles.size());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/search/SearchEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/search/SearchEngine.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/search/SearchEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/search/SearchEngine.java Tue Jan 14 08:27:37 2014
@@ -58,7 +58,7 @@ public class SearchEngine {
*/
public String[] listTokenValues(String token, Map otherTokenValues) {
Set entries = new LinkedHashSet();
-
+
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
Map[] values = resolver.listTokenValues(new String[] {token}, otherTokenValues);
@@ -66,7 +66,7 @@ public class SearchEngine {
entries.add(values[i].get(token));
}
}
-
+
return (String[]) entries.toArray(new String[entries.size()]);
}
@@ -75,8 +75,8 @@ public class SearchEngine {
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
- Map[] orgs = resolver.listTokenValues(
- new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap());
+ Map[] orgs = resolver.listTokenValues(new String[] {IvyPatternHelper.ORGANISATION_KEY},
+ new HashMap());
for (int i = 0; i < orgs.length; i++) {
String org = (String) orgs[i].get(IvyPatternHelper.ORGANISATION_KEY);
entries.add(new OrganisationEntry(resolver, org));
@@ -91,8 +91,8 @@ public class SearchEngine {
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
- Map[] orgs = resolver.listTokenValues(
- new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap());
+ Map[] orgs = resolver.listTokenValues(new String[] {IvyPatternHelper.ORGANISATION_KEY},
+ new HashMap());
for (int i = 0; i < orgs.length; i++) {
entries.add(orgs[i].get(IvyPatternHelper.ORGANISATION_KEY));
}
@@ -106,11 +106,11 @@ public class SearchEngine {
Map tokenValues = new HashMap();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
-
+
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
- Map[] modules = resolver.listTokenValues(
- new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
+ Map[] modules = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
+ tokenValues);
for (int i = 0; i < modules.length; i++) {
String module = (String) modules[i].get(IvyPatternHelper.MODULE_KEY);
entries.add(new ModuleEntry(org, module));
@@ -125,11 +125,11 @@ public class SearchEngine {
Map tokenValues = new HashMap();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
-
+
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
- Map[] modules = resolver.listTokenValues(
- new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
+ Map[] modules = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
+ tokenValues);
for (int i = 0; i < modules.length; i++) {
entries.add(modules[i].get(IvyPatternHelper.MODULE_KEY));
}
@@ -137,14 +137,14 @@ public class SearchEngine {
return (String[]) entries.toArray(new String[entries.size()]);
}
-
+
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
Set entries = new HashSet();
Map tokenValues = new HashMap();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
-
+
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
Map[] revisions = resolver.listTokenValues(
@@ -164,7 +164,7 @@ public class SearchEngine {
Map tokenValues = new HashMap();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
tokenValues.put(IvyPatternHelper.MODULE_KEY, module);
-
+
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
Map[] revisions = resolver.listTokenValues(
@@ -176,7 +176,7 @@ public class SearchEngine {
return (String[]) entries.toArray(new String[entries.size()]);
}
-
+
/**
* List module ids of the module accessible through the current resolvers matching the given mid
* criteria according to the given matcher.
@@ -192,12 +192,12 @@ public class SearchEngine {
List ret = new ArrayList();
Map criteria = new HashMap();
- addMatcher(matcher, moduleCrit.getOrganisation(),
- criteria, IvyPatternHelper.ORGANISATION_KEY);
+ addMatcher(matcher, moduleCrit.getOrganisation(), criteria,
+ IvyPatternHelper.ORGANISATION_KEY);
addMatcher(matcher, moduleCrit.getName(), criteria, IvyPatternHelper.MODULE_KEY);
-
- String[] tokensToList = new String[] {
- IvyPatternHelper.ORGANISATION_KEY, IvyPatternHelper.MODULE_KEY};
+
+ String[] tokensToList = new String[] {IvyPatternHelper.ORGANISATION_KEY,
+ IvyPatternHelper.MODULE_KEY};
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
@@ -206,8 +206,8 @@ public class SearchEngine {
String org = (String) moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
ModuleId modId = ModuleId.newInstance(org, name);
- ret.add(NameSpaceHelper.transform(
- modId, resolver.getNamespace().getToSystemTransformer()));
+ ret.add(NameSpaceHelper.transform(modId, resolver.getNamespace()
+ .getToSystemTransformer()));
}
}
@@ -234,8 +234,8 @@ public class SearchEngine {
addMatcher(matcher, (String) entry.getValue(), criteria, (String) entry.getKey());
}
- String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet().toArray(
- new String[moduleCrit.getAttributes().size()]);
+ String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet()
+ .toArray(new String[moduleCrit.getAttributes().size()]);
for (Iterator iter = settings.getResolvers().iterator(); iter.hasNext();) {
DependencyResolver resolver = (DependencyResolver) iter.next();
@@ -245,7 +245,7 @@ public class SearchEngine {
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
String branch = (String) moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
String rev = (String) moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
-
+
Map foundExtraAtts = new HashMap();
Set qualAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
for (Iterator iter2 = qualAttributes.iterator(); iter2.hasNext();) {
@@ -255,15 +255,17 @@ public class SearchEngine {
if (colonIndex == -1) {
value = (String) moduleIdAsMap[i].get(qualifiedKey);
} else {
- value = (String) moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
+ value = (String) moduleIdAsMap[i].get(qualifiedKey
+ .substring(colonIndex + 1));
}
if (value != null) {
foundExtraAtts.put(qualifiedKey, value);
}
}
-
- ModuleRevisionId modRevId = ModuleRevisionId.newInstance(org, name, branch, rev, foundExtraAtts);
+
+ ModuleRevisionId modRevId = ModuleRevisionId.newInstance(org, name, branch, rev,
+ foundExtraAtts);
ret.add(resolver.getNamespace().getToSystemTransformer().transform(modRevId));
}
}
@@ -276,22 +278,25 @@ public class SearchEngine {
* <p>
* ModuleRevisionId are returned in the system namespace.
* </p>
- *
- * @param resolver the resolver in which modules should looked up
- * @param moduleCrit the criteria to match
- * @param matcher the matcher to use to match criteria
+ *
+ * @param resolver
+ * the resolver in which modules should looked up
+ * @param moduleCrit
+ * the criteria to match
+ * @param matcher
+ * the matcher to use to match criteria
* @return an array of matching module revision ids
*/
- public ModuleRevisionId[] listModules(
- DependencyResolver resolver, ModuleRevisionId moduleCrit, PatternMatcher matcher) {
+ public ModuleRevisionId[] listModules(DependencyResolver resolver, ModuleRevisionId moduleCrit,
+ PatternMatcher matcher) {
Map criteria = new HashMap();
for (Iterator it = moduleCrit.getAttributes().entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Entry) it.next();
addMatcher(matcher, (String) entry.getValue(), criteria, (String) entry.getKey());
}
-
- String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet().toArray(
- new String[moduleCrit.getAttributes().size()]);
+
+ String[] tokensToList = (String[]) moduleCrit.getAttributes().keySet()
+ .toArray(new String[moduleCrit.getAttributes().size()]);
Map[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
Set result = new LinkedHashSet(); // we use a Set to remove duplicates
@@ -300,7 +305,7 @@ public class SearchEngine {
String name = (String) moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
String branch = (String) moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
String rev = (String) moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
-
+
Map foundExtraAtts = new HashMap();
Set qualExtraAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
for (Iterator iter2 = qualExtraAttributes.iterator(); iter2.hasNext();) {
@@ -317,20 +322,21 @@ public class SearchEngine {
foundExtraAtts.put(qualifiedKey, value);
}
}
-
- ModuleRevisionId modRevId = ModuleRevisionId.newInstance(org, name, branch, rev, foundExtraAtts);
+
+ ModuleRevisionId modRevId = ModuleRevisionId.newInstance(org, name, branch, rev,
+ foundExtraAtts);
result.add(resolver.getNamespace().getToSystemTransformer().transform(modRevId));
}
-
+
return (ModuleRevisionId[]) result.toArray(new ModuleRevisionId[result.size()]);
}
-
- private void addMatcher(
- PatternMatcher patternMatcher, String expression, Map criteria, String key) {
+
+ private void addMatcher(PatternMatcher patternMatcher, String expression, Map criteria,
+ String key) {
if (expression == null) {
return;
}
-
+
Matcher matcher = patternMatcher.getMatcher(expression);
if (matcher.isExact()) {
criteria.put(key, expression);
@@ -338,7 +344,7 @@ public class SearchEngine {
criteria.put(key, matcher);
}
}
-
+
public Collection findModuleRevisionIds(DependencyResolver resolver, ModuleRevisionId pattern,
PatternMatcher matcher) {
Collection mrids = new ArrayList();
@@ -349,7 +355,7 @@ public class SearchEngine {
if (resolver instanceof AbstractResolver) {
fromNamespace = ((AbstractResolver) resolver).getNamespace();
}
-
+
Collection modules = new ArrayList();
OrganisationEntry[] orgs = resolver.listOrganisations();
@@ -361,16 +367,15 @@ public class SearchEngine {
org = NameSpaceHelper.transform(pattern.getModuleId(),
fromNamespace.getFromSystemTransformer()).getOrganisation();
}
- modules.addAll(Arrays
- .asList(resolver.listModules(new OrganisationEntry(resolver, org))));
+ modules.addAll(Arrays.asList(resolver.listModules(new OrganisationEntry(resolver, org))));
} else {
Matcher orgMatcher = matcher.getMatcher(pattern.getOrganisation());
for (int i = 0; i < orgs.length; i++) {
String org = orgs[i].getOrganisation();
String systemOrg = org;
if (fromNamespace != null) {
- systemOrg = NameSpaceHelper.transformOrganisation(org, fromNamespace
- .getToSystemTransformer());
+ systemOrg = NameSpaceHelper.transformOrganisation(org,
+ fromNamespace.getToSystemTransformer());
}
if (orgMatcher.matches(systemOrg)) {
modules.addAll(Arrays.asList(resolver.listModules(new OrganisationEntry(
@@ -387,8 +392,8 @@ public class SearchEngine {
ModuleId foundMid = new ModuleId(mEntry.getOrganisation(), mEntry.getModule());
ModuleId systemMid = foundMid;
if (fromNamespace != null) {
- systemMid = NameSpaceHelper.transform(foundMid, fromNamespace
- .getToSystemTransformer());
+ systemMid = NameSpaceHelper.transform(foundMid,
+ fromNamespace.getToSystemTransformer());
}
if (MatcherHelper.matches(matcher, pattern.getModuleId(), systemMid)) {
@@ -403,8 +408,8 @@ public class SearchEngine {
for (int j = 0; j < rEntries.length; j++) {
RevisionEntry rEntry = rEntries[j];
- ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(mEntry
- .getOrganisation(), mEntry.getModule(), rEntry.getRevision());
+ ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(
+ mEntry.getOrganisation(), mEntry.getModule(), rEntry.getRevision());
ModuleRevisionId systemMrid = foundMrid;
if (fromNamespace != null) {
systemMrid = fromNamespace.getToSystemTransformer().transform(foundMrid);