Skip to content

Feature Request: Include inputs from depfile in ninja -t inputs #2618

@hehaoqian

Description

@hehaoqian

Background

The inputs from depfile is missing from stdout of ninja -t inputs

I propose to add --depfile option to ninja -t inputs,
in order to add inputs contained in depfile

How is this useful?

With this feature, I can generate a depfile for any target of ninja sub project,
that includes all inputs of the target, using the stdout of ninja -t inputs.

This new generated depfile can be used by ninja of an external project,
to relative precisely determine if the target of ninja sub project needs to be rebuilt.

This is useful for CMake project that uses CMake API ExternalProject_Add

Error handling

This feature should be used after the target has been built, so depfile is up-to-date.
But I am not sure what to do if depfile is missing. Should it be ignore or raise an error,
or add other options to differ two behaviors.

Implementation

The implementation is relatively simple that I have implemented a demo in my local machine.
Construct a ImplicitDepLoader and call ImplicitDepLoader::LoadDeps in InputsCollector::VisitNode

I can submit a Pull Request later, if this idea of feature request is accepted by the maintainer.

Remaining issues

I am not sure how to handle "Dynamic Dependencies" feature of ninja build,
because I have never used this feature.
My currently thought is that this feature only focus on "depfile"
"Dynamic Dependencies" is not considered.

Alternatives

Instead of providing argument --depfile,
ninja -t inputs always contains inputs from depfile, if depfile exists

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