feat: Targets with constants moved to an earlier stage.#9443
Merged
jeromelaban merged 1 commit intounoplatform:masterfrom Aug 15, 2022
Merged
Conversation
jeromelaban
reviewed
Aug 9, 2022
src/Uno.UI.Runtime.Skia.Gtk/buildTransitive/Uno.UI.Runtime.Skia.Gtk.targets
Show resolved
Hide resolved
jeromelaban
approved these changes
Aug 15, 2022
Member
Author
|
I confirm that the generator is able to see constants since version 4.5.0-dev.523 |
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.
GitHub Issue (If applicable): closes #
According this discussion: #9145
The first PR for this, while fixing the name collision, didn't fix the availability of the constants and led to new research.
PR Type
What kind of change does this PR introduce?
Feature
What is the current behavior?
At the moment, constants are added after the .editorconfig file with visible properties is generated, which generators use to access values. Here is the relevant code that shows which Targets are executed and in what order to allow generators to access properties.
https://github.com/dotnet/roslyn/blob/1c3cdb0b85a8496a8f5108faab046924360b6017/src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets#L155-L196
Based on this, I believe that the optimal place to add constants would be
AfterTargets="PrepareForBuild". This also applies to other projects - https://github.com/dotnet/ef6tools/blob/c9988fc28258290118e60dc6d9ccb3fe8c6073d6/setup/wix/EFToolsWillowMsi.wixproj#L77 Generators that rely on these constants will need to use code like this:What is the new behavior?
Targets are run at an earlier stage. In addition, the association of properties has been simplified, and duplication of constants in runtime projects due to the reuse of
UnoDefineConstantshas been fixed. This output is given by this target in the Skia.WPF project:PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information
Internal Issue (If applicable):