Skip to content

Commit bbf23a2

Browse files
authored
[release/9.0-staging] [Apple mobile] Enable trimming on build machines to match ILLink features (#113466)
* [Apple mobile] Enable trimming on build machines to match ILLink features (#110966) * Disable failing tests * Add DataSetXmlSerializationIsSupported to PlatformDetection
1 parent 6303a6c commit bbf23a2

File tree

13 files changed

+29
-52
lines changed

13 files changed

+29
-52
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ jobs:
3737
isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
3838
# Don't trim tests on rolling builds
3939
${{ if eq(variables['isRollingBuild'], true) }}:
40-
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
40+
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
4141
${{ else }}:
42-
# Tracking issue: https://github.com/dotnet/runtime/issues/82637
43-
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=true
4443
timeoutInMinutes: 480
4544
# extra steps, run tests
4645
postBuildSteps:

eng/pipelines/runtime.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,7 @@ extends:
10101010
jobParameters:
10111011
testGroup: innerloop
10121012
nameSuffix: AllSubsets_Mono
1013-
# Tracking issue: https://github.com/dotnet/runtime/issues/82637
1014-
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=false
1013+
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
10151014
timeoutInMinutes: 480
10161015
condition: >-
10171016
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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@
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>
37+
</PropertyGroup>
38+
39+
<!-- Override default trimming switches for Apple mobile -->
40+
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(TargetsAppleMobile)' == 'true'">
41+
<DynamicCodeSupport Condition="'$(DynamicCodeSupport)' == '' and '$(MonoForceInterpreter)' != 'true'">false</DynamicCodeSupport>
42+
<_DefaultValueAttributeSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true</_DefaultValueAttributeSupport>
43+
<_DesignerHostSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true</_DesignerHostSupport>
4144
</PropertyGroup>
4245

4346
<!-- When trimming non-exe projects, root the whole intermediate assembly.

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ public static bool IsMetadataTokenSupported
288288
public static bool IsNotBuiltWithAggressiveTrimming => !IsBuiltWithAggressiveTrimming;
289289
public static bool IsTrimmedWithILLink => IsBuiltWithAggressiveTrimming && !IsNativeAot;
290290

291+
#if NET
292+
public static bool DataSetXmlSerializationIsSupported => AppContext.TryGetSwitch("System.Data.DataSet.XmlSerializationIsSupported", out bool isSupported) ? isSupported : true;
293+
#else
294+
public static bool DataSetXmlSerializationIsSupported => true;
295+
#endif
296+
291297
// Windows - Schannel supports alpn from win8.1/2012 R2 and higher.
292298
// Linux - OpenSsl supports alpn from openssl 1.0.2 and higher.
293299
// Android - Platform supports alpn from API level 29 and higher

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.Serialization.Xml/tests/XsdDataContractExporterTests/ExporterTypesTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public ExporterTypesTests(ITestOutputHelper output)
1919
_output = output;
2020
}
2121

22-
[Fact]
22+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.DataSetXmlSerializationIsSupported))]
2323
public void TypesTest()
2424
{
2525
var types = new List<Type>()
@@ -79,7 +79,7 @@ public static IEnumerable<object[]> GetDynamicallyVersionedTypesTestNegativeData
7979
};
8080
}
8181

82-
[Theory]
82+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.DataSetXmlSerializationIsSupported))]
8383
[SkipOnPlatform(TestPlatforms.Browser, "Inconsistent and unpredictable results.")] // TODO - Why does 'TypeWithReadWriteCollectionAndNoCtorOnCollection' only cause an exception sometimes, but not all the time? What's special about wasm here?
8484
[ActiveIssue("https://github.com/dotnet/runtime/issues/82967", TestPlatforms.Wasi)]
8585
[InlineData(typeof(NoDataContractWithoutParameterlessConstructor), typeof(InvalidDataContractException), @"Type 'System.Runtime.Serialization.Xml.XsdDataContractExporterTests.ExporterTypesTests+NoDataContractWithoutParameterlessConstructor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.")]

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" />

0 commit comments

Comments
 (0)