Reorder code-blocks for better readability

To make diff understandable through blame and across similar project files,
I have re-organized some lines in these project files. This also improves
readability. Previously, the focus is per-project file but now—to maintain
project logic across repos and several similar logic across project files,
new way of authoring project files is required.

This refactor is the start of it.
This commit is contained in:
Nirmal Guru 2021-02-14 14:02:24 +05:30
Родитель 8d205a1096
Коммит 7586eeb013
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 230F32B3E627D620
6 изменённых файлов: 58 добавлений и 62 удалений

Просмотреть файл

@ -45,8 +45,8 @@
<When Condition="'$(Configuration)' == 'Debug' and '$(IsDesignProject)' != 'true'">
<!-- Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios -->
<PropertyGroup>
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
</PropertyGroup>
</When>
</Choose>

Просмотреть файл

@ -58,11 +58,6 @@
</When>
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>
<PropertyGroup>
<!--
NETSTANDARD2_1_OR_GREATER: includes both .NET Standard 2.1 and .NET Core 3.1.
This is needed because .NET Core 3.1 will be a separate package than .NET Standard 2.1.
@ -75,8 +70,13 @@
available on .NET Core 2.1. So by using this constant, we can make sure to expose those
APIs relying on that method on all target frameworks that are able to support them.
-->
<PropertyGroup>
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
</PropertyGroup>
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == 'net5.0'">
@ -86,9 +86,6 @@
</When>
<When Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>
<!--
NETCORE_RUNTIME: to avoid issues with APIs that assume a specific memory layout, we define a
.NET Core runtime constant to indicate either .NET Core 2.1 or .NET Core 3.1. These are
@ -101,15 +98,18 @@
<PropertyGroup>
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
</PropertyGroup>
</When>
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PropertyGroup>
<DefineConstants>SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>
</When>
</Choose>

Просмотреть файл

@ -3,56 +3,20 @@
<PropertyGroup>
<TargetFrameworks>netstandard1.4;uap10.0.19041;net461;netcoreapp3.1;net5.0;net5.0-windows10.0.17763.0;native</TargetFrameworks>
<DefineConstants>$(DefineConstants);NETFX_CORE</DefineConstants>
<ExtrasImplicitPlatformPackageIsPrivate Condition="'$(TargetFramework)' == 'native'">true</ExtrasImplicitPlatformPackageIsPrivate>
<NuspecFile>Microsoft.Toolkit.Uwp.Notifications.nuspec</NuspecFile>
</PropertyGroup>
<Choose>
<!--Desktop Win32 apps-->
<When Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1'">
<ItemGroup>
<!--Reference Windows SDK NuGet of correct target platform version-->
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
</When>
</Choose>
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
<!--Define the WINDOWS_UWP conditional symbol, since the Windows.Data.Xml and the Windows.UI.Notification namespaces are available-->
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WIN32</DefineConstants>
</PropertyGroup>
<!--NET Core desktop apps also need the Registry NuGet package and System.Reflection.Emit for generating COM class dynamically-->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'native' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(ExtrasUwpMetaPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>
<!-- In order to support .NET Native, we need to include an appropriate .rd.xml for UWP (remove from everything else) -->
<ItemGroup Condition="'$(TargetFramework)' != 'uap10.0.19041' and '$(TargetFramework)' != 'native'">
<EmbeddedResource Remove="Properties\Microsoft.Toolkit.Uwp.Notifications.rd.xml" />
</ItemGroup>
<ItemGroup>
<None Include="Microsoft.Toolkit.Uwp.Notifications.targets" Pack="true" PackagePath="build\native" />
</ItemGroup>
<!--Native (C++) doesn't need System.ValueTuple (plus it's incompatible with this package)-->
<ItemGroup Condition=" '$(TargetFramework)' != 'native' ">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.19041'">
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<DefaultTargetPlatformMinVersion>16299</DefaultTargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
<!-- Define the WINDOWS_UWP conditional symbol, since the Windows.Data.Xml and the Windows.UI.Notification namespaces are available -->
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WIN32</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'native'">
<OutputType>winmdobj</OutputType>
<DebugType>Full</DebugType>
@ -64,17 +28,49 @@
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<DefaultTargetPlatformMinVersion>10240</DefaultTargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);NETFX_CORE;WINDOWS_UWP;WINRT</DefineConstants>
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);WINDOWS_UWP;WINRT</DefineConstants>
<CopyLocalLockFileAssemblies Condition="'$(CopyLocalLockFileAssemblies)' == ''">false</CopyLocalLockFileAssemblies>
<TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<LanguageTargets>$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets</LanguageTargets>
<ExtrasImplicitPlatformPackageIsPrivate>true</ExtrasImplicitPlatformPackageIsPrivate>
<!-- Need to override the built-in implicit defines for UAP or it'll be NETCORE5_0. This makes it UAP10_0_10240_0 to match the rest -->
<ImplicitFrameworkDefine Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">UAP$(TargetPlatformMinVersion.Replace('.', '_'))</ImplicitFrameworkDefine>
<DisableImplicitFrameworkDefines Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">true</DisableImplicitFrameworkDefines>
</PropertyGroup>
<ItemGroup>
<None Include="Microsoft.Toolkit.Uwp.Notifications.targets" Pack="true" PackagePath="build\native" />
</ItemGroup>
<!-- In order to support .NET Native, we need to include an appropriate .rd.xml for UWP (remove from everything else) -->
<ItemGroup Condition="'$(TargetFramework)' != 'uap10.0.19041' and '$(TargetFramework)' != 'native'">
<EmbeddedResource Remove="Properties\Microsoft.Toolkit.Uwp.Notifications.rd.xml" />
</ItemGroup>
<!-- Desktop Win32 apps -->
<ItemGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1'">
<!-- Reference Windows SDK NuGet of correct target platform version -->
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
<!-- The .NET Core desktop apps also need the Registry NuGet package and System.Reflection.Emit for generating COM class dynamically -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'native'">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(ExtrasUwpMetaPackageVersion)" PrivateAssets="All" IsImplicitlyDefined="true" />
</ItemGroup>
<!-- Native (C++) doesn't need 'System.ValueTuple' (plus it's incompatible with this package) -->
<ItemGroup Condition="'$(TargetFramework)' != 'native'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<!-- Set the nuspec properties. Dependent on version which isn't updated till after 'GetBuildVersion'. Condition ensures we only set once since this runs multiple times for each target. -->
<Target Name="SetNuspecProperties" AfterTargets="GetBuildVersion">
<PropertyGroup Condition="'$(NuspecProperties)' == ''">

Просмотреть файл

@ -24,9 +24,9 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI\Microsoft.Toolkit.Uwp.UI.csproj" />
<!-- TODO: Including Animation reference for now for initial refactor of the ScrollHeader behaviors, we may be able to remove, but may also have some Behaviors for Animations? -->
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Animations\Microsoft.Toolkit.Uwp.UI.Animations.csproj" />
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI\Microsoft.Toolkit.Uwp.UI.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -14,14 +14,14 @@
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
</PropertyGroup>
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
</ItemGroup>
<!-- .NET Standard 2.1 and .NET 5 already have [NotNullIfNotNull] and [NotNullWhen] -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net5.0'">
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
</PropertyGroup>
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
</ItemGroup>
</Project>

Просмотреть файл

@ -27,7 +27,7 @@
<Type Name="Windows.UI.Xaml.Controls.FontIcon" Dynamic="Required All" Serialize="Required All" />
<Type Name="Windows.UI.Xaml.Controls.BitmapIcon" Dynamic="Required All" Serialize="Required All" />
<Type Name="UnitTests.Extensions.MockSwipeItem" Dynamic="Required All" Serialize="Required All" />
<Type Name="System.Collections.Generic.IList{Windows.UI.Xaml.Automation.Peers.AutomationPeer}" MarshalObject="Required All"/>
<Type Name="Microsoft.Toolkit.Uwp.UI.BitmapIconExtension" Dynamic="Required All" Serialize="Required All"/>
<Type Name="Microsoft.Toolkit.Uwp.UI.FontIconExtension" Dynamic="Required All" Serialize="Required All"/>
@ -36,6 +36,6 @@
<Type Name="Microsoft.Toolkit.Uwp.UI.SymbolIconSourceExtension" Dynamic="Required All" Serialize="Required All"/>
<Type Name="Microsoft.Toolkit.Uwp.UI.EnumValuesExtension" Dynamic="Required All" Serialize="Required All"/>
<Type Name="System.Collections.Generic.IList{Windows.UI.Xaml.Automation.Peers.AutomationPeer}" MarshalObject="Required All"/>
<Type Name="UnitTests.Extensions.MockSwipeItem" Dynamic="Required All" Serialize="Required All" />
</Application>
</Directives>