Deduplicate filtered dependency graph #2489
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2487
Adds logic to de-duplicate the list of
MavenProject
s being returned byFilteredProjectDependencyGraph.applyFilter
to prevent building the same project multiple times in a parallel, multi-module build.A lengthy comment is added to the main change explaining a situation where the same project could be added multiple times, which I'll repeat here.
Given the following, simplified, aggregate POM where project E has a direct dependency on all of A, B, C, and D.
If a parallel build was using
--pl A,C,E
ifFilteredProjectDependencyGraph.applyFilter
was called with the aggregate POM'sMavenProject
s (A, B, C, D, and E) and non-transitive and downstream dependencies were being filtered for, the following would happen.filtered
result as they're in the whitelist.This would result in project E being added to
filtered
three separate times. Once for being in the whitelist itself and twice more for being a downstream project of two projects not in the whitelist.I also added a small bit of logic to short circuit being distincting
filtered
when it would effectively be a wasted no-op, when there is zero or one project in the list.Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verify
to make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.