Support --symlink-prefix #259
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adjusting the symlink prefix is useful both for organisation (putting in a subdirectory) as well as performance in some IDEs. This is an experimental feature that uses a thorough regex search and replace on each compiler parameter to update paths matching the symlink prefix.
This applies to the commands before they go through the compiler stages, hence everything else in the script including caching etc works seamlessly. There are minor changes to the automated symlink creation and detection function.
Regex Assumptions:
bazel-out
andexternal
are the only simlinks used in compile_commands.json"bazel-out/..
"-Ibazel-out/...
etc) or after an argument's = in a string (ie-frandom-seed=bazel-out/...
)-I
), it will always begin with at least one - or / (MSVC) and be followed by only alphanumeric characters,-
and_
up until thebazel-out/
orexternal/
sectionFull Regex for testing: ^(?P(?:[-/][a-zA-Z0-9-_]+)?=?)(?Pbazel-out|external)/
Known considerations:
Doesn't attempt to deal with flags which contain multiple comma deliniated values after =, ie
"--extract-api-ignores=foo,external/bar,baz"
In order to deal with flags like this, we'd need to be able to tell whether the comma is part of the path or separating paths. So far I haven't come across any flags like this, and presumably they'd be split up into multiple flags by default unless it was a user custom added one. Cross that bridge when we get to it.
TODO:
Windows should work but needs testing