Skip to content

Commit ff5726f

Browse files
authored
[Apple mobile] Enable trimming on build machines to match ILLink features (#110966)
Trimming is now moved trimming from Helix to AzDo (build) machines. Redundant code for maintaining ILLink features is removed.
1 parent a5a7a3a commit ff5726f

File tree

11 files changed

+16
-50
lines changed

11 files changed

+16
-50
lines changed

eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
4040
# Don't trim tests on rolling builds
4141
${{ if eq(variables['isRollingBuild'], true) }}:
42-
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=false
42+
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=false
4343
${{ else }}:
44-
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=true
44+
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=true
4545
timeoutInMinutes: 480
4646
# extra steps, run tests
4747
postBuildSteps:

eng/pipelines/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ extends:
973973
jobParameters:
974974
testGroup: innerloop
975975
nameSuffix: AllSubsets_Mono
976-
buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:RunSmokeTestsOnly=true /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:EnableAggressiveTrimming=true
976+
buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:RunSmokeTestsOnly=true /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:EnableAggressiveTrimming=true
977977
timeoutInMinutes: 480
978978
condition: >-
979979
or(

eng/testing/tests.ioslike.targets

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<!-- running aot-helix tests locally, so we can test with the same project file as CI -->
1717
<_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand>
1818
<!-- The command below sets default properties for runtime and library tests -->
19-
<_AOTBuildCommand>$(_AOTBuildCommand) /p:XHARNESS_EXECUTION_DIR=&quot;$XHARNESS_EXECUTION_DIR&quot; /p:RunAOTCompilation=$(RunAOTCompilation) /p:UseNativeAOTRuntime=$(UseNativeAOTRuntime) /p:TargetOS=$(TargetOS) /p:TargetArchitecture=$(TargetArchitecture) /p:MonoForceInterpreter=$(MonoForceInterpreter) /p:MonoEnableLLVM=true /p:DevTeamProvisioning=$(DevTeamProvisioning) /p:UsePortableRuntimePack=true /p:Configuration=$(Configuration) /p:EnableAggressiveTrimming=$(EnableAggressiveTrimming)</_AOTBuildCommand>
19+
<_AOTBuildCommand>$(_AOTBuildCommand) /p:XHARNESS_EXECUTION_DIR=&quot;$XHARNESS_EXECUTION_DIR&quot; /p:RunAOTCompilation=$(RunAOTCompilation) /p:UseNativeAOTRuntime=$(UseNativeAOTRuntime) /p:TargetOS=$(TargetOS) /p:TargetArchitecture=$(TargetArchitecture) /p:MonoForceInterpreter=$(MonoForceInterpreter) /p:MonoEnableLLVM=true /p:DevTeamProvisioning=$(DevTeamProvisioning) /p:UsePortableRuntimePack=$(UsePortableRuntimePack) /p:Configuration=$(Configuration)</_AOTBuildCommand>
2020
<_AOTBuildCommand Condition="'$(NativeLib)' != ''">$(_AOTBuildCommand) /p:NativeLib=$(NativeLib) /p:BundlesResources=$(BundlesResources) /p:ForceLibraryModeGenerateAppBundle=$(ForceLibraryModeGenerateAppBundle)</_AOTBuildCommand>
2121
<_AOTBuildCommand>$(_AOTBuildCommand) </_AOTBuildCommand>
2222

@@ -77,8 +77,6 @@
7777
<BundleFiles Include="$(MonoProjectRoot)\msbuild\apple\data\*" TargetDir="publish" />
7878
<ExtraFiles Condition="'%(AppleAssembliesToBundle._IsNative)' == 'true'"
7979
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" />
80-
<ExtraFiles Condition="Exists(%(TrimmerRootDescriptor.Identity))"
81-
Include="@(TrimmerRootDescriptor)" TargetDir="extraFiles" />
8280
</ItemGroup>
8381

8482
<ItemGroup Condition="'$(UseNativeAOTRuntime)' == 'true' and '$(HybridGlobalization)' == 'false'" >
@@ -156,12 +154,6 @@
156154
<_AppleItemsToPass Include="@(ReferenceExtraPathFiles->'%(FileName)%(Extension)')"
157155
OriginalItemName__="AppleReferenceExtraPathFiles" />
158156

159-
<_AppleItemsToPass Include="@(RuntimeHostConfigurationOption)"
160-
OriginalItemName__="_AppleUsedRuntimeHostConfigurationOption" />
161-
162-
<_AppleItemsToPass Include="@(TrimmerRootAssembly)"
163-
OriginalItemName__="TrimmerRootAssembly" />
164-
165157
<!-- Example of passing items to the project
166158
167159
<_AppleItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" />

eng/testing/tests.mobile.targets

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,20 @@
2424
<DotnetPgoToolPath>$([MSBuild]::NormalizePath('$(DotnetPgoToolDir)', 'dotnet-pgo'))</DotnetPgoToolPath>
2525
</PropertyGroup>
2626

27-
<!-- When tests are built on Helix, we don't want to invoke ILLink on build machines -->
28-
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(BuildTestsOnHelix)' != 'true'">
27+
<!-- Invoke ILLink on build machines to match ILLink features -->
28+
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
2929
<PublishTrimmed>true</PublishTrimmed>
3030
<!-- Suppress trimming warnings as these are tests -->
3131
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
3232
<NoWarn>$(NoWarn);IL2103;IL2025;IL2111;IL2122</NoWarn>
3333

3434
<!-- Reduce library test app size by trimming framework library features -->
35-
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' != 'Debug'">false</DebuggerSupport>
3635
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
37-
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
38-
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
3936
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">false</UseSystemResourceKeys>
40-
<UseNativeHttpHandler Condition="'$(UseNativeHttpHandler)' == ''">false</UseNativeHttpHandler>
4137
</PropertyGroup>
4238

43-
<!-- When tests are built on Helix, override default trimming switches -->
44-
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(BuildTestsOnHelix)' == 'true'">
39+
<!-- Override default trimming switches for Apple mobile -->
40+
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(TargetsAppleMobile)' == 'true'">
4541
<DynamicCodeSupport Condition="'$(DynamicCodeSupport)' == '' and '$(MonoForceInterpreter)' != 'true'">false</DynamicCodeSupport>
4642
<_DefaultValueAttributeSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true</_DefaultValueAttributeSupport>
4743
<_DesignerHostSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true</_DesignerHostSupport>

src/libraries/Microsoft.Extensions.DependencyModel/tests/Microsoft.Extensions.DependencyModel.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@
1818
<ProjectReference Include="nonentrypointassembly\nonentrypointassembly.csproj" />
1919
</ItemGroup>
2020

21+
<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" >
22+
<TrimmerRootAssembly Include="nonentrypointassembly" />
23+
</ItemGroup>
2124
</Project>

src/libraries/System.Reflection.TypeExtensions/tests/ILLink.Descriptors.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/libraries/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@
2222
<Link>TinyAssembly.dll</Link>
2323
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2424
</Content>
25-
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
2625
</ItemGroup>
2726
</Project>

src/libraries/System.Runtime/tests/System.Runtime.Tests/ILLink.Descriptors.iOS.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
<type fullname="System.Tests.EnumTests" />
1010
<type fullname="System.Tests.ArrayTests" />
1111
<type fullname="System.Reflection.Tests.InvokeRefReturnNetcoreTests" />
12-
<type fullname="System.Reflection.Tests.InvokeRefReturnNetcoreTests+TestClass`1" />
1312
<type fullname="System.Reflection.Tests.MethodBaseTests" />
14-
<type fullname="System.Tests.Types.ModifiedTypeTests+ModifiedTypeHolder" />
1513
<type fullname="System.Tests.ArrayTests" />
16-
<type fullname="System.Tests.ArrayTests+GenericStruct`1" />
1714
</assembly>
1815
<assembly fullname="System.Private.CoreLib">
1916
<type fullname="System.Array" />

src/libraries/tests.proj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@
339339
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj" />
340340
<!-- Reference deleted by _CopyTestArchive https://github.com/dotnet/runtime/issues/80976 -->
341341
<ProjectExclusions Include="$(RepoRoot)/src/tests/FunctionalTests/iOS/Simulator/StartupHook/iOS.Simulator.StartupHook.Test.csproj" />
342+
<!-- Tracking issue: https://github.com/dotnet/runtime/issues/101692 -->
343+
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Formats.Tar/tests/System.Formats.Tar.Tests.csproj" />
344+
<!-- Tracking issue: https://github.com/dotnet/runtime/issues/109282 -->
345+
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime/tests/System.IO.UnmanagedMemoryStream.Tests/System.IO.UnmanagedMemoryStream.Tests.csproj" />
342346

343347
<!-- Source generators tests. Not testing customer scenarios. Low priority -->
344348
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.Abstractions\tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj" />

src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<ExtraFilesPath>$([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'extraFiles'))</ExtraFilesPath>
88
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'obj'))</BaseIntermediateOutputPath>
99

10-
<AppleBuildDependsOn Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">ConfigureTrimming;_AdjustTrimmedAssembliesToBundle;$(AppleBuildDependsOn)</AppleBuildDependsOn>
1110
<AppleBuildDependsOn>_PublishRuntimePack;_PrepareForAppleBuildAppOnHelix;$(AppleBuildDependsOn);_AfterAppleBuildOnHelix</AppleBuildDependsOn>
1211
<!-- Forced by ILLink targets -->
1312
<SelfContained>true</SelfContained>
@@ -71,7 +70,7 @@
7170

7271
<ItemGroup>
7372
<!-- Figure out if we can support JustInterp mode -->
74-
<AppleAssembliesToBundle Include="$(OriginalPublishDir)**\*.dll" Exclude="$(OriginalPublishDir)\**\*.resources.dll" />
73+
<AppleAssembliesToBundle Include="$(OriginalPublishDir)\*.dll" Exclude="$(OriginalPublishDir)\*.resources.dll" />
7574

7675
<!-- Extra files are NativeLibraries and should be excluded from AppleAssembliesToBundle -->
7776
<_ExtraFiles Include="$(ExtraFilesPath)**\*" />
@@ -95,14 +94,6 @@
9594
<RuntimeComponents Include="diagnostics_tracing" />
9695
<RuntimeComponents Include="marshal-ilgen" />
9796
</ItemGroup>
98-
99-
<ItemGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">
100-
<TrimmerRootDescriptor Include="$(ExtraFilesPath)**\*.xml" />
101-
102-
<!-- To recreate the state of feature flags (RuntimeHostConfigurationOption) during app build-time we need to discard the default setting, coming from SDK, and used the values passed in ProxyProjectForAOTOnHelix.props -->
103-
<RuntimeHostConfigurationOption Remove="@(_AppleUsedRuntimeHostConfigurationOption)" />
104-
<RuntimeHostConfigurationOption Include="@(_AppleUsedRuntimeHostConfigurationOption)" />
105-
</ItemGroup>
10697
</Target>
10798

10899
<Target Name="_PublishRuntimePack"
@@ -117,14 +108,6 @@
117108
DestinationFolder="$(OriginalPublishDir)" />
118109
</Target>
119110

120-
<!-- Since we are reusing the 'publish' folder for different purposes (e.g., using it as a source and destination directory for trimming) we need to adjust the list of assemblies to bundle once trimming is completed. -->
121-
<Target Name="_AdjustTrimmedAssembliesToBundle" DependsOnTargets="ILLink;CopyFilesToPublishDirectory">
122-
<ItemGroup>
123-
<AppleAssembliesToBundle Remove="@(AppleAssembliesToBundle)" />
124-
<AppleAssembliesToBundle Include="$(OriginalPublishDir)**\*.dll" Exclude="$(OriginalPublishDir)\**\*.resources.dll;@(_RemovedManagedAssembly)" />
125-
</ItemGroup>
126-
</Target>
127-
128111
<!-- Move the app to where the xharness runner expects it. -->
129112
<Target Name="_AfterAppleBuildOnHelix">
130113
<PropertyGroup>

src/tests/FunctionalTests/tvOS/Device/AOT/tvOS.Device.Aot.Test.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
<MonoForceInterpreter>false</MonoForceInterpreter>
2020
</PropertyGroup>
2121

22-
<ItemGroup>
23-
<!-- Preserves the UnmanagedCallersOnly method -->
24-
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
25-
</ItemGroup>
26-
2722
<ItemGroup>
2823
<Compile Include="Program.cs" />
2924
</ItemGroup>

0 commit comments

Comments
 (0)