Skip to content

Commit

Permalink
Fix building CLR test tree (dotnet#74547)
Browse files Browse the repository at this point in the history
* If we're only building Pri-0 tests, don't try to AOT compile Pri-1 tests. `_WillCLRTestProjectBuild` is the property that checks for that.
* Targeting pack references get injected in a way that the compiler targets don't see. The compiler targets are written for publish scenarios but we're not doing a publish.

Fixes dotnet#68394
  • Loading branch information
MichalStrehovsky authored Aug 25, 2022
1 parent 7b0227d commit 3eccadf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,17 @@
<_UsingDefaultForHasRuntimeOutput>false</_UsingDefaultForHasRuntimeOutput>
</PropertyGroup>

<ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
<IlcReference Include="$(TargetingPackPath)/*.dll" />
</ItemGroup>

<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.NETCore.Native.targets" Condition="'$(TestBuildMode)' == 'nativeaot'" />

<Target Name="BuildNativeAot"
DependsOnTargets="Build;LinkNativeIfBuildAndRun" />

<Target Name="LinkNativeIfBuildAndRun"
Condition="'$(CLRTestTargetUnsupported)' != 'true' and '$(CLRTestKind)' == 'BuildAndRun'"
Condition="'$(_WillCLRTestProjectBuild)' == 'true' and '$(CLRTestKind)' == 'BuildAndRun'"
DependsOnTargets="ComputeResolvedFilesToPublishList;LinkNative" />

</Project>

0 comments on commit 3eccadf

Please sign in to comment.