Skip to content

Commit

Permalink
Use a linked hash set for dependency artifacts
Browse files Browse the repository at this point in the history
The order can make a difference in repository selection, when
checking if an artifact-only-component containing the artifacts
exists in a repository. In absence of a metadata file, we initially test
for the existence of one artifact to decide if a repository contains
the corresponding artifact-only-component. This is always the first
artifact in the set (which is internally converted into a list).
This change makes sure that the first artifact is always the same
for a build that does not change.
  • Loading branch information
jjohannes committed Oct 11, 2019
1 parent b2860f1 commit 2224adc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -48,7 +48,7 @@ public abstract class AbstractModuleDependency extends AbstractDependency implem
private ImmutableAttributesFactory attributesFactory;
private NotationParser<Object, Capability> capabilityNotationParser;
private DefaultExcludeRuleContainer excludeRuleContainer = new DefaultExcludeRuleContainer();
private Set<DependencyArtifact> artifacts = new HashSet<DependencyArtifact>();
private Set<DependencyArtifact> artifacts = new LinkedHashSet<>();
private ImmutableActionSet<ModuleDependency> onMutate = ImmutableActionSet.empty();
private AttributeContainerInternal attributes;
private ModuleDependencyCapabilitiesInternal moduleDependencyCapabilities;
Expand Down Expand Up @@ -132,7 +132,7 @@ public DependencyArtifact artifact(Action<? super DependencyArtifact> configureA

protected void copyTo(AbstractModuleDependency target) {
super.copyTo(target);
target.setArtifacts(new HashSet<DependencyArtifact>(getArtifacts()));
target.setArtifacts(new LinkedHashSet<>(getArtifacts()));
target.setExcludeRuleContainer(new DefaultExcludeRuleContainer(getExcludeRules()));
target.setTransitive(isTransitive());
if (attributes != null) {
Expand Down

0 comments on commit 2224adc

Please sign in to comment.