-
Notifications
You must be signed in to change notification settings - Fork 21
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
val baseDirectory = Keys.baseDirectory.value | ||
val logger = Keys.streams.value.log | ||
val onResolveFailure = Keys.state.value.get(githubSubmitInputKey).flatMap(_.onResolveFailure) | ||
|
@@ -116,6 +117,13 @@ object GithubDependencyGraphPlugin extends AutoPlugin { | |
.withExtraAttributes(Map.empty) | ||
.toString | ||
|
||
def isIgnored(module: ModuleID): Boolean = | ||
ignoredDependencies.exists { ignored => | ||
ignored.organization == module.organization && | ||
ignored.name.forall(_ == module.name) && | ||
ignored.revision.forall(_ == module.revision) | ||
} | ||
|
||
reportResult match { | ||
case Inc(cause) => | ||
val moduleName = crossVersion(projectID).name | ||
|
@@ -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) | ||
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. 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: What about filtering out entire configs rather than dependencies? That would be easier to implement. |
||
} { | ||
alreadySeen += moduleRef | ||
moduleReports += (moduleReport -> configReport.configuration) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
> 'githubSubmitDependencyGraph {}' | ||
> Global / checkManifests 4 | ||
> Global / checkManifests 4 true | ||
|
||
> 'githubSubmitDependencyGraph {"ignoredModules":["a_2.13", "b_2.13"]}' | ||
> Global / checkManifests 2 | ||
> Global / checkManifests 2 true | ||
|
||
> 'githubSubmitDependencyGraph {"ignoredModules":["a_2.12", "a_2.13", "b_2.13"]}' | ||
> Global / checkManifests 1 | ||
> Global / checkManifests 1 true | ||
|
||
> 'githubSubmitDependencyGraph {"ignoredModules":[]}' | ||
> Global / checkManifests 4 | ||
> Global / checkManifests 4 true | ||
|
||
> 'githubSubmitDependencyGraph {"ignoredDependencies":[{"organization":"org.scala-lang", "name": "scala-library"}]}' | ||
> Global / checkManifests 4 false |
Uh oh!
There was an error while loading. Please reload this page.
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.
The
githubSubmitInputKey
attribute is set by thegithubSubmitDependencyGraph
command here.I suggest to add a default value, for the task not to fail if the attribute is missing: