From f435d10a763d3040445f02b6ba438ca8c6fe9180 Mon Sep 17 00:00:00 2001 From: Nirmal Guru Date: Wed, 24 Mar 2021 08:22:00 +0530 Subject: [PATCH] Dynamically Pack MVVM SourceGen project outputs Previously, static output path to the MVVM SourceGen assembly was used to pack the MVVM project. This leads to error when OutputPath was updated dynamically when testing or in forks. So, here, we'll update the build so that the SourceGen build outputs will be dynamically packed. --- ...munityToolkit.Mvvm.SourceGenerators.csproj | 2 + .../CommunityToolkit.Mvvm.csproj | 31 ++++++++---- .../Community.Toolkit.GetBuildOutputs.targets | 47 +++++++++++++++++++ 3 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 build/Community.Toolkit.GetBuildOutputs.targets diff --git a/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.csproj b/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.csproj index d42888765..fd23e400d 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.csproj +++ b/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.csproj @@ -26,4 +26,6 @@ + + \ No newline at end of file diff --git a/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj b/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj index 205d703d1..b51b45a3c 100644 --- a/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj +++ b/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj @@ -50,20 +50,33 @@ - + + + + GetSourceGenBuildOutputs + + - - - + + + + + + + <_PackageFiles Include="@(SourceGenBuildOutput)" PackagePath="analyzers\dotnet\roslyn4.0\cs" /> + + + + \ No newline at end of file diff --git a/build/Community.Toolkit.GetBuildOutputs.targets b/build/Community.Toolkit.GetBuildOutputs.targets new file mode 100644 index 000000000..f60cb0057 --- /dev/null +++ b/build/Community.Toolkit.GetBuildOutputs.targets @@ -0,0 +1,47 @@ + + + + + <_GetBuildOutputsDependsOn>BuiltProjectOutputGroup;DocumentationProjectOutputGroup + <_GetBuildOutputsDependsOn Condition="'$(IncludeSymbols)' != 'false'">$(_GetBuildOutputsDependsOn);DebugSymbolsProjectOutputGroup + <_GetBuildOutputsDependsOn Condition="'$(IncludeSatelliteAssemblies)' != 'false'">$(_GetBuildOutputsDependsOn);SatelliteDllsProjectOutputGroup + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file