-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add 'RunCsWinRTGenerator' task and target #49417
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
base: main
Are you sure you want to change the base?
Add 'RunCsWinRTGenerator' task and target #49417
Conversation
|
||
<!-- Default property values for 'cswinrtgen' --> | ||
<PropertyGroup> | ||
<CsWinRTToolsDirectory Condition="'$(CsWinRTToolsDirectory)' == ''"></CsWinRTToolsDirectory> |
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.
Here we need to get the path to the root directory of the Microsoft.Windows.SDK.NET.Ref
package that's going to be used. Not sure how to get it from here though.
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.
If there's a packageref to this package (implicit or explicit), there may be a PackagePath_MIcrosoft_Windows_SDK_NET_Ref
MSbuild property already ambiently available. Check a binlog and see?
|
||
<!-- Add the interop .dll to the list of reference paths --> | ||
<ItemGroup> | ||
<ReferencePath Include="@(CsWinRTGeneratorInteropAssemblyPath)" /> |
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.
We need two things here:
@(CsWinRTGeneratorInteropAssemblyPath)
needs to be copied to the output directory@(CsWinRTGeneratorInteropAssemblyPath)
also needs to be added to .deps.json
I'm not sure how to do both. I could do it by adding the item to both ReferencePath
, UserRuntimeAssembly
, and IntermediatePath
, but that doesn't seem correct. What is the right way to achieve 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.
Will need to look into answers for both of these, I'll try to do that tomorrow.
============================================================ | ||
--> | ||
<UsingTask Condition="'$(CsWinRTGeneratorTasksOverriden)' != 'true'" TaskName="RunCsWinRTGenerator" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" /> | ||
<Target |
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.
Ideally, this target would only run if something changed. As in, if there's been any code changes or if any transitive dependency changed. I'm assuming the Csc
task that's invoked in CoreCompile
would already be doing some kind of check like that, to skip work if eg. you just F5 again without changing anything. Is there a way for us to perform the same check (or get that result out of CoreCompile
) so we can also skip this target if not needed?
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 concept is known as incrementality. The short form is that if you know your inputs, and your inputs are files whose timestamps can be tracked, then you can set Inputs=..all that stuff..
on your Target
and the MSBuild engine will transparently track them and only call your target if any of them are out of date. Similarly, if you know your Outputs, you can provide those to the engine as well and up-to-date checking will take place.
This means that many complex Targets often have a 'compute the inputs and outputs for Target XXXXX' Target that runs immediately before them, so that you can compute the correct set of inputs/outputs for incrementality purposes.
This PR adds supporting infra for CsWinRT 3.0 (see here):
RunCsWinRTGenerator
task that runscswinrtgen
Everything is opt-in and off-by-default.