Skip to content

Commit

Permalink
build: Few build adjustments to reduce flakiness (#700)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Bilogan <steve.bilogan@gmail.com>
  • Loading branch information
Youssef1313 and kazo0 committed Aug 8, 2023
1 parent 97bc94f commit f622a0d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
1 change: 0 additions & 1 deletion build/workflow/stage-build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:

- task: MSBuild@1
displayName: 'Build solution'
retryCountOnTaskFailure: 3
inputs:
solution: src/Uno.Toolkit.sln
configuration: Release
Expand Down
2 changes: 1 addition & 1 deletion samples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions samples/Uno.Toolkit.Samples/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -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'" />
Expand Down
16 changes: 16 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ItemGroup Condition="$(_IsWindowsWinUI)">
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />

<Page Remove="Generated\*.xaml" />
</ItemGroup>

Expand Down

0 comments on commit f622a0d

Please sign in to comment.