Skip to content

Commit

Permalink
Streamline bundled .targets across TFMs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Aug 9, 2024
1 parent f3903a1 commit d8a442f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<!--
Configuration for the feature switches (to support IL trimming).
See the 'ILLink.Substitutions.xml' file for more details on that.
We only include these on .NET 6 and above (no .xml file otherwise).
-->
<ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">

<!-- MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT switch -->
<RuntimeHostConfigurationOption Include="MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT"
Expand Down
42 changes: 7 additions & 35 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,13 @@

<ItemGroup Label="Package">

<!-- .NET Standard 2.0 only needs the Roslyn validation .targets -->
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive\netstandard2.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive\netstandard2.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build\netstandard2.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build\netstandard2.0" Pack="true" />

<!-- .NET Standard 2.0 does the same -->
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive\netstandard2.1" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive\netstandard2.1" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build\netstandard2.1" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build\netstandard2.1" Pack="true" />

<!-- .NET 6 also supports feature switches -->
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="buildTransitive\net6.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive\net6.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive\net6.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="build\net6.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build\net6.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build\net6.0" Pack="true" />

<!-- .NET 8 does the same as .NET 6 -->
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="buildTransitive\net8.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive\net8.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive\net8.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="build\net8.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build\net8.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build\net8.0" Pack="true" />

<!-- .NET 8 on Windows is the same as .NET 8 with respect to .targets -->
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="buildTransitive\net8.0-windows10.0.17763.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive\net8.0-windows10.0.17763.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive\net8.0-windows10.0.17763.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="build\net8.0-windows10.0.17763.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build\net8.0-windows10.0.17763.0" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build\net8.0-windows10.0.17763.0" Pack="true" />
<!-- Include the custom .targets files (shared across TFMs) -->
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="build" Pack="true" />
<None Include="CommunityToolkit.Mvvm.FeatureSwitches.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.SourceGenerators.targets" PackagePath="buildTransitive" Pack="true" />
<None Include="CommunityToolkit.Mvvm.targets" PackagePath="buildTransitive" Pack="true" />

<!--
Pack the source generator to the right package folders (each matching the target Roslyn version).
Expand Down
6 changes: 3 additions & 3 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<_CommunityToolkitMvvmSourceGeneratorsTargets>$(MSBuildThisFileDirectory)CommunityToolkit.Mvvm.SourceGenerators.targets</_CommunityToolkitMvvmSourceGeneratorsTargets>
</PropertyGroup>

<!-- Import all available .targets (NuGet only auto-imports the one whose name matches the package name) -->
<Import Project="$(_CommunityToolkitMvvmFeatureSwitchesTargets)" Condition="Exists('$(_CommunityToolkitMvvmFeatureSwitchesTargets)')"/>
<Import Project="$(_CommunityToolkitMvvmSourceGeneratorsTargets)" Condition="Exists('$(_CommunityToolkitMvvmSourceGeneratorsTargets)')"/>
<!-- Import all available .targets -->
<Import Project="$(_CommunityToolkitMvvmFeatureSwitchesTargets)" />
<Import Project="$(_CommunityToolkitMvvmSourceGeneratorsTargets)" />

</Project>

0 comments on commit d8a442f

Please sign in to comment.