Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #15 from prudhvi/prudhvi/deps_unique
Avoid duplicate dependencies in WORKSPACE
  • Loading branch information
pgr0ss committed Nov 20, 2017
2 parents 7682b3d + 6c8e193 commit 2516043
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/braintree/BazelDeps.java
Expand Up @@ -11,6 +11,7 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;

import java.util.stream.Collectors;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.DependencyCollectionException;
Expand Down Expand Up @@ -75,9 +76,11 @@ private void printWorkspace(Map<Artifact, Set<Artifact>> dependencies,
if(repository != null){
System.out.format("maven_server(name = \"default\", url = \"%s\")\n", repository);
}
dependencies.values().stream()
Set<Artifact> uniqueDependencies = dependencies.values().stream()
.flatMap(Collection::stream)
.filter(artifact -> !excludeDependencies.contains(artifact))
.collect(Collectors.toSet());

Sets.difference(uniqueDependencies, excludeDependencies).stream()
.sorted(Comparator.comparing(Artifact::getArtifactId))
.forEach(artifact -> {
System.out.format("maven_jar(name = \"%s\", artifact = \"%s\")\n", artifactName(artifact),
Expand Down

0 comments on commit 2516043

Please sign in to comment.