Add scope support for trusted checksums#1543
Merged
Merged
Conversation
Currently TC operated on all resolved artifacts, but this may not be what user wants. Add scope support with two values for now: "all" (as before, everything resolved is validated) or "project" (only project dependencies are validated).
| return artifactResult.isResolved(); | ||
| } else if (PROJECT_SCOPE.equals(scope)) { | ||
| return artifactResult.isResolved() | ||
| && artifactResult.getRequest().getRequestContext().startsWith("project"); |
Member
There was a problem hiding this comment.
Where request context is set ... or by who?
Are we sure that all project artifacts have such value?
What when some of resolving is triggered by plugin?
Member
Author
There was a problem hiding this comment.
Context is set by core:
- for projects https://github.com/apache/maven/blob/1f97959a11cc4277d42da08ff581cc061849cea8/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java#L95
- for plugins https://github.com/apache/maven/blob/1f97959a11cc4277d42da08ff581cc061849cea8/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java#L199
- for rest it is "free game" (usually people leave it alone), like ad hoc collect request from a plugin. For example in Toolbox I consistently use "toolbox": https://github.com/maveniverse/toolbox/blob/6442611992f83a85de5235616c38c05cb180ec8e/shared/src/main/java/eu/maveniverse/maven/toolbox/shared/internal/ToolboxResolverImpl.java#L509
Later on, kicks in the "context refiner":
All in all, only one thing is sure:
- core sets "project" and "plugin" context, and this is 100% true for project dependencies ("project"), and build plugins ("plugin"). Now, if anyone does ad-hoc collect request, that anyway out of scope.
Hence the "all" (as before, context is totally neglected) and "project" scopes, as that manages project dependencies (a plugin doing ad-hoc lookup is not project dependency).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently TC operated on all resolved artifacts, but this may not be what user wants. Add scope support with two values for now: "all" (as before, everything resolved is validated) or "project" (only project dependencies are validated).