Skip to content

Add support for ignored dependencies #51

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

Closed
wants to merge 5 commits into from

Conversation

ybasket
Copy link

@ybasket ybasket commented Aug 9, 2022

A WIP for tackling #49 by allowing users to filter certain dependencies like scala3doc. Doesn't work yet as passing of the argument isn't implemented in a sot-compatible way.

@@ -106,6 +106,7 @@ object GithubDependencyGraphPlugin extends AutoPlugin {
val scalaBinaryVersion = (Keys.artifactName / Keys.scalaBinaryVersion).value
val crossVersion = CrossVersion.apply(scalaVersion, scalaBinaryVersion)
val allDirectDependencies = Keys.allDependencies.value
val ignoredDependencies = Keys.state.value.attributes(githubSubmitInputKey).ignoredDependencies
Copy link
Member

@adpi2 adpi2 Aug 9, 2022

Choose a reason for hiding this comment

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

The githubSubmitInputKey attribute is set by the githubSubmitDependencyGraph command here.

I suggest to add a default value, for the task not to fail if the attribute is missing:

Suggested change
val ignoredDependencies = Keys.state.value.attributes(githubSubmitInputKey).ignoredDependencies
val ignoredDependencies = Keys.state.value.attributes.get(githubSubmitInputKey).toSeq.flatMap(_.ignoredDependencies)

@@ -137,7 +145,7 @@ object GithubDependencyGraphPlugin extends AutoPlugin {
configReport <- report.configurations
moduleReport <- configReport.modules
moduleRef = getReference(moduleReport.module)
if !moduleReport.evicted && !alreadySeen.contains(moduleRef)
if !moduleReport.evicted && !alreadySeen.contains(moduleRef) && !isIgnored(moduleReport.module)
Copy link
Member

Choose a reason for hiding this comment

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

This will filter out the library but not its transitive dependencies. Maybe I am wrong but I think it would be quite hard to filter out all transitive dependencies of a library. To do so we would need to build the entire tree of parents and check that all roots are ignored. Unfortunately, in a module report we only have one level of parents: moduleReport.callers.

What about filtering out entire configs rather than dependencies? That would be easier to implement.

@ybasket ybasket closed this Jan 13, 2023
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.

2 participants