Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Explanation [ not issue ] #169

Open
leobenkel opened this issue Nov 14, 2018 · 2 comments
Open

Explanation [ not issue ] #169

leobenkel opened this issue Nov 14, 2018 · 2 comments

Comments

@leobenkel
Copy link

Hello,
Can anyone explain to me what

moduleGraphSbt :=
        ignoreMissingUpdate.value
          .configuration(configuration.value)
          .map(report ⇒ SbtUpdateReport.fromConfigurationReport(report, crossProjectId.value))
          .getOrElse(ModuleGraph.empty),

is doing ? Here: https://github.com/jrudolph/sbt-dependency-graph/blob/de4d508f4eaeae33f3a7343d8fc88c47efbeab1d/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala#L62-L63

I am trying to build my own sbt plugin to analyze dependencies and I am trying to reproduce the same graph of dependencies that you have. But I struggle with this step.

@jrudolph
Copy link
Member

Here are the steps:

  • ignoreMissingUpdate is very similar to the regular update step, it runs the ivy resolution and returns an UpdateReport
  • configuration(...) returns the result of the resolution for one ivy configuration (like compile, provided, runtime, or test) if it exists
  • SbtUpdateReport.fromConfigurationReport does the real work of converting the sbt ConfigurationReport into a ModuleGraph which is the sbt-dependency-graph data structure to represent the dependencies

See

https://github.com/jrudolph/sbt-dependency-graph/blob/de4d508f4eaeae33f3a7343d8fc88c47efbeab1d/src/main/scala/net/virtualvoid/sbt/graph/backend/SbtUpdateReport.scala#L30-L55

I'd recommend to use an IDEA like IntelliJ IDEA and use "jump to definition" (ctrl-click) to discover what code like this is doing.

@leobenkel
Copy link
Author

Thats what I was doing but didn't really know how SBT was working. Thank you so much for the explanation !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants