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

ninja_workdir: reconcile relative and absolute paths in depfile,dyndep files with build manifest #1924

Closed
wants to merge 11 commits into from

Conversation

bradking
Copy link
Contributor

@bradking bradking commented Mar 5, 2021

A depfile (or dyndep file) may contain relative and/or absolute paths based on compiler
behavior and the include directory flags given. It is not always
possible to make these exactly match corresponding paths in the build
manifest. If Ninja does not find an exact match for a depfile path, try
converting it to the opposite kind of path (absolute or relative) and
look again. If neither matches, add a node with the path as-is.

Fixes: #1251

bradking added 9 commits March 4, 2021 12:51
Convert a working directory path to forward slashes, with a trailing
slash.
This will allow per-parser behavior after loading.
Top-level bindings in the build manifest allow generators to give ninja
information that is not tied to a specific rule or build statement.  We
already have a two top-level bindings with dedicated implementations:

* builddir: used by NinjaMain
* ninja_required_version: checked directly by parser

Add infrastructure to allow the manifest parser itself to check more
top-level bindings at the end of parsing.
Add a binding that the build manifest generator can use to tell ninja
the working directory to use for the build.  This allows a command like
`ninja -f /path/to/some/build.ninja` to work, regardless of the caller's
working directory, if `build.ninja` has the binding.
Previously this was covered only as part of more complex tests.
@bradking
Copy link
Contributor Author

bradking commented Mar 5, 2021

Based on #1917.

doc/manual.asciidoc Outdated Show resolved Hide resolved
bradking added 2 commits March 8, 2021 09:43
A depfile may contain relative and/or absolute paths based on compiler
behavior and the include directory flags given.  It is not always
possible to make these exactly match corresponding paths in the build
manifest.  If Ninja does not find an exact match for a depfile path, try
converting it to the opposite kind of path (absolute or relative) and
look again.  If neither matches, add a node with the path as-is.

Issue: ninja-build#1251
A dyndep file may contain relative and/or absolute paths generated by
external tooling just as a depfile might.  Apply the same lookup rules
we use for depfile paths to dyndep file paths too.

Fixes: ninja-build#1251
@bradking bradking force-pushed the depfile-path-matching branch from c01bd4e to 78068ee Compare March 8, 2021 14:44
@bradking bradking changed the title depfile,dyndep: reconcile relative and absolute paths with build manifest ninja_workdir: reconcile relative and absolute paths in depfile,dyndep files with build manifest Mar 9, 2021
@bradking
Copy link
Contributor Author

bradking commented Jun 2, 2021

Closing for now. I have some ideas on a more general solution.

@bradking bradking closed this Jun 2, 2021
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.

mixing depfile absolute paths with manifest relative paths breaks rebuilds
2 participants