Opened 4 years ago

Last modified 4 years ago

#10741 new feature request

add flag to dump module and package dependencies

Reported by: elaforge Owned by:
Priority: normal Milestone:
Component: Compiler Version:
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


You can already dump module and package dependencies with -M -include-pkg-deps, but it wants to modify a Makefile, so it's not so convenient for things that are not make. For other build systems, it would be convenient to get this on stdout in an easily parseable form. Say X/A.hs imports Y/B.hs, which imports Z/C.hs, and they all use package 'base' and 'containers':

% ghc -Mstdout X/A.hs

base containers

I don't know about what the output format should be, but assuming no newlines in filenames, and package names never have spaces, it seems simplest to do something like:

[src ++ "\n" ++ dest ++ "\n" | (src, dest) <- moduleDeps] ++ "\n" ++ unwords packageDeps

It could use haskell syntax like --info, but then you'd need a full haskell parser just to read it, which is not a problem for shake, but probably inconvenient for other build systems.

Change History (1)

comment:1 Changed 4 years ago by thomie

You could write your own Frontend plugin for this:

Note: See TracTickets for help on using tickets.