Skip to content

Commit 429a5c3

Browse files
authored
Use live illink for trimming tests (#88929)
* 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.
1 parent 865d02e commit 429a5c3

File tree

9 files changed

+33
-17
lines changed

9 files changed

+33
-17
lines changed

eng/liveBuilds.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir>
3030
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir>
3131

32+
<ToolsILLinkDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)'))</ToolsILLinkDir>
33+
3234
<MonoAotCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS)-$(TargetArchitecture.ToLowerInvariant())))</MonoAotCrossDir>
3335
<GrpcServerDockerImageDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'obj', 'grpcserver', 'docker'))</GrpcServerDockerImageDir>
3436

eng/pipelines/runtime-linker-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ extends:
102102
or(
103103
eq(dependencies.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
104104
eq(variables['isRollingBuild'], true))
105-
buildArgs: -s clr+libs -c $(_BuildConfig)
105+
buildArgs: -s clr+libs+tools.illink -c $(_BuildConfig)
106106
extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml
107107

108108
#
@@ -118,7 +118,7 @@ extends:
118118
testGroup: innerloop
119119
timeoutInMinutes: 120
120120
nameSuffix: Runtime_Release
121-
buildArgs: -s mono+libs -c $(_BuildConfig) -p:WasmBuildNative=false -p:AotHostArchitecture=x64 -p:AotHostOS=$(_hostedOS)
121+
buildArgs: -s mono+libs+tools.illink -c $(_BuildConfig) -p:WasmBuildNative=false -p:AotHostArchitecture=x64 -p:AotHostOS=$(_hostedOS)
122122
condition:
123123
or(
124124
eq(variables['isRollingBuild'], true),

eng/pipelines/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ extends:
288288
testGroup: innerloop
289289
timeoutInMinutes: 120
290290
nameSuffix: NativeAOT
291-
buildArgs: -s clr.aot+host.native+libs -rc $(_BuildConfig) -lc Release -hc Release
291+
buildArgs: -s clr.aot+host.native+libs+tools.illink -c $(_BuildConfig) -rc $(_BuildConfig) -lc Release -hc Release
292292
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
293293
extraStepsParameters:
294294
creator: dotnet-bot

eng/testing/linker/SupportFiles/Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<Project>
2+
3+
<!-- Use live illink bits. It is necessary to both import the package props and override
4+
the tasks assembly, because the live package props in the build output do not use
5+
the same layout as the NuGet package. -->
6+
<Import Project="$(ToolsILLinkDir)build/Microsoft.NET.ILLink.Tasks.props" />
7+
<PropertyGroup>
8+
<ILLinkTasksAssembly>$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll</ILLinkTasksAssembly>
9+
</PropertyGroup>
10+
211
<PropertyGroup>
312
<SkipConfigureTrimming>true</SkipConfigureTrimming>
413
<PublishTrimmed>true</PublishTrimmed>

eng/testing/linker/project.csproj.template

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project>
2+
3+
<PropertyGroup>
4+
<!-- Needed for PublishTrimmed -->
5+
<NetCoreAppToolCurrent>{NetCoreAppToolCurrent}</NetCoreAppToolCurrent>
6+
<ToolsILLinkDir>{ToolsILLinkDir}</ToolsILLinkDir>
7+
</PropertyGroup>
8+
9+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
210

311
<PropertyGroup>
412
<TargetFramework>{TargetFramework}</TargetFramework>
@@ -53,15 +61,6 @@
5361
{AdditionalProjectReferences}
5462
</ItemGroup>
5563

56-
<!-- Logic to override the default IlLink tasks that come from the SDK and use the one
57-
we use in dotnet/runtime repo -->
58-
<ItemGroup>
59-
<PackageReference Include="Microsoft.NET.ILLink.Tasks"
60-
Version="{MicrosoftNETILLinkTasksVersion}"
61-
PrivateAssets="all"
62-
IsImplicitlyDefined="true" />
63-
</ItemGroup>
64-
6564
<Target Name="LocateNativeCompiler"
6665
Condition="'$(PublishAot)' == 'true' and '$(_hostOS)' != 'win'"
6766
BeforeTargets="SetupOSSpecificProps">
@@ -84,4 +83,7 @@
8483
</Target>
8584

8685
<Import Project="{NativeSanitizersTargets}" />
86+
87+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
88+
8789
</Project>

eng/testing/linker/trimmingTests.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
.Replace('{UseMonoRuntime}','$(UseMonoRuntime)')
9090
.Replace('{RuntimeIdentifier}','%(TestConsoleApps.TestRuntimeIdentifier)')
9191
.Replace('{PublishAot}','$(IsNativeAotTestProject)')
92-
.Replace('{MicrosoftNETILLinkTasksVersion}', '$(MicrosoftNETILLinkTasksVersion)')
9392
.Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)')
9493
.Replace('{AdditionalProperties}', '$(_additionalPropertiesString)')
94+
.Replace('{ToolsILLinkDir}', '$(ToolsILLinkDir)')
9595
.Replace('{IlcToolsPath}', '$(IlcToolsPath)')
9696
.Replace('{IlcBuildTasksPath}', '$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll')
9797
.Replace('{IlcSdkPath}', '$(CoreCLRAotSdkDir)')
@@ -109,6 +109,7 @@
109109
.Replace('{MicrosoftNetCoreAppRuntimePackRidDir}', '$(MicrosoftNetCoreAppRuntimePackRidDir)')
110110
.Replace('{ProductVersion}', '$(ProductVersion)')
111111
.Replace('{NetCoreAppCurrent}', '$(NetCoreAppCurrent)')
112+
.Replace('{NetCoreAppToolCurrent}', '$(NetCoreAppToolCurrent)')
112113
.Replace('{NetCoreAppCurrentVersion}', '$(NetCoreAppCurrentVersion)')
113114
.Replace('{MicrosoftNetCoreAppFrameworkName}', '$(MicrosoftNetCoreAppFrameworkName)')
114115
.Replace('{MicrosoftNetCoreAppRefPackDir}', '$(MicrosoftNetCoreAppRefPackDir)')

src/tools/illink/src/ILLink.RoslynAnalyzer/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
</PropertyGroup>
66

77
<Import Project="..\Directory.Build.props" />
8-
</Project>
8+
</Project>

src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
<ItemGroup>
3030
<!-- Note: 'build/Microsoft.NET.ILLink.targets' should not match the package name, because we don't want the targets
3131
to be imported by nuget. The SDK will import them in the right order. -->
32-
<None Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)" />
33-
<None Include="..\ILLink.RoslynAnalyzer\Microsoft.NET.ILLink.Analyzers.props" Pack="true" PackagePath="build/" />
32+
<Content Include="**\*.props;**\*.targets" Pack="true" PackagePath="%(RecursiveDir)%(Filename)%(Extension)"
33+
CopyToOutputDirectory="PreserveNewest" TargetPath="../%(RecursiveDir)%(Filename)%(Extension)" />
34+
<Content Include="..\ILLink.RoslynAnalyzer\build\**\*.props" Pack="true" PackagePath="build/%(RecursiveDir)%(Filename)%(Extension)"
35+
CopyToOutputDirectory="PreserveNewest" TargetPath="../build/%(RecursiveDir)%(Filename)%(Extension)" />
3436
</ItemGroup>
3537

3638
<ItemGroup>

0 commit comments

Comments
 (0)