Skip to content

Commit

Permalink
WUX/MUX prototype (#1421)
Browse files Browse the repository at this point in the history
* Start prototype with TODOs on supporting build-time/runtime-startup selected WUX vs MUX mode.

* Implement the base TODO-WuxMux items that must be completed to support a runtime configuration WUX/MUX switch.

* Add WUX test projection and fix bug with ICommand special-casing.

* Inline MUX guids.

* Add CsWinRT SDK support

* Add tests for authoring components with WUX APIs (also validates some of the consumption logic in the process)

* Remove Debug.Breaks

* Change approach so WUX/MUX works for delegates

* Use Xaml Islands and a custom main to enable writing GTest tests with INPC and types that need the XAML engine initialized on the thread.

* Start prototype with TODOs on supporting build-time/runtime-startup selected WUX vs MUX mode.

Implement the base TODO-WuxMux items that must be completed to support a runtime configuration WUX/MUX switch.

Add WUX test projection and fix bug with ICommand special-casing.

Inline MUX guids.

Add CsWinRT SDK support

Add tests for authoring components with WUX APIs (also validates some of the consumption logic in the process)

Remove Debug.Breaks

Change approach so WUX/MUX works for delegates

Use Xaml Islands and a custom main to enable writing GTest tests with INPC and types that need the XAML engine initialized on the thread.

Add AuthoringWuxComsumptionTest to the CI

Change IIDOptimizer to fall back to GuidGenerator for WUX/MUX types.

Fix IList ABI type to implement WUX and MUX

Add breaks

PR feedback and fix unit test failures.

Fix configurations for new projects.

Fix configuration for Windows.UI.Xaml projection

* PR feedback

* Use boolean feature flag for the WinRT.Runtime side of the support

* Rename MSBuild property and expected values.

* Consolidate item groups

* Rename UiXamlMode to UIXamlProjectionsMode to better match the MSBuild property

* PR feedback

* Revert binding changes (the types have the same identity in Wux and Mux and it was causing failures in AOT scenarios to have them split)

* Make it easier to debug the source generator

* Fix the build

* Finally fix the NRE

* Provide a mechanism to exclude additions (for use when different sections of the same namespace are emitted into multiple different projections, and only one should define the addition types)

* Fix property name in 'ILLink.Substitutions.xml'

* Rename 'FeatureSwitches' switch for WUX

* Remove unnecessary mapping collection

* Remove leftover 'Debugger.Launch' call

* Remove 'IPropertyChangedEventArgsVftbl' type

* Optimize 'PropertyChangedEventArgsRuntimeClassFactory'

* Fix merge conflicts

* Fix capitalization of an IID

* Centralize last WUX/MUX IIDs

* Remove runtime parsing of two IIDs

* Fix WUX IID for 'INotifyCollectionChanged'

* Remove unnecessary [WuxMux] from vtable types

* Tweak 'NotifyCollectionChangedEventArgs'

* Tweak 'NotifyCollectionChangedEventArgs'

* Simplify 'WuxMuxProjectedTypeAttribute'

* Fix 'MatchingRefApiCompatBaseline'

* Fix 'PropertyChangedEventHandler.IID' accessibility

* Throw 'NotSupportedException' for WUX downlevel

* Remove unnecessary ifdef

* Simplify 'Projections.CustomTypeMappings.tt'

* Throw when trying to register invalid custom mappings

* Support WUX for custom type mapping APIs

* Fix IIDs

* Remove unnecessary 'As<T>' calls for activation

* Reorder props, fix indendation

---------

Co-authored-by: Sergio Pedri <[email protected]>
  • Loading branch information
jkoritzinsky and Sergio0694 authored Jun 25, 2024
1 parent a3dfd89 commit 6bd62de
Show file tree
Hide file tree
Showing 69 changed files with 5,131 additions and 1,331 deletions.
12 changes: 12 additions & 0 deletions build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ stages:
script: |
dir _build\$(BuildPlatform)\$(BuildConfiguration)\AuthoringConsumptionTest\bin
_build\$(BuildPlatform)\$(BuildConfiguration)\AuthoringConsumptionTest\bin\AuthoringConsumptionTest.exe --gtest_output=xml:AUTHORINGTEST-$(Build.BuildNumber).xml
exit /b 0
# Run WUX Tests
- task: CmdLine@2
displayName: Run WUX Tests
condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildPlatform'], 'x64')))
continueOnError: True
inputs:
workingDirectory: $(Build.SourcesDirectory)\src
script: |
dir _build\$(BuildPlatform)\$(BuildConfiguration)\AuthoringWuxConsumptionTest\bin
_build\$(BuildPlatform)\$(BuildConfiguration)\AuthoringWuxConsumptionTest\bin\AuthoringWuxConsumptionTest.exe --gtest_output=xml:AUTHORINGWUXTEST-$(Build.BuildNumber).xml
exit /b 0
# Run Functional Tests
Expand Down
1 change: 1 addition & 0 deletions nuget/Microsoft.Windows.CsWinRT.Authoring.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<CompilerVisibleProperty Include="CsWinRTWindowsMetadata" />
<CompilerVisibleProperty Include="CsWinRTGenerateProjection" />
<CompilerVisibleProperty Include="CsWinRTAuthoringInputs" />
<CompilerVisibleProperty Include="CsWinRTUIXamlProjections" />
</ItemGroup>

<!-- Note this runs before the msbuild editor config file is generated because that is what is used to pass properties to the source generator. -->
Expand Down
17 changes: 17 additions & 0 deletions nuget/Microsoft.Windows.CsWinRT.targets
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ $(CsWinRTInternalProjection)
</ItemGroup>
</Target>

<ItemGroup>
<RuntimeHostConfigurationOption Include="CsWinRT.UiXamlMode" Condition="'$(CsWinRTUiXamlMode)' != ''">
<Value>$(CsWinRTUiXamlMode)</Value>
<Trim>true</Trim>
</RuntimeHostConfigurationOption>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets" Condition="Exists('$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Prerelease.targets')"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.Authoring.targets" Condition="'$(CsWinRTComponent)' == 'true'"/>
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Windows.CsWinRT.IIDOptimizer.targets" Condition="'$(CsWinRTIIDOptimizerOptOut)' != 'true'"/>
Expand Down Expand Up @@ -338,6 +345,16 @@ $(CsWinRTInternalProjection)
<RuntimeHostConfigurationOption Include="CSWINRT_ENABLE_IDYNAMICINTERFACECASTABLE"
Value="$(CsWinRTEnableIDynamicInterfaceCastableSupport)"
Trim="true" />

<!-- CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS switch-->
<RuntimeHostConfigurationOption Include="CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS" Condition="'$(CsWinRTUIXamlProjections)' == 'WindowsUIXaml'">
<Value>true</Value>
<Trim>true</Trim>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS" Condition="'$(CsWinRTUIXamlProjections)' != 'WindowsUIXaml'">
<Value>false</Value>
<Trim>true</Trim>
</RuntimeHostConfigurationOption>
</ItemGroup>

</Project>
138 changes: 78 additions & 60 deletions src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 6bd62de

Please sign in to comment.