Find which module imported another module
Asked Answered
D

2

5

I need to find out why some module gets included into compilation.

There is some class that should not be included and I think there are some unused imports or bad architecture that requires unnecessary imports. Is there a way to find which modules import some module, which modules import these modules that include this module, and so on, tracking that down to main class of application?

Decumbent answered 9/11, 2018 at 11:34 Comment(0)
J
6

You could use -D dump-dependencies for this, in which case the compiler will generate two files that can be used to follow the dependency graph in both directions:

  • dump/<target>/.dependants.dump
  • dump/<target>/.dependencies.dump

There is also a handy online tool created by Mark Knol that helps a lot with analyzing these files. To answer the question "what does Array depend on?", you can just upload the two files and enter "array" into the search field:

Conveniently, the results are also clickable.

Jolandajolanta answered 9/11, 2018 at 11:54 Comment(0)
D
1

I've just came up with very simple idea: just delete this file and there will be compilation errors in places where this module is imported.

Decumbent answered 9/11, 2018 at 15:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.