Skip to content

Commit

Permalink
Merge pull request #328 from aloubyansky/filter-linked-deps
Browse files Browse the repository at this point in the history
Apply filtering to linked dependencies and enable tests classifier
  • Loading branch information
aloubyansky authored Mar 28, 2024
2 parents 4849d8e + bed2c46 commit 1527152
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ public static Builder builder() {
private final Path logOutputFile;
private final boolean appendOutput;

/*
* Whether to include test JARs
*/
private boolean includeTestJars;

private Function<ArtifactCoords, List<Dependency>> artifactConstraintsProvider;
private Set<ArtifactCoords> projectBomConstraints;
private final Map<ArtifactCoords, ResolvedDependency> allDepsToBuild = new HashMap<>();
Expand Down Expand Up @@ -1202,8 +1197,11 @@ private void processNodes(DependencyNode node, int level, boolean remaining) {
final DependencyNode winner = (DependencyNode) node.getData().get(ConflictResolver.NODE_DATA_WINNER);
if (winner != null) {
final ArtifactCoords coords = toCoords(winner.getArtifact());
for (DependencyTreeVisitor v : treeVisitors) {
v.linkDependency(coords);
// linked dependencies should also be checked for exclusions
if (!isExcluded(coords)) {
for (DependencyTreeVisitor v : treeVisitors) {
v.linkDependency(coords);
}
}
return;
}
Expand Down Expand Up @@ -1412,12 +1410,11 @@ private void addToRemaining(ArtifactCoords coords) {

private boolean isExcluded(ArtifactCoords coords) {
for (ArtifactCoordsPattern pattern : excludeSet) {
boolean matches = pattern.matches(coords);
if (matches) {
if (pattern.matches(coords)) {
return true;
}
}
return !includeTestJars && coords.getClassifier().equals("tests");
return false;
}

private boolean isIncluded(ArtifactCoords coords) {
Expand Down

0 comments on commit 1527152

Please sign in to comment.