maven-resolver git commit: [MRESOLVER-8] Direct dependencies incorrectly detected as transitive.
Repository: maven-resolver Updated Branches: refs/heads/master 3fb6ed988 -> 5907bd446 [MRESOLVER-8] Direct dependencies incorrectly detected as transitive. Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/5907bd44 Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/5907bd44 Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/5907bd44 Branch: refs/heads/master Commit: 5907bd44682925d8ea795fcb63c39d268157a632 Parents: 3fb6ed9 Author: Christian Schulte Authored: Mon Nov 14 01:23:03 2016 +0100 Committer: Christian Schulte Committed: Mon Nov 14 01:23:23 2016 +0100 -- .../DefaultDependencyCollectionContext.java | 23 - .../impl/DefaultDependencyCollector.java| 2 +- .../impl/DefaultDependencyCollectorTest.java| 101 --- .../selection/optional/all-nodes.txt| 3 + .../optional/gid_direct-of-root_ver.ini | 2 - .../selection/optional/gid_direct_ver.ini | 2 + .../selection/optional/gid_root_ver.ini | 2 - .../optional/gid_transitive-of-direct_ver.ini | 2 + .../optional/gid_transitive-of-root_ver.ini | 1 - ...d_transitive-of-transitive-of-direct_ver.ini | 1 + .../selection/optional/no-selector-tree.txt | 3 - .../optional/optional-exclusion-tree.txt| 2 - ...al-transitive-nodes-of-direct-dependency.txt | 1 + ...without-optional-transitive-nodes-of-pom.txt | 2 + .../selection/scope/all-nodes-of-pom.txt| 5 + .../selection/scope/all-nodes.txt | 8 +- .../selection/scope/gid_direct-of-root_ver.ini | 2 - .../selection/scope/gid_direct_ver.ini | 2 + .../selection/scope/gid_root_ver.ini| 2 - .../scope/gid_transitive-of-direct_ver.ini | 2 + .../scope/gid_transitive-of-root_ver.ini| 2 - ...d_transitive-of-transitive-of-direct_ver.ini | 2 + ...gid_transitive-of-transitive-of-root_ver.ini | 1 - ...f-transitive-of-transitive-of-direct_ver.ini | 1 + ...ransitive-of-direct-scope-exclusion-tree.txt | 1 + .../transitive-of-root-scope-exclusion-tree.txt | 2 - ...ransitive-of-direct-scope-exclusion-tree.txt | 2 + ...ive-of-transitive-of-root-exclusion-tree.txt | 3 - ...ransitive-of-direct-scope-exclusion-tree.txt | 3 + .../selector/OptionalDependencySelector.java| 31 +++--- .../graph/selector/ScopeDependencySelector.java | 31 +++--- 31 files changed, 182 insertions(+), 65 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/5907bd44/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java -- diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java index 1ad6cc7..e8dd829 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java @@ -19,6 +19,7 @@ package org.eclipse.aether.internal.impl; * under the License. */ +import java.util.ArrayList; import java.util.List; import org.eclipse.aether.RepositorySystemSession; @@ -30,7 +31,7 @@ import org.eclipse.aether.graph.Dependency; * @see DefaultDependencyCollector */ final class DefaultDependencyCollectionContext -implements DependencyCollectionContext +implements DependencyCollectionContext, Cloneable { private final RepositorySystemSession session; @@ -83,4 +84,24 @@ final class DefaultDependencyCollectionContext return String.valueOf( getDependency() ); } +/** + * @since 1.2.0 + */ +@Override +public DefaultDependencyCollectionContext clone() +{ +try +{ +final DefaultDependencyCollectionContext clone = (DefaultDependencyCollectionContext) super.clone(); +clone.managedDependencies = clone.managedDependencies != null +? new ArrayList<>( clone.managedDependencies ) +: null; + +return clone; +} +catch ( final CloneNotSupportedException e ) +{ +throw new AssertionError( e ); +} +} } http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/5907bd44/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java -- diff --git a/maven-resolver-impl/src/main/java/org/eclipse
maven-resolver git commit: [MRESOLVER-8] Direct dependencies incorrectly detected as transitive.
Repository: maven-resolver Updated Branches: refs/heads/master 5907bd446 -> e391a27ab [MRESOLVER-8] Direct dependencies incorrectly detected as transitive. o For the impatient: Look at those 'deriveChildXyz' methods how they never decrease the depth value and always increase that value by one although during recursion depth needs to be decreased. All those components, once switched to 'transitive' mode, never will get switched back to 'direct' mode. Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/e391a27a Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/e391a27a Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/e391a27a Branch: refs/heads/master Commit: e391a27ab3609fc63a625bbe3a25401af6ec02ef Parents: 5907bd4 Author: Christian Schulte Authored: Mon Nov 14 01:37:36 2016 +0100 Committer: Christian Schulte Committed: Mon Nov 14 01:40:15 2016 +0100 -- .../aether/internal/impl/DefaultDependencyCollector.java | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/e391a27a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java -- diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java index 4357f9c..e38cf63 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java @@ -476,8 +476,10 @@ public class DefaultDependencyCollector DependencyTraverser depTraverser, VersionFilter verFilter, Dependency d, ArtifactDescriptorResult descriptorResult, DefaultDependencyNode child ) { -DefaultDependencyCollectionContext context = args.collectionContext.clone(); -context.set( d, descriptorResult.getManagedDependencies() ); +final DefaultDependencyCollectionContext savedContext = args.collectionContext; +args.collectionContext = args.collectionContext.clone(); +args.collectionContext.set( d, descriptorResult.getManagedDependencies() ); +DefaultDependencyCollectionContext context = args.collectionContext; DependencySelector childSelector = depSelector != null ? depSelector.deriveChildSelector( context ) : null; DependencyManager childManager = depManager != null ? depManager.deriveChildManager( context ) : null; @@ -508,6 +510,8 @@ public class DefaultDependencyCollector { child.setChildren( children ); } + +args.collectionContext = savedContext; } private ArtifactDescriptorResult getArtifactDescriptorResult( Args args, Results results, boolean noDescriptor, @@ -696,7 +700,7 @@ public class DefaultDependencyCollector final NodeStack nodes; -final DefaultDependencyCollectionContext collectionContext; +DefaultDependencyCollectionContext collectionContext; final DefaultVersionFilterContext versionContext;
maven-resolver git commit: [MRESOLVER-8] Direct dependencies incorrectly detected as transitive.
Repository: maven-resolver Updated Branches: refs/heads/master bec698b6d -> 7d270dae8 [MRESOLVER-8] Direct dependencies incorrectly detected as transitive. This reverts commit e391a27ab3609fc63a625bbe3a25401af6ec02ef and commit 5907bd44682925d8ea795fcb63c39d268157a632 partially. 'ScopeDependencySelector' is behaving the same way it did in pre 1.2.0 again. That's been the issue introduced by me months ago. Project: http://git-wip-us.apache.org/repos/asf/maven-resolver/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-resolver/commit/7d270dae Tree: http://git-wip-us.apache.org/repos/asf/maven-resolver/tree/7d270dae Diff: http://git-wip-us.apache.org/repos/asf/maven-resolver/diff/7d270dae Branch: refs/heads/master Commit: 7d270dae8f72d14376fffd46652a629e2446ae0e Parents: bec698b Author: Christian Schulte Authored: Mon Nov 14 02:37:48 2016 +0100 Committer: Christian Schulte Committed: Mon Nov 14 02:44:28 2016 +0100 -- .../DefaultDependencyCollectionContext.java | 23 +--- .../impl/DefaultDependencyCollector.java| 8 ++- 2 files changed, 3 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/7d270dae/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java -- diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java index e8dd829..1ad6cc7 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollectionContext.java @@ -19,7 +19,6 @@ package org.eclipse.aether.internal.impl; * under the License. */ -import java.util.ArrayList; import java.util.List; import org.eclipse.aether.RepositorySystemSession; @@ -31,7 +30,7 @@ import org.eclipse.aether.graph.Dependency; * @see DefaultDependencyCollector */ final class DefaultDependencyCollectionContext -implements DependencyCollectionContext, Cloneable +implements DependencyCollectionContext { private final RepositorySystemSession session; @@ -84,24 +83,4 @@ final class DefaultDependencyCollectionContext return String.valueOf( getDependency() ); } -/** - * @since 1.2.0 - */ -@Override -public DefaultDependencyCollectionContext clone() -{ -try -{ -final DefaultDependencyCollectionContext clone = (DefaultDependencyCollectionContext) super.clone(); -clone.managedDependencies = clone.managedDependencies != null -? new ArrayList<>( clone.managedDependencies ) -: null; - -return clone; -} -catch ( final CloneNotSupportedException e ) -{ -throw new AssertionError( e ); -} -} } http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/7d270dae/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java -- diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java index c68eb86..2d76f92 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDependencyCollector.java @@ -476,10 +476,8 @@ public class DefaultDependencyCollector DependencyTraverser depTraverser, VersionFilter verFilter, Dependency d, ArtifactDescriptorResult descriptorResult, DefaultDependencyNode child ) { -final DefaultDependencyCollectionContext savedContext = args.collectionContext; -args.collectionContext = args.collectionContext.clone(); -args.collectionContext.set( d, descriptorResult.getManagedDependencies() ); DefaultDependencyCollectionContext context = args.collectionContext; +context.set( d, descriptorResult.getManagedDependencies() ); DependencySelector childSelector = depSelector != null ? depSelector.deriveChildSelector( context ) : null; DependencyManager childManager = depManager != null ? depManager.deriveChildManager( context ) : null; @@ -510,8 +508,6 @@ public class DefaultDependencyCollector { child.setChildren( children );