Skip to content

give a better error for "multiple rules generate <file>" #2659

@jyn514

Description

@jyn514

right now, if there are two duplicate rules in a build.ninja file, ninja prints the following:

ninja: error: build.ninja:238: multiple rules generate .build/talks/python.rendered.html

ideally it would give more context: which rules? what are their inputs? i can't figure either out easily because -t inputs and -t query don't work when ninja can't parse the depfile.

ideally i would love an error message like this:

ninja: error: build.ninja:238: multiple rules generate .build/talks/python.rendered.html
  build.ninja:237: build .build/talks/python.rendered.html: markdown .build/talks/python.rendered.md
      build.ninja:236: build .build/talks/python.rendered.md: page .build/talks/python.md.json
        build.ninja:235: build .build/talks/python.md.json: frontmatter pages/talks/python.md
  build.ninja:98: build .build/talks/python.rendered.html: page .build/talks/python.html.json
      build.ninja:97: build .build/talks/python.html.json: frontmatter pages/talks/python.html

(note that this omits implicit and order-only dependencies).

if that's too expensive to store all the data for in a first run, maybe it could be hidden behind --verbose, and have the error suggest using verbose for more info?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions