Uno.WindowsCommunityToolkit/Directory.Build.props

154 строки
7.2 KiB
XML

<Project>
<PropertyGroup>
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
<BuildToolsDirectory>$(RepositoryDirectory)build\</BuildToolsDirectory>
</PropertyGroup>
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Common.props" />
<PropertyGroup>
<!-- Remove after https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3285 is merged, as this is already in our .editorconfig -->
<NoWarn>$(NoWarn);SA1101;SA1633;SA1202;SA1600;SA1413;SA1611;SA1629;SA1201;SA1309;SA1310;SA1602</NoWarn>
<!-- TODO: WinUI3 - Need to fix -->
<NoWarn>$(NoWarn);CA1033;CA1065;CA1001;CS0252;CS8073;CA1063;CA2213;CA2214;CS8600;CS8604</NoWarn>
<!-- TODO: WinUI3 - Remove when XAMLBehaviors is strong signed -->
<NoWarn>$(NoWarn);CS8002</NoWarn>
</PropertyGroup>
<Choose>
<When Condition="$(IsCoreProject)">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
<GenerateLibraryLayout Condition="$(IsWinUIProject)">true</GenerateLibraryLayout>
<!-- Turned off until 16.11 (https://github.com/dotnet/msbuild/pull/6676) -->
<!--<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>-->
<!-- Enable XAML trimming capability to remove code for Uno targets -->
<UnoXamlResourcesTrimming>true</UnoXamlResourcesTrimming>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<NoWarn>$(NoWarn);CS8002;SA0001</NoWarn>
</PropertyGroup>
</Otherwise>
</Choose>
<Choose>
<When Condition="$(IsWinUIProject)">
<PropertyGroup>
<!-- Code CS8002 is a warning for strong named -> non-strong-named reference. This is valid for platforms other than .NET Framework (and is needed for the UWP targets. -->
<NoWarn>$(NoWarn);CS8002</NoWarn>
<!-- For including default @(Page) and @(Resource) items via 'MSBuild.Sdk.Extras' Sdk package. Also provides up to date check and file nesting -->
<ExtrasEnableDefaultXamlItems>true</ExtrasEnableDefaultXamlItems>
</PropertyGroup>
</When>
</Choose>
<Choose>
<When Condition="!$(IsDesignProject)">
<!--
Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios.
ARM64 builds for managed apps use .NET Native. We can't use the Reflection Provider for that.
-->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
</ItemGroup>
</When>
</Choose>
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.VisualStudio.Design.props" Condition="$(IsDesignProject)" />
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
</ItemGroup>
<Choose>
<When Condition="!$(IsSampleProject) and '$(SourceLinkEnabled)' != 'false'">
<PropertyGroup>
<!-- Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
</When>
</Choose>
<ItemGroup Condition="!$([MSBuild]::IsOsUnixLike()) and '$(BuildingInsideVisualStudio)'=='' ">
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
</ItemGroup>
<!-- BEGIN Uno Specific -->
<PropertyGroup>
<TargetFrameworksOverride>net8.0;net8.0-ios;net8.0-macos;net8.0-android;net8.0-maccatalyst</TargetFrameworksOverride>
<_IsUno>true</_IsUno>
<NoWarn>$(NoWarn);SA1633</NoWarn>
<UnoEnableXamlFuzzyMatching>false</UnoEnableXamlFuzzyMatching>
<!--
WinUI is not supported for this build, users must reference
the official toolkit packages instead.
-->
<TargetFrameworksOverride Condition="'$(BUILD_REPOSITORY_PROVIDER)'==''">$(TargetFrameworksOverride);net5.0-windows10.0.18362.0</TargetFrameworksOverride>
<!--<TargetFrameworksOverride>netstandard2.0</TargetFrameworksOverride>-->
</PropertyGroup>
<PropertyGroup Condition=" '$(_IsUno)'=='true' ">
<NoWarn>$(NoWarn);CS0649;CS0067;CS1998</NoWarn>
</PropertyGroup>
<PropertyGroup>
<!--https://github.com/xamarin/AndroidSupportComponents/issues/176-->
<XamarinAndroidSupportSkipVerifyVersions>true</XamarinAndroidSupportSkipVerifyVersions>
<!-- Workaround for android build using the Uno Source Generators: https://github.com/nventive/Uno.SourceGeneration/issues/109 -->
<JavaSdkDirectory Condition="'$(JavaSdkDirectory)'=='' and '$(JAVA_HOME_8_X64)'!=''">$(JAVA_HOME_8_X64)</JavaSdkDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(_IsUno)'=='true' ">
<ExtrasEnableDefaultPageItems>false</ExtrasEnableDefaultPageItems>
</PropertyGroup>
<PropertyGroup>
<EnableDefaultPageItems>false</EnableDefaultPageItems>
</PropertyGroup>
<ItemGroup Condition=" '$(_IsUno)'=='true' ">
<None Remove="$(MSBuildProjectDirectory)\**\*.xaml"/>
<Page Include="$(MSBuildProjectDirectory)\**\*.xaml" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(ExtrasDefaultPageExcludes)"
XamlRuntime="WinUI" />
<UpToDateCheckInput Include="@(Page)"/>
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.ToLower().StartsWith('xamarinmac')) and '$(Configuration)' == 'Release'">
<Reference Include="Xamarin.Mac">
<HintPath Condition="Exists('C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Xamarin.VisualStudio')">C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Xamarin.VisualStudio\Xamarin.Mac.dll</HintPath>
<HintPath Condition="Exists('C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Xamarin.VisualStudio')">C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Xamarin.VisualStudio\Xamarin.Mac.dll</HintPath>
<HintPath Condition="Exists('C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Xamarin.VisualStudio')">C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Xamarin.VisualStudio\Xamarin.Mac.dll</HintPath>
<HintPath Condition="Exists('C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\Xamarin.VisualStudio')">C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\Xamarin.VisualStudio\Xamarin.Mac.dll</HintPath>
</Reference>
</ItemGroup>
<!-- END Uno Specific -->
</Project>