Repository navigation
convert gentracesources to tt - #598
Conversation
There was a problem hiding this comment.
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.
rladuca
left a comment
There was a problem hiding this comment.
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.
| 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.
"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.
Also SDK.Targets probably should be in backticks as well.
There was a problem hiding this comment.
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
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.targetsimport.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.