Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven: Switch to the dependency graph format #3894

Conversation

oheger-bosch
Copy link
Member

This PR is related to #3825. It converts the package manager implementation for Maven to the dependency graph format.

@oheger-bosch oheger-bosch force-pushed the oheger-bosch/analyzer/maven_dependency_graph branch from 28eeb67 to 330edf2 Compare April 16, 2021 07:10
@oheger-bosch oheger-bosch marked this pull request as ready for review April 16, 2021 11:16
@oheger-bosch oheger-bosch requested a review from a team as a code owner April 16, 2021 11:16
analyzer/src/main/kotlin/managers/Maven.kt Outdated Show resolved Hide resolved
else PackageLinkage.DYNAMIC

override fun createPackage(
identifier: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this commit, but what was the reason to use String instead of Identifier in the DependencyHandler?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I am not entirely sure any more. IIRC, in the original implementation there was no direct 1:1 match between this identifier string and an Identifier, but this is now indeed the case. There is at least the advantage that the serialization of a plain string takes less space than an Identifier object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, are you planning to change this in this commit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this change would affect other functions of the DependencyHandler interface and the DependencyGraphBuilder class as well, I would rather think some more about it and do it in a separate PR - if at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat related: #4030

@oheger-bosch
Copy link
Member Author

@mnonnenmacher Thanks for the review, I am going to address the points. Just FYI, as discussed in #3825, these changes do not yet have the desired effect to reduce the size of analyzer results. I am therefore working on an approach to share a dependency graph over multiple projects. If this is successful, I would rather base the rework of Maven on this new approach.

@oheger-bosch oheger-bosch marked this pull request as draft April 22, 2021 11:24
@oheger-bosch
Copy link
Member Author

Switched again to draft status to rebase this on the changes introduced in #3913.

@oheger-bosch oheger-bosch force-pushed the oheger-bosch/analyzer/maven_dependency_graph branch 5 times, most recently from 33bb315 to a22d837 Compare April 28, 2021 06:28
@oheger-bosch oheger-bosch force-pushed the oheger-bosch/analyzer/maven_dependency_graph branch from a22d837 to 1926422 Compare May 14, 2021 09:20
@oheger-bosch oheger-bosch marked this pull request as ready for review May 14, 2021 10:00
else PackageLinkage.DYNAMIC

override fun createPackage(
identifier: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, are you planning to change this in this commit?

analyzer/src/funTest/kotlin/managers/Extensions.kt Outdated Show resolved Hide resolved
analyzer/src/funTest/kotlin/managers/Extensions.kt Outdated Show resolved Hide resolved
analyzer/src/funTest/kotlin/managers/Extensions.kt Outdated Show resolved Hide resolved
This is an implementation of the DependencyHandler interface for the
dependency model of Maven. It is going to be used by the Maven package
manager to produce results in the optimized DependencyGraph format.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
The ProjectAnalyzerResult returned by the function contained all the
packages found by the analyzer. This is not necessarily correct for
multi-project builds where different projects can have different
dependencies. Fix this issue by filtering the set of packages for the
ones that are actually dependencies of the project.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
@oheger-bosch oheger-bosch force-pushed the oheger-bosch/analyzer/maven_dependency_graph branch from 1926422 to 8bb92f9 Compare May 14, 2021 12:13
Rework the implementation to use DependencyGraphBuilder together with
MavenDependencyHandler to produce the analyzer result.

Adapt test classes as necessary. Rather than changing the expected
test results, convert results to the classic format before they are
compared with the expectations. This check is safer, as it makes sure
that the content of the results has not changed, although they are now
written in a different format. Add a helper function for this
conversion to the test-utils module.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
@oheger-bosch oheger-bosch force-pushed the oheger-bosch/analyzer/maven_dependency_graph branch from 8bb92f9 to 93e59f9 Compare May 17, 2021 05:29
@sschuberth sschuberth dismissed mnonnenmacher’s stale review May 17, 2021 05:38

Comments addressed.

@sschuberth sschuberth enabled auto-merge (rebase) May 17, 2021 05:38
@sschuberth sschuberth merged commit 9187688 into oss-review-toolkit:master May 17, 2021
@sschuberth sschuberth deleted the oheger-bosch/analyzer/maven_dependency_graph branch May 17, 2021 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants