Skip to content

Commit

Permalink
tasks: Fix sourcebuild for WorkloadBuildTasks
Browse files Browse the repository at this point in the history
`WorkloadBuildTasks` project uses source generated regex, which requires
the corresponding analyzer to be used. But for net8.0, in source build
the prebuilt package does not have the analyzers which causes the build
to fail like:

`/__w/1/s/artifacts/sb/src/src/tasks/WorkloadBuildTasks/InstallWorkloadFromArtifacts.cs(61,38): error CS8795: Partial method 'InstallWorkloadFromArtifacts.bandVersionRegex()' must have an implementation part because it has accessibility modifiers. [/__w/1/s/artifacts/sb/src/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj::TargetFramework=net8.0]`

Since the net8.0 build for the task is needed only for the internal
nuget being produced, we can skip the net8.0 build for source builds.

Also, build WorkloadTest.Internal nuget only when building wasm
  • Loading branch information
radical committed Feb 8, 2024
1 parent 36f0d8c commit 7d59a04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/mono/nuget/mono-packages.proj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<ProjectReference Include="Microsoft.NET.Runtime.WebAssembly.Sdk\Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj" />
<ProjectReference Include="..\wasm\templates\Microsoft.NET.Runtime.WebAssembly.Templates.csproj" />
<ProjectReference Include="Microsoft.NET.Sdk.WebAssembly.Pack\Microsoft.NET.Sdk.WebAssembly.Pack.pkgproj" />

<ProjectReference Include="Microsoft.NET.Runtime.WorkloadTesting.Internal\Microsoft.NET.Runtime.WorkloadTesting.Internal.pkgproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetsWasi)' == 'true'">
Expand All @@ -31,8 +33,4 @@
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<ProjectReference Include="Microsoft.NET.Runtime.MonoTargets.Sdk\Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="Microsoft.NET.Runtime.WorkloadTesting.Internal\Microsoft.NET.Runtime.WorkloadTesting.Internal.pkgproj" />
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppToolCurrent);net8.0</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppToolCurrent)</TargetFrameworks>
<!-- net8.0 is only need for the internal nuget produced which isn't required for source builds -->
<TargetFrameworks Condition="'$(DotNetBuildFromSource)' != 'true'">$(TargetFrameworks);net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn),CA1050,CA1850</NoWarn>
</PropertyGroup>
Expand Down

0 comments on commit 7d59a04

Please sign in to comment.