-
Notifications
You must be signed in to change notification settings - Fork 1.2k
convert gentracesources to tt #598
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
Conversation
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.
Nice! Need a little time to review - will get to as soon as possible after working through some preview 5 deliverables.
Would be great to get @rladuca's input as well.
eng/WpfArcadeSdk/tools/CodeGen/DesignTimeTextTemplating.targets
Outdated
Show resolved
Hide resolved
eng/WpfArcadeSdk/tools/CodeGen/DesignTimeTextTemplating.targets
Outdated
Show resolved
Hide resolved
eng/WpfArcadeSdk/tools/CodeGen/DesignTimeTextTemplating.targets
Outdated
Show resolved
Hide resolved
eng/WpfArcadeSdk/tools/CodeGen/AvTrace/PresentationTraceSources.tt
Outdated
Show resolved
Hide resolved
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.
This looks good, just some spelling/wording nits.
As a general suggestion, the comments you spit out in the T4 for some functions/properties should be XML style "///" comments.
Documentation/codegen.md
Outdated
The following document describes how code generation in this repo works. The goal is to have all our code generation done through the use of T4 text generation. See the offical [Visual Studio T4 documentation](https://docs.microsoft.com/en-us/visualstudio/modeling/design-time-code-generation-by-using-t4-text-templates?view=vs-2019) for more information. | ||
|
||
## Design-Time vs Run-Time T4 templates | ||
Currently, we are evaluating the use of design-time text templates. This gives us the ability to simply add the templates and associated targets to the build, without the need of maintaining a separate tool to do run-time generation. Including the `Microsoft.TextTemplating.targets` requires us to manually import Sdk.Targets because it needs to be imported after Sdk.targets. This causes the `BuildDependsOn` variable, which is modified by the T4 targets, to be overwritten, so the `TransformAll` target doesn’t run before the Build target. The boilerplait for including design-time templates has been encapsulated in the `$(WpfCodeGenDir)DesignTimeTextTemplating.targets` file, so the pattern for enabling these in a project looks like this: |
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.
"Importing Sdk.Targets because it needs to be imported after Sdk.Targets" is phrased oddly.
I think what you want to say is more like "Microsoft.TextTemplating.targets needs to be imported after Sdk.Targets, therefore Sdk.Targets must be manually imported."
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.
Also SDK.Targets probably should be in backticks as well.
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.
Rewording to:
When using the SDK-style project format, including the Microsoft.TextTemplating.targets
requires us to manually import Sdk.Targets
because the BuildDependsOn
variable, which is modified by the T4 targets, would otherwise be overwritten by the automatic inclusion of Sdk.targets
eng/WpfArcadeSdk/tools/CodeGen/DesignTimeTextTemplating.targets
Outdated
Show resolved
Hide resolved
eng/WpfArcadeSdk/tools/CodeGen/DesignTimeTextTemplating.targets
Outdated
Show resolved
Hide resolved
eng/WpfArcadeSdk/tools/CodeGen/AvTrace/PresentationTraceSources.tt
Outdated
Show resolved
Hide resolved
these will now be generated using .tt files that are contained in the Microsoft.DotNet.Arcade.Wpf.sdk
Files are finally being generated now
0b7e0a9
to
044170c
Compare
This PR updates the WpfArcadeSdk to move our gentracesources.pl and gentracestrings.pl to using design time t4 generation. Instead of these files being generated into
$(IntermediateOutputPath)
they are now put under$(WpfSourceDir)
, and are easily discoverable in the project files.There are a few caveats in order to get this to work:
Below is an example of how WindowsBase uses these targets. PresentationFramework and PresentationCore are similar, only without the
GenTraceSources.targets
import.There will be an internal PR that shows how these changes are consumed. The goal here is that we will continue to move more and more of our codegen scripts to T4 templates, where we should be able to use this as a starting point for completing that work.