Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'inputs' tool to print out all inputs for a set of targets #1730

Merged
merged 2 commits into from
Feb 2, 2022

Conversation

naarcini
Copy link

@naarcini naarcini commented Feb 3, 2020

Per discussion on ninja-build, this change introduces a ninja tool to enumerate all inputs for a set of targets:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/ninja-build/vPM6COsFslY

This works almost identically to the commands tool except that it gets the in_newline binding instead of evaluating a command.

@jonesmz

This comment was marked as abuse.

@naarcini
Copy link
Author

naarcini commented Feb 7, 2020

Is this substantially different than #1711 ? If so, could you document pros and cons?

Great question! The approach in that PR specifically tries to look for code files only. In my case, I look at all inputs that would be found via the commands tool. This'll include additional artifacts such as ".stamp" files.

For my change vs. the the one you mention:

Pros:

  • Less invasive. We never leave ninja.cc to introduce new hooks in other code. This mostly relies on existing code that figured out inputs already.
  • More complete. We're getting all inputs that the tooling found and will use to actually run a build. I've tested this in Chromium and I find I get more code files in my version.

Cons:

  • Potentially noisy if all someone wants are code files.

I can add this to the PR description if you'd like.

@spectras
Copy link

spectras commented Nov 1, 2020

Hello!
Is there any chance to see either this or #1711 merged at some point?

This feature is would make the life of monorepos much, much easier (each test job could query ninja and intersect its inputs with the list of changed files to know whether it can skip this run).

@jhasse jhasse added this to the 1.11.0 milestone Nov 23, 2020
@jhasse
Copy link
Collaborator

jhasse commented Nov 23, 2020

Yes. I'm preferring this over #1711 as it's less invasive.

@naarcini
Copy link
Author

naarcini commented Feb 9, 2021

Whoops, misclicked

@naarcini naarcini reopened this Feb 9, 2021
@jhasse jhasse merged commit f404f00 into ninja-build:master Feb 2, 2022
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 27, 2022
release 1.11

This release adds Validation Nodes which are a new way to add jobs like linters or static analyzers to the build graph. They are added using |@ and don't produce any outputs. You can read more about the motivation and the syntax here: ninja-build/ninja#1800

Another big change is that Ninja now uses UTF-8 on Windows. This means that while previous versions of Ninja used the local ANSI encoding it will now always use UTF-8 allowing filenames and output with special characters. For this to work you'll need Windows 10 Version 1903 or newer. And for the console output to show Unicode characters you'll need to set the codepage to 65001. More information at: ninja-build/ninja#1915

Note that this is a breaking change if you relied on non-ASCII characters of the local codepage! If you want to query Ninja what codepage it uses in your generator, call `ninja -t wincodepage` and act accordingly.

There are also two new tools:
missingdeps: ninja-build/ninja#1331
inputs: ninja-build/ninja#1730

And as it was often requested, ninja now has a --quiet flag :)

For a complete list of changes see https://github.com/ninja-build/ninja/milestone/3?closed=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants