-
Notifications
You must be signed in to change notification settings - Fork 262
Fix include path for generated component (.g.cpp) files #537
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested with or without
-prefix? Any change like would need to be justified in detail and then tested very heavily as there are a lot of projects publicly and inside the Windows OS that rely on historical quirky behavior related to include paths.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have tested with and without
-prefix. This change works correctly in both cases. (When-prefixis specified, it still emits the include in the form ofFoo.Bar.Baz.g.cpp, as expected and as before the change.) The reason it works is becauseget_generated_component_filenameconditionally generates the directory path or the dotted prefix file based on whether the option is provided or not.I think the description is already pretty detailed, to be honest, but I am happy to add more information that you feel might be missing.
The crux of the issue here isn't really the include path, but simply the file name that is emitted in the include directive is never created (if
-prefixisn't specified and-nameis unable to fully strip the namespace prefix). The actual file name ends up beingBaz.g.cpp, but we're emitting an include forFoo.Bar.Baz.g.cpp. That's clearly not going to work regardless of include path configuration. :) And I discovered this in the OS repo itself, where I had to work around it by manually modifying the emitted include path :)Further, this is a change to what's emitted to a file that is already meant to be edited manually (we now even have a
static_assertto that effect) so risk of breaking any existing project that uses cppwinrt is extremely low.Finally, as I wrote in the description, this uses the exact same function to generate the included file name as is used to emit the include for the
.g.hfile in the component's.hfile..g.cppfiles are generated using the same code as.g.hfiles and wind up in the same location and therefore should use the same approach to emit the include.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks for the due diligence. Obviously I'm all for fixing broken scenarios. Just cautious about breaking existing ones. We just don't have sufficient test collatoral to catch breaks early and its a lot more painful to catch them when a branch build breaks (as I'm sure you're aware).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, of course. :)