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

depfile,dyndep: reconcile relative and absolute paths with build manifest #1925

Closed

Conversation

bradking
Copy link
Contributor

@bradking bradking commented Mar 9, 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 8 commits March 9, 2021 12:16
Previously this was covered only as part of more complex tests.
Convert a working directory path to forward slashes, with a trailing
slash.
Compute it from `getcwd`.  Save it with a trailing slash for later use.
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
Copy link
Contributor Author

bradking commented Mar 9, 2021

This version differs from #1924 in that it does not add the ninja_workdir binding and relies only on getcwd to recover the prefix for relative paths in build.ninja. This is a bit less powerful for generators that want to support certain combinations involving symbolic links, but solves #1251 without introducing any new interfaces.

@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
1 participant