Repository navigation
Conversation
Add a CommandPaths dataclass to the backend to keep track of absolute and relative target command paths, to allow each backend implementation to use what it needs. This replaces the `absolute_outputs` boolean. Add a test case to ensure all backends will continue to handle those paths correctly after refactors. At this point, generated ninja or project are identical as before.
When a custom target is used as element of of another target arguments, it was given a path relative to build root. This works with ninja, but was broken on vs backend because vs runs the command from the project root. Fixed using the CommandPaths object introduced in the previous commit. Tests were updated for this case. - removes `target.absolute_paths = True` from the VS backend, so the backend no longer modifies the build model. - routes `@PRIVATE_DIR@` and the inputs through `CommandPaths`, which is what makes removing that line possible. - xcode custom target input become absolute paths. - ninja targets with `absolute_paths` get an absolute path for a custom target used in their command.
In the VS backend, use paths relative to the project file instead of absolute paths for custom target commands. - Fix dependency tracking for run targets in sub-directories (they were relative to build root, but VS resolves them from the project file dir) - Normalize paths in `CommandPaths.build()` for prettier results. - `get_target_depend_files()` now takes `CommandPaths` as argument instead of a boolean.
dcbaker
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
VS runs commands relatively to the project file location, and not from the build root. This is why it was using
target.absolute_pathsto make it work. However, this wasn't working when using a custom target inside the arguments of another target, since paths where then resolved from the wrong root. This fixes that problem, and allows the use of relative paths inside the vs backend, while keeping the current behavior of the ninja backend.