Skip to content

Commit

Permalink
Merge pull request #12 from HubSpot/js/fix-test-only-usage
Browse files Browse the repository at this point in the history
Js/fix test only usage
  • Loading branch information
jaredstehler authored Sep 28, 2023
2 parents 371a8d1 + 0daff1f commit 950c52a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.stream.Collectors;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -184,7 +185,10 @@ protected Map<Artifact, Set<String>> buildArtifactClassMap(MavenProject project)
private static Set<DependencyUsage> buildTestOnlyDependencyClasses(
Set<DependencyUsage> mainDependencyClasses, Set<DependencyUsage> testDependencyClasses) {
Set<DependencyUsage> testOnlyDependencyClasses = new HashSet<>(testDependencyClasses);
testOnlyDependencyClasses.removeAll(mainDependencyClasses);
Set<String> mainDepClassNames = mainDependencyClasses.stream()
.map(DependencyUsage::getDependencyClass)
.collect(Collectors.toSet());
testOnlyDependencyClasses.removeIf(u -> mainDepClassNames.contains(u.getDependencyClass()));
return testOnlyDependencyClasses;
}

Expand Down

0 comments on commit 950c52a

Please sign in to comment.