-
Notifications
You must be signed in to change notification settings - Fork 14
Code changes for plugin dependencies include test scope
#1487
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -96,7 +96,7 @@ public static LockFile generateLockFileFromProject( | |||||||
| AbstractChecksumCalculator checksumCalculator, | ||||||||
| MetaData metadata) { | ||||||||
| PluginLogManager.getLog().info(String.format("Generating lock file for project %s", project.getArtifactId())); | ||||||||
| Set<MavenPlugin> plugins = new TreeSet<>(); | ||||||||
| Set<MavenPlugin> plugins = new TreeSet<>(Comparator.comparing(MavenPlugin::getChecksum)); | ||||||||
| if (metadata.getConfig().isIncludeMavenPlugins()) { | ||||||||
| plugins = getAllPlugins(project, session, dependencyCollectorBuilder, checksumCalculator); | ||||||||
| } | ||||||||
|
|
@@ -127,7 +127,7 @@ private static Set<MavenPlugin> getAllPlugins( | |||||||
| MavenSession session, | ||||||||
| DependencyCollectorBuilder dependencyCollectorBuilder, | ||||||||
| AbstractChecksumCalculator checksumCalculator) { | ||||||||
| Set<MavenPlugin> plugins = new TreeSet<>(); | ||||||||
| Set<MavenPlugin> plugins = new TreeSet<>(Comparator.comparing(MavenPlugin::getChecksum)); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto - is this required/necessary? |
||||||||
| for (Artifact pluginArtifact : project.getPluginArtifacts()) { | ||||||||
| RepositoryInformation repositoryInformation = checksumCalculator.getPluginResolvedField(pluginArtifact); | ||||||||
| Set<io.github.chains_project.maven_lockfile.graph.DependencyNode> pluginDependencies = | ||||||||
|
|
@@ -296,19 +296,15 @@ private static Set<io.github.chains_project.maven_lockfile.graph.DependencyNode> | |||||||
| MutableGraph<DependencyNode> graph = GraphBuilder.directed().build(); | ||||||||
| rootNode.accept(new GraphBuildingNodeVisitor(graph)); | ||||||||
|
|
||||||||
| PluginLogManager.getLog() | ||||||||
| .debug(String.format( | ||||||||
| "Built graph with %d nodes for plugin %s", | ||||||||
| PluginLogManager.getLog().debug(String.format("Built graph with %d nodes for plugin %s", | ||||||||
| graph.nodes().size(), pluginArtifact)); | ||||||||
|
|
||||||||
| DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator, false); | ||||||||
|
|
||||||||
| // Ignore test-scoped dependencies for plugins | ||||||||
| DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator,false, true); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth adding a comment here that we are excluding test scope.
Suggested change
|
||||||||
| // Get root dependency nodes (excluding the plugin project itself) | ||||||||
| Set<io.github.chains_project.maven_lockfile.graph.DependencyNode> roots = dependencyGraph.getRoots(); | ||||||||
| PluginLogManager.getLog() | ||||||||
| .info(String.format("Resolved %4d dependencies for plugin %s", roots.size(), pluginArtifact)); | ||||||||
| return roots; | ||||||||
|
|
||||||||
| } catch (Exception e) { | ||||||||
| PluginLogManager.getLog() | ||||||||
| .warn(String.format("Could not resolve dependencies for plugin %s", pluginArtifact), e); | ||||||||
|
|
@@ -335,10 +331,10 @@ private static DependencyGraph graph( | |||||||
| .info(String.format( | ||||||||
| "Resolved %4d dependencies for project %s", | ||||||||
| graph.nodes().size(), project)); | ||||||||
| return DependencyGraph.of(graph, checksumCalculator, reduced); | ||||||||
| return DependencyGraph.of(graph, checksumCalculator, reduced,false); | ||||||||
| } catch (Exception e) { | ||||||||
| PluginLogManager.getLog().warn("Could not generate graph", e); | ||||||||
| return DependencyGraph.of(GraphBuilder.directed().build(), checksumCalculator, reduced); | ||||||||
| return DependencyGraph.of(GraphBuilder.directed().build(), checksumCalculator, reduced,false); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
|
|
@@ -364,10 +360,10 @@ private static Pom constructRecursivePom( | |||||||
| String relativePath = project.getFile() == null | ||||||||
| ? null | ||||||||
| : initialProject | ||||||||
| .getBasedir() | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary formatting change, please revert. |
||||||||
| .toPath() | ||||||||
| .relativize(project.getFile().toPath()) | ||||||||
| .toString(); | ||||||||
| .getBasedir() | ||||||||
| .toPath() | ||||||||
| .relativize(project.getFile().toPath()) | ||||||||
| .toString(); | ||||||||
| String checksum = null; | ||||||||
| ResolvedUrl resolved = null; | ||||||||
| RepositoryId repoId = null; | ||||||||
|
|
@@ -404,4 +400,4 @@ private static Pom constructRecursivePom( | |||||||
|
|
||||||||
| return lastPom; | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required/necessary?