build: Few build adjustments to reduce flakiness (#700)

Co-authored-by: Steve Bilogan <steve.bilogan@gmail.com>
This commit is contained in:
Youssef Victor 2023-08-08 14:49:20 +00:00 коммит произвёл GitHub
Родитель 97bc94fbfc
Коммит f622a0d79f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 21 добавлений и 4 удалений

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

@ -14,7 +14,6 @@ jobs:
- task: MSBuild@1
displayName: 'Build solution'
retryCountOnTaskFailure: 3
inputs:
solution: src/Uno.Toolkit.sln
configuration: Release

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

@ -7,7 +7,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.5.0-2.final" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.7.0-2.final" />
<!--
If, in the same solution, you are referencing a project that uses https://github.com/onovotny/MSBuildSdkExtras,
you need to make sure that the version provided here matches https://github.com/novotnyllc/MSBuildSdkExtras/blob/main/Source/MSBuild.Sdk.Extras/DefaultItems/ImplicitPackages.targets#L11.

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

@ -1,4 +1,6 @@
<Project ToolsVersion="15.0">
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
<ItemGroup>
<!-- Remove WinUI files (Ctrl+F: UWP_WinUI_Removal) -->
<Page Remove="$(MSBuildThisFileDirectory)**\*.WinUI.xaml" Condition="'$(FrameworkLineage)' == 'UWP'" />

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

@ -1,4 +1,20 @@
<Project ToolsVersion="15.0">
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
<Import Project="Directory.UnoMetadata.targets" />
<!-- This is a workaround, should be removed when this issue is fixed: https://github.com/unoplatform/uno/issues/13167 -->
<!-- Without this, the build gets flaky and sometimes fails with this error -->
<!-- C:\hostedtoolcache\windows\dotnet\sdk\7.0.306\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(221,5): error NU5019: File not found: 'D:\a\1\s\src\library\Uno.Toolkit.Cupertino\bin\Uno.Toolkit.WinUI.Cupertino\Release\net7.0-ios\Uno.Toolkit.WinUI.Cupertino.uprimarker'. [D:\a\1\s\src\library\Uno.Toolkit.Cupertino\Uno.Toolkit.WinUI.Cupertino.csproj] -->
<!-- Without this workaround target, what happens is that _UnoGeneratePriMarker was run before both _UnoAssetsGetCopyToPublishDirectory and finds ContentWithTargetPath being empty, so it does nothing -->
<!-- Then later, _UnoAssetsGetCopyToPublishDirectory is run and ContentWithTargetPath is now added, and NuGet packaging now expects the uprimarker to be present -->
<!-- Note that this error can go away with restarts, so it's a race condition -->
<Target Name="_WorkaroundBuildFlakiness"
BeforeTargets="_UnoGeneratePriMarker">
<ItemGroup>
<ContentWithTargetPath Include="@(_TransitiveItemsToCopyToOutputDirectory)">
<TargetPath>%(TargetPath)</TargetPath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ContentWithTargetPath>
</ItemGroup>
</Target>
</Project>

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

@ -35,7 +35,7 @@
<PackageVersion Include="Uno.UITest.Xamarin" Version="1.1.0-dev.32" />
<PackageVersion Include="Xamarin.UITest" Version="4.1.0" />
<PackageVersion Include="MSTest.TestFramework" Version="2.1.2" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.5.0-2.final" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.7.0-2.final" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.0-preview1.22518.1" />
</ItemGroup>
</Project>

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

@ -33,7 +33,7 @@
<ItemGroup Condition="$(_IsWindowsWinUI)">
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<Page Remove="Generated\*.xaml" />
</ItemGroup>