Skip to content

Structured dependency graph output #853

@georgefst

Description

@georgefst

I'm trying to use Shake alongside ghcid/ghciwatch for a form of live reloading. One thing I need is to get the set of "input files", i.e. leaf nodes which are files (and not oracles, calls to getDirectoryFiles etc.). My current solution for this is a hack:

runghc Build.hs --no-build --profile=/tmp/shake-report.json
jq -r 'map(select(length <= 4) | .[0] | select(contains(" ") | not))[]' /tmp/shake-report.json

The length <= 4 part for selecting leaves is correct but obscure and potentially fragile, and using contains(" ") | not to identify file names is obviously rubbish. As far as I can tell there's currently no more principled way to achieve this? It doesn't help that the semantics of the JSON output appear to be undocumented.

Also, @ndmitchell once mentioned in a StackOverflow answer, that adding GraphViz support "should be quite easy", but that the output would be "too large to be practically viewed". For what it's worth, I don't really agree on the latter point: I think Shake can be a good fit for pretty small projects, and anyway sophisticated interactive graph viewers seemingly all accept graphviz files as inputs. Plus, there are some cool command-line analysis tools for graphviz, such as gvpr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions