Skip to content

Commit

Permalink
Use live illink for trimming tests (#88929)
Browse files Browse the repository at this point in the history
* Use live illink for trimming tests

Remove the PackageReference that was updated by dependency flow,
and replace it with an import of the live ILLink build props, overriding
the path to the ILLink.Tasks assembly.
  • Loading branch information
sbomer committed Aug 1, 2023
1 parent 865d02e commit 429a5c3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 17 deletions.
2 changes: 2 additions & 0 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir>
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir>

<ToolsILLinkDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)'))</ToolsILLinkDir>

<MonoAotCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS)-$(TargetArchitecture.ToLowerInvariant())))</MonoAotCrossDir>
<GrpcServerDockerImageDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'obj', 'grpcserver', 'docker'))</GrpcServerDockerImageDir>

Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/runtime-linker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extends:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))
buildArgs: -s clr+libs -c $(_BuildConfig)
buildArgs: -s clr+libs+tools.illink -c $(_BuildConfig)
extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml

#
Expand All @@ -118,7 +118,7 @@ extends:
testGroup: innerloop
timeoutInMinutes: 120
nameSuffix: Runtime_Release
buildArgs: -s mono+libs -c $(_BuildConfig) -p:WasmBuildNative=false -p:AotHostArchitecture=x64 -p:AotHostOS=$(_hostedOS)
buildArgs: -s mono+libs+tools.illink -c $(_BuildConfig) -p:WasmBuildNative=false -p:AotHostArchitecture=x64 -p:AotHostOS=$(_hostedOS)
condition:
or(
eq(variables['isRollingBuild'], true),
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ extends:
testGroup: innerloop
timeoutInMinutes: 120
nameSuffix: NativeAOT
buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
buildArgs: -s clr.aot+host.native+libs+tools.illink -c $(_BuildConfig) -rc $(_BuildConfig) -lc Release -hc Release
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
extraStepsParameters:
creator: dotnet-bot
Expand Down
9 changes: 9 additions & 0 deletions eng/testing/linker/SupportFiles/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<Project>

<!-- Use live illink bits. It is necessary to both import the package props and override
the tasks assembly, because the live package props in the build output do not use
the same layout as the NuGet package. -->
<Import Project="$(ToolsILLinkDir)build/Microsoft.NET.ILLink.Tasks.props" />
<PropertyGroup>
<ILLinkTasksAssembly>$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll</ILLinkTasksAssembly>
</PropertyGroup>

<PropertyGroup>
<SkipConfigureTrimming>true</SkipConfigureTrimming>
<PublishTrimmed>true</PublishTrimmed>
Expand Down
22 changes: 12 additions & 10 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>

<PropertyGroup>
<!-- Needed for PublishTrimmed -->
<NetCoreAppToolCurrent>{NetCoreAppToolCurrent}</NetCoreAppToolCurrent>
<ToolsILLinkDir>{ToolsILLinkDir}</ToolsILLinkDir>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>{TargetFramework}</TargetFramework>
Expand Down Expand Up @@ -53,15 +61,6 @@
{AdditionalProjectReferences}
</ItemGroup>

<!-- Logic to override the default IlLink tasks that come from the SDK and use the one
we use in dotnet/runtime repo -->
<ItemGroup>
<PackageReference Include="Microsoft.NET.ILLink.Tasks"
Version="{MicrosoftNETILLinkTasksVersion}"
PrivateAssets="all"
IsImplicitlyDefined="true" />
</ItemGroup>

<Target Name="LocateNativeCompiler"
Condition="'$(PublishAot)' == 'true' and '$(_hostOS)' != 'win'"
BeforeTargets="SetupOSSpecificProps">
Expand All @@ -84,4 +83,7 @@
</Target>

<Import Project="{NativeSanitizersTargets}" />

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>
3 changes: 2 additions & 1 deletion eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
.Replace('{UseMonoRuntime}','$(UseMonoRuntime)')
.Replace('{RuntimeIdentifier}','%(TestConsoleApps.TestRuntimeIdentifier)')
.Replace('{PublishAot}','$(IsNativeAotTestProject)')
.Replace('{MicrosoftNETILLinkTasksVersion}', '$(MicrosoftNETILLinkTasksVersion)')
.Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)')
.Replace('{AdditionalProperties}', '$(_additionalPropertiesString)')
.Replace('{ToolsILLinkDir}', '$(ToolsILLinkDir)')
.Replace('{IlcToolsPath}', '$(IlcToolsPath)')
.Replace('{IlcBuildTasksPath}', '$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll')
.Replace('{IlcSdkPath}', '$(CoreCLRAotSdkDir)')
Expand All @@ -109,6 +109,7 @@
.Replace('{MicrosoftNetCoreAppRuntimePackRidDir}', '$(MicrosoftNetCoreAppRuntimePackRidDir)')
.Replace('{ProductVersion}', '$(ProductVersion)')
.Replace('{NetCoreAppCurrent}', '$(NetCoreAppCurrent)')
.Replace('{NetCoreAppToolCurrent}', '$(NetCoreAppToolCurrent)')
.Replace('{NetCoreAppCurrentVersion}', '$(NetCoreAppCurrentVersion)')
.Replace('{MicrosoftNetCoreAppFrameworkName}', '$(MicrosoftNetCoreAppFrameworkName)')
.Replace('{MicrosoftNetCoreAppRefPackDir}', '$(MicrosoftNetCoreAppRefPackDir)')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
</PropertyGroup>

<Import Project="..\Directory.Build.props" />
</Project>
</Project>
6 changes: 4 additions & 2 deletions src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
<ItemGroup>
<!-- Note: 'build/Microsoft.NET.ILLink.targets' should not match the package name, because we don't want the targets
to be imported by nuget. The SDK will import them in the right order. -->
<None Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
<None Include="..\ILLink.RoslynAnalyzer\Microsoft.NET.ILLink.Analyzers.props" Pack="true" PackagePath="build/" />
<Content Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)"
CopyToOutputDirectory="PreserveNewest" TargetPath="../%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="..\ILLink.RoslynAnalyzer\build\**\*.props" Pack="true" PackagePath="build/%(RecursiveDir)%(Filename)%(Extension)"
CopyToOutputDirectory="PreserveNewest" TargetPath="../build/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 429a5c3

Please sign in to comment.