1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-12 02:30:29 +09:00

[infra] Enable trimming on Helix for Apple mobile (#100669)

* Add ILLink support to build machines

This commit introduces the EnableAggressiveTrimming parameter in the Apple mobile targets for build machines. It ensures that parameters and items used by the ILLink target are passed correctly.

* Add ILLink support on Helix

This commit introduces the EnableAggressiveTrimming parameter in the proxy project. Additionally, it ensures that ILLink props and targets are included into the payload.

* Fix trimming-related test failures

This commit adds ILLink descriptor files to preserve types needed for tests. Additionally, it disables tests that are not trim-compatible.

* Fix ILLinkTasksAssembly path in AppleBuild.LocalBuild.props

* Remove EnableSoftTrimming property

---------

Co-authored-by: Ivan Povazan <ivan.povazan@gmail.com>
This commit is contained in:
Milos Kotlar 2024-04-12 16:15:43 +02:00 committed by GitHub
parent a70b9a1195
commit 59c583ccec
Signed by: github
GPG key ID: B5690EEEBB952194
47 changed files with 259 additions and 73 deletions

View file

@ -35,7 +35,11 @@ jobs:
testGroup: innerloop
nameSuffix: AllSubsets_Mono
isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
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
# Don't trim tests on rolling builds
${{ if eq(variables['isRollingBuild'], true) }}:
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
${{ else }}:
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
timeoutInMinutes: 480
# extra steps, run tests
postBuildSteps:

View file

@ -1009,7 +1009,7 @@ extends:
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono
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
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
timeoutInMinutes: 480
condition: >-
or(

View file

@ -16,7 +16,7 @@
<!-- running aot-helix tests locally, so we can test with the same project file as CI -->
<_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand>
<!-- The command below sets default properties for runtime and library tests -->
<_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)</_AOTBuildCommand>
<_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>
<_AOTBuildCommand Condition="'$(NativeLib)' != ''">$(_AOTBuildCommand) /p:NativeLib=$(NativeLib) /p:BundlesResources=$(BundlesResources) /p:ForceLibraryModeGenerateAppBundle=$(ForceLibraryModeGenerateAppBundle)</_AOTBuildCommand>
<_AOTBuildCommand>$(_AOTBuildCommand) </_AOTBuildCommand>
@ -46,11 +46,11 @@
<PropertyGroup>
<AppleBuildDependsOn>PrepareForAppleBuildApp;$(AppleBuildDependsOn);_CopyTestArchive</AppleBuildDependsOn>
<BundleTestAppleAppDependsOn Condition="'$(BuildTestsOn)' == 'local'">AppleBuild</BundleTestAppleAppDependsOn>
<BundleTestAppleAppDependsOn Condition="'$(BuildTestsOnHelix)' == 'true'">$(BundleTestAppleAppDependsOn);_BundleAOTTestAppleAppForHelix;_CopyTestArchive</BundleTestAppleAppDependsOn>
</PropertyGroup>
<Target Name="BundleTestAppleApp" DependsOnTargets="$(BundleTestAppleAppDependsOn)" />
<UsingTask Condition="'$(BuildTestsOnHelix)' == 'true'"
@ -61,7 +61,7 @@
<PropertyGroup>
<AppBundlePath>$(BundleDir)publish</AppBundlePath>
</PropertyGroup>
<PropertyGroup>
<_MainAssemblyPath Condition="'%(AppleAssembliesToBundle.FileName)' == $(AssemblyName) and '%(AppleAssembliesToBundle.Extension)' == '.dll'">%(AppleAssembliesToBundle.Identity)</_MainAssemblyPath>
<RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
@ -76,6 +76,8 @@
<BundleFiles Include="$(MonoProjectRoot)\msbuild\apple\data\*" TargetDir="publish" />
<ExtraFiles Condition="'%(AppleAssembliesToBundle._IsNative)' == 'true'"
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" />
<ExtraFiles Condition="Exists(%(TrimmerRootDescriptor.Identity))"
Include="@(TrimmerRootDescriptor)" TargetDir="extraFiles" />
</ItemGroup>
<ItemGroup Condition="'$(UseNativeAOTRuntime)' == 'true' and '$(HybridGlobalization)' == 'false'" >
@ -104,41 +106,62 @@
<_RuntimePackFiles Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)**\*.*" />
<_RuntimePackFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)*.*" />
<_UnusedRuntimePackFiles Include="@(_PublishBundleFiles)" Exclude="@(_RuntimePackFiles->'$(AppBundlePath)/%(FileName)%(Extension)')" />
<_UsedRuntimePackFiles Include="@(_PublishBundleFiles)" Exclude="@(_UnusedRuntimePackFiles)" />
<_RuntimePackFilesToDelete Include="@(_RuntimePackFiles->'$(AppBundlePath)/%(FileName)%(Extension)')" />
<!-- ILLink properties -->
<AppleReferenceSharedPathFiles Include="%(ReferencePath.Identity)" Condition="Exists('@(ReferencePath->'$(LibrariesSharedFrameworkBinArtifactsPath)%(FileName)%(Extension)')')" />
<ReferenceExtraPathFiles Include="%(ReferencePath.Identity)" Condition="!Exists('@(ReferencePath->'$(LibrariesSharedFrameworkBinArtifactsPath)%(FileName)%(Extension)')')" />
</ItemGroup>
<!-- Remove the runtime pack parts from the self contained app. We'll restore on helix -->
<Delete Condition="'$(UsePortableRuntimePack)' == 'true'" Files="@(_RuntimePackFilesToDelete)" />
<!-- Copy ILLink.Substitutions files -->
<Copy SourceFiles="%(ReferenceExtraPathFiles.Identity)" DestinationFolder="$(BundleDir)\extraFiles" />
<!-- To recreate the original project on helix, we need to set the apple properties also, same as the
library test project. Eg. $(InvariantGlobalization) -->
<ItemGroup>
<_ApplePropertyNames Include="InvariantGlobalization" />
<_ApplePropertyNames Include="HybridGlobalization" />
<!-- Configuration properties -->
<_ApplePropertyNames Include="AssemblyName" />
<_ApplePropertyNames Include="MonoEnableLLVM" />
<_ApplePropertyNames Include="IncludesTestRunner" />
<_ApplePropertyNames Include="MainLibraryFileName" />
<_ApplePropertyNames Include="MonoEnableLLVM" />
<_ApplePropertyNames Include="ShouldILStrip" />
<_ApplePropertyNames Include="UseConsoleUITemplate" />
<_ApplePropertyNames Include="UseRuntimeComponents" />
<_ApplePropertyNames Include="IncludesTestRunner" />
<_ApplePropertyNames Include="ShouldILStrip" />
<_ApplePropertyNames Include="_NetCoreAppToolCurrent" />
<!-- Globalization properties -->
<_ApplePropertyNames Include="HybridGlobalization" />
<_ApplePropertyNames Include="InvariantGlobalization" />
<_AppleUsedRuntimePackFiles
Include="@(_UsedRuntimePackFiles->'%(FileName)%(Extension)')"
RemoveMetadata="_IsNative;TargetDir" />
<_ApplePropertiesToPass
Include="$(%(_ApplePropertyNames.Identity))"
Name="%(_ApplePropertyNames.Identity)"
ConditionToUse__="%(_ApplePropertyNames.ConditionToUse__)" />
Include="$(%(_ApplePropertyNames.Identity))"
Name="%(_ApplePropertyNames.Identity)"
ConditionToUse__="%(_ApplePropertyNames.ConditionToUse__)" />
<_AppleUsedRuntimePackFiles
Include="@(_UsedRuntimePackFiles->'%(FileName)%(Extension)')"
RemoveMetadata="_IsNative;TargetDir" />
<_AppleItemsToPass Include="@(_AppleUsedRuntimePackFiles)"
OriginalItemName__="_AppleUsedRuntimePackFiles" />
<_AppleItemsToPass Include="@(AppleReferenceSharedPathFiles->'%(FileName)%(Extension)')"
OriginalItemName__="AppleReferenceSharedPathFiles" />
<_AppleItemsToPass Include="@(ReferenceExtraPathFiles->'%(FileName)%(Extension)')"
OriginalItemName__="AppleReferenceExtraPathFiles" />
<_AppleItemsToPass Include="@(RuntimeHostConfigurationOption)"
OriginalItemName__="_AppleUsedRuntimeHostConfigurationOption" />
<_AppleItemsToPass Include="@(TrimmerRootAssembly)"
OriginalItemName__="TrimmerRootAssembly" />
<!-- Example of passing items to the project
<_AppleItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" />
@ -164,7 +187,7 @@
<IncludesTestRunner Condition="'$(IncludesTestRunner)' == ''">true</IncludesTestRunner>
<Optimized Condition="'$(Configuration)' == 'Release'">true</Optimized>
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == '' and '$(IsRuntimeTests)' != 'true' and '$(IncludesTestRunner)' == 'true'">AppleTestRunner.dll</MainLibraryFileName>
<AppleBuildDir>$(PublishDir)</AppleBuildDir>
<AppleBundleDir>$(BundleDir)</AppleBundleDir>
</PropertyGroup>
@ -181,7 +204,7 @@
<_InternalForceInterpret>true</_InternalForceInterpret>
<_IsNative>true</_IsNative>
</AppleAssembliesToBundle>
<_PublishAssemblies Include="$(PublishDir)\**\*.dll" Exclude="$(PublishDir)\**\*.resources.dll" />
<_SatelliteAssemblies Include="$(PublishDir)\**\*.resources.dll" />
@ -212,4 +235,4 @@
<RemoveDir Condition="'$(NeedsToBuildAppsOnHelixLocal)' != 'true'" Directories="$(OutDir)" />
</Target>
</Project>
</Project>

View file

@ -24,15 +24,12 @@
<DotnetPgoToolPath>$([MSBuild]::NormalizePath('$(DotnetPgoToolDir)', 'dotnet-pgo'))</DotnetPgoToolPath>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true'">
<!-- When tests are built on Helix, we don't want to invoke ILLink on build machines -->
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(BuildTestsOnHelix)' != 'true'">
<PublishTrimmed>true</PublishTrimmed>
<!-- Suppress trimming warnings as these are tests -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<NoWarn>$(NoWarn);IL2103;IL2105;IL2025;IL2111</NoWarn>
<!-- Warns about missing Xamarin.iOS.dll -->
<NoWarn Condition="'$(EnableSoftTrimming)' == 'true'">$(NoWarn);IL2035</NoWarn>
<!-- https://github.com/dotnet/sdk/issues/18581 tracks needing to set 2 properties to disable warnings. -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<!-- Reduce library test app size by trimming framework library features -->
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' != 'Debug'">false</DebuggerSupport>
@ -93,10 +90,9 @@
<!-- This .targets file is also imported by the runtime Trimming tests, and we want to be able to manually configure trimming in them so this
should be considered if we ever want to change the Condition of the ConfigureTrimming target -->
<Target Name="ConfigureTrimming" Condition="('$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true') And '$(SkipConfigureTrimming)' != 'true'" AfterTargets="AddTestRunnersToPublishedFiles">
<Target Name="ConfigureTrimming" Condition="'$(EnableAggressiveTrimming)' == 'true' And '$(SkipConfigureTrimming)' != 'true'" AfterTargets="AddTestRunnersToPublishedFiles">
<PropertyGroup>
<TrimMode Condition="'$(EnableAggressiveTrimming)' == 'true'">link</TrimMode>
<TrimMode Condition="'$(EnableSoftTrimming)' == 'true'">copyused</TrimMode>
<TrimMode>link</TrimMode>
</PropertyGroup>
<ItemGroup>
@ -107,24 +103,11 @@
TrimMode="" is needed so the root assemblies are correctly identified -->
<ResolvedFileToPublish TrimMode="" Condition="'%(FileName)' == '$(AssemblyName)'" />
<!-- TODO: find out why these assemblies aren't copied by copyused even though they're referenced -->
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.ComponentModel.EventBasedAsync'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Diagnostics.FileVersionInfo'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Drawing.Primitives'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.IO.Pipelines'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Memory'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Net.WebHeaderCollection'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Runtime.Serialization.Formatters'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Security.AccessControl'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Security.Claims'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Security.Permissions'" />
<ResolvedFileToPublish TrimMode="Copy" Condition="'$(EnableSoftTrimming)' == 'true' and '%(FileName)' == 'System.Transactions.Local'" />
<!-- Even though we are trimming the test runner assembly, we want it to be treated
as a root -->
<TrimmerRootAssembly
Condition="$([System.String]::Copy('%(ResolvedFileToPublish.FileName)%(ResolvedFileToPublish.Extension)').EndsWith('TestRunner.dll'))"
Include="%(ResolvedFileToPublish.FullPath)" />
Include="%(ResolvedFileToPublish.FileName)" />
</ItemGroup>
<ItemGroup>

View file

@ -283,7 +283,7 @@ namespace System
public static bool UsesMobileAppleCrypto => IsMacCatalyst || IsiOS || IstvOS;
// Changed to `true` when trimming
public static bool IsBuiltWithAggressiveTrimming => IsNativeAot;
public static bool IsBuiltWithAggressiveTrimming => IsNativeAot || IsAppleMobile;
public static bool IsNotBuiltWithAggressiveTrimming => !IsBuiltWithAggressiveTrimming;
public static bool IsTrimmedWithILLink => IsBuiltWithAggressiveTrimming && !IsNativeAot;

View file

@ -2119,6 +2119,7 @@ if (!System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Launc
#if !BUILDING_SOURCE_GENERATOR_TESTS
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91923", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public void TraceSwitchTest()
{
var dic = new Dictionary<string, string>
@ -2148,6 +2149,7 @@ if (!System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Launc
[Fact]
#if !BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("Investigate Build browser-wasm linux Release LibraryTests_EAT CI failure for reflection impl", TestPlatforms.Browser)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91923", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
#endif
public void TestGraphWithUnsupportedMember()
{

View file

@ -96,6 +96,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51834", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51834", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
[MemberData(nameof(LateCall_OptionalValues_Data))]
public void LateCall_OptionalValues(string memberName, object[] arguments, Type[] typeArguments, string expectedValue)
{

View file

@ -0,0 +1,6 @@
<linker>
<assembly fullname="System" />
<assembly fullname="System.Private.CoreLib" />
<assembly fullname="System.Configuration" />
<assembly fullname="System.Configuration.ConfigurationManager" />
</linker>

View file

@ -97,6 +97,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\System.Configuration.ConfigurationManager.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Configuration" />

View file

@ -0,0 +1,3 @@
<linker>
<assembly fullname="System.Data" />
</linker>

View file

@ -123,5 +123,6 @@
<ItemGroup>
<PackageReference Include="System.Data.Common.TestData" Version="$(SystemDataCommonTestDataVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientVersion)" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>

View file

@ -36,6 +36,7 @@ namespace System.Data.Tests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51369", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51369", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public void XmlLoadTest()
{
var ds = new DataSet();

View file

@ -0,0 +1,3 @@
<linker>
<assembly fullname="System.Diagnostics.FileVersionInfo.TestAssembly" />
</linker>

View file

@ -52,5 +52,6 @@
<!-- R2R testing does not tolerate the combination of a regular project reference and a content reference. -->
<!-- This is a bug in the SDK tracked here: https://github.com/dotnet/sdk/issues/30718 -->
<PublishReadyToRunExclude Include="System.Diagnostics.FileVersionInfo.TestAssembly.dll" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>

View file

@ -17,6 +17,7 @@ namespace System.Linq.Tests
/// </summary>
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/50712", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/50712", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public static void QueryableMethodsContainCorrectDynamicDependency()
{
IEnumerable<MethodInfo> dependentMethods =

View file

@ -0,0 +1,5 @@
<linker>
<assembly fullname="System.Linq" />
<assembly fullname="System.Linq.Tests" />
<assembly fullname="System.Runtime" />
</linker>

View file

@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="default.rd.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AggregateTests.cs" />

View file

@ -28,6 +28,7 @@ namespace System.Collections.ObjectModel.Tests
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/57588", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/57588", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public void OnDeserialized_MonitorNotInitialized_ExpectSuccess()
{
var observableCollection = new ObservableCollection<int>();

View file

@ -130,6 +130,7 @@ namespace System.Reflection.Metadata.Decoding.Tests
// Test as much as we can with simple C# examples inline below.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91923", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public void SimpleSignatureProviderCoverage()
{
using (FileStream stream = File.OpenRead(AssemblyPathHelper.GetAssemblyLocation(typeof(SignaturesToDecode<>).GetTypeInfo().Assembly)))

View file

@ -6,4 +6,5 @@
-->
<assembly fullname="mscorlib" />
<assembly fullname="TestILAssembly" />
<assembly fullname="System.Private.CoreLib" />
</linker>

View file

@ -90,7 +90,9 @@
<WasmFilesToIncludeFromPublishDir Include="System.Private.CoreLib.dll" />
<WasmFilesToIncludeFromPublishDir Include="System.Reflection.MetadataLoadContext.Tests.dll" />
<WasmFilesToIncludeFromPublishDir Include="mscorlib.dll" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>

View file

@ -0,0 +1,3 @@
<linker>
<assembly fullname="TinyAssembly" />
</linker>

View file

@ -28,7 +28,10 @@ namespace System.Reflection.Tests
{
Module module = Assembly.Load(new AssemblyName("TinyAssembly")).ManifestModule;
Assert.True(module.HasModuleVersionId());
Assert.Equal(Guid.Parse("{06BB2468-908C-48CF-ADE9-DB6DE4614004}"), module.GetModuleVersionId());
if (!(PlatformDetection.IsMonoRuntime && PlatformDetection.IsAppleMobile && PlatformDetection.IsBuiltWithAggressiveTrimming))
{
Assert.Equal(Guid.Parse("{06BB2468-908C-48CF-ADE9-DB6DE4614004}"), module.GetModuleVersionId());
}
}
}
}

View file

@ -22,5 +22,6 @@
<Link>TinyAssembly.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>
</Project>

View file

@ -0,0 +1,4 @@
<linker>
<assembly fullname="System.Drawing" />
<assembly fullname="System.Resources.Extensions" />
</linker>

View file

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetFrameworkMinimum)</TargetFrameworks>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<CustomResourceTypesSupport Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'">true</CustomResourceTypesSupport>
</PropertyGroup>
<ItemGroup>
<Compile Include="MyResourceType.cs" />
@ -15,7 +16,7 @@
<EmbeddedResource Include="TestData.resources" WithCulture="false" Type="Non-Resx" LogicalName="$(RootNamespace).%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common.TestData" Version="$(SystemDrawingCommonTestDataVersion)" />
<PackageReference Include="System.Drawing.Common.TestData" Version="$(SystemDrawingCommonTestDataVersion)" />
<ProjectReference Include="..\src\System.Resources.Extensions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
@ -25,7 +26,9 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<!-- Use the following target to regenerate the test resources file.
This is done from a test application and checked in so that we don't run
product code during the build.
@ -48,4 +51,4 @@
</ItemGroup>
<Exec Command="%(ExecuteMethod.Command)" WorkingDirectory="$(TargetDir)" />
</Target>
</Project>
</Project>

View file

@ -70,7 +70,8 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'browser'">
<WasmFilesToIncludeFromPublishDir Include="$(AssemblyName).dll" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'browser' or ('$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true')">
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
@ -87,7 +88,7 @@
<ManagedAssemblyToLink Condition="'%(FileName)%(Extension)' == '@(IntermediateAssembly->'%(FileName)%(Extension)')'">
<TrimMode>copy</TrimMode>
</ManagedAssemblyToLink>
</ItemGroup>
</ItemGroup>
</Target>
<Target Name="IncludeDeltasInWasmBundle" BeforeTargets="PrepareForWasmBuildApp" Condition="'$(TargetOS)' == 'browser'">

View file

@ -21,6 +21,7 @@ namespace System.Runtime.Serialization.Schema.Tests
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public void RountTripTest()
{
// AppContext SetSwitch seems to be unreliable in the unit test case. So let's not rely on it

View file

@ -4193,6 +4193,7 @@ public static partial class DataContractSerializerTests
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsWasi))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public static void DCS_MemoryStream_Serialize_UsesBuiltInAdapter()
{
ValidateObject(
@ -4253,6 +4254,7 @@ public static partial class DataContractSerializerTests
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsWasi))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public static void DCS_MemoryStream_Deserialize_CompatibleWithFullFramework()
{
// The payloads in this test were generated by a Full Framework application.

View file

@ -89,6 +89,7 @@ namespace System.Runtime.Serialization.Xml.XsdDataContractExporterTests
[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsBrowser))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsWasi))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/73961", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
[MemberData(nameof(Export_MemberData))]
public void Export(string testname, Action<XsdDataContractExporter> export, Action<string, XmlSchemaSet> schemaCheck = null)
{

View file

@ -0,0 +1,5 @@
<linker>
<assembly fullname="System.Linq">
<type fullname="System.Linq.Enumerable" />
</assembly>
</linker>

View file

@ -11,6 +11,7 @@
</PropertyGroup>
<ItemGroup>
<RdXmlFile Include="default.rd.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />

View file

@ -0,0 +1,3 @@
<linker>
<assembly fullname="StreamConformanceTests" />
</linker>

View file

@ -34,6 +34,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CommonTestPath)StreamConformanceTests\StreamConformanceTests.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.IO.DisableFileLocking" Value="true" />

View file

@ -0,0 +1,3 @@
<linker>
<assembly fullname="StreamConformanceTests" />
</linker>

View file

@ -245,5 +245,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CommonTestPath)StreamConformanceTests\StreamConformanceTests.csproj" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,24 @@
<linker>
<assembly fullname="TestLoadAssembly" />
<assembly fullname="TestILAssembly" />
<assembly fullname="mscorlib" />
<assembly fullname="System.Threading.Overlapped" />
<assembly fullname="System.Reflection.TestModule" />
<assembly fullname="System.TestStructs" />
<assembly fullname="System.Runtime.Tests" >
<type fullname="System.Tests.EnumTests" />
<type fullname="System.Tests.ArrayTests" />
<type fullname="System.Reflection.Tests.InvokeRefReturnNetcoreTests" />
<type fullname="System.Reflection.Tests.InvokeRefReturnNetcoreTests+TestClass`1" />
<type fullname="System.Reflection.Tests.MethodBaseTests" />
<type fullname="System.Tests.Types.ModifiedTypeTests+ModifiedTypeHolder" />
<type fullname="System.Tests.ArrayTests" />
<type fullname="System.Tests.ArrayTests+GenericStruct`1" />
</assembly>
<assembly fullname="System.Private.CoreLib">
<type fullname="System.Array" />
<type fullname="System.Int128" />
<type fullname="System.Half" />
<type fullname="System.Collections.Generic.NonRandomizedStringEqualityComparer" />
</assembly>
</linker>

View file

@ -338,7 +338,9 @@
<Compile Include="System\RealParserTests.cs" />
<TrimmerRootDescriptor Include="$(ILLinkDescriptorsPath)ILLink.Descriptors.Castle.xml" />
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' != 'true' or '$(EnableAggressiveTrimming)' != 'true' or '$(UseNativeAotRuntime)' == 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
<!-- Apple mobile trimming descriptor for Mono runtime -->
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.iOS.xml" />
</ItemGroup>
<ItemGroup>

View file

@ -132,6 +132,7 @@ namespace System.Runtime.Tests
[Theory]
[InlineData("mscorlib")]
[InlineData("System.Threading.Overlapped")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/99592", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsBuiltWithAggressiveTrimming), nameof(PlatformDetection.IsAppleMobile))]
public static void ShimsHaveOnlyTypeForwards(string assemblyName)
{
Assembly assembly = Assembly.Load(assemblyName);

View file

@ -0,0 +1,5 @@
<linker>
<assembly fullname="System.Private.CoreLib" />
<assembly fullname="System.Security.Cryptography" />
<assembly fullname="System.Security.Cryptography.Xml" />
</linker>

View file

@ -74,4 +74,7 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Security" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,9 @@
<linker>
<assembly fullname="System" />
<assembly fullname="System.Private.CoreLib" />
<assembly fullname="System.Reflection" />
<assembly fullname="System.Collections" />
<assembly fullname="System.Runtime.Serialization" />
<assembly fullname="System.Runtime.Serialization.Json" />
<assembly fullname="System.Text.Json" />
</linker>

View file

@ -16,6 +16,9 @@
<!-- Needed for JsonSerializerOptionsUpdateHandler tests -->
<MetadataUpdaterSupport Condition="'$(MetadataUpdaterSupport)' == '' and '$(TargetOS)' == 'browser'">true</MetadataUpdaterSupport>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<!-- The JsonSerializerIsReflectionEnabledByDefault feature switch is turned off automatically in projects that enable the PublishTrimmed property.
Enable reflection and preserve required assemblies -->
<JsonSerializerIsReflectionEnabledByDefault Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'">true</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetOS)' == 'browser'">
<XunitShowProgress>true</XunitShowProgress>
@ -302,5 +305,7 @@
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
</ItemGroup>
</Project>

View file

@ -81,7 +81,7 @@
Destination="build/BuildIntegration" />
<HelixCorrelationPayload Include="$(CoreCLRAotSdkDir)" Condition="'$(RuntimeFlavor)' == 'coreclr'"
Destination="build/aotsdk" />
<HelixCorrelationPayload Include="$(ToolsILLinkDir)" Destination="build/microsoft.net.illink.tasks" />
<HelixCorrelationPayload Include="$(ToolsILLinkDir)" Destination="build" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true'">
@ -94,7 +94,7 @@
</XHarnessAppBundleToTest>
<!-- To save on overall size, we compress each app after building. -->
<XHarnessAppBundleToTest
<XHarnessAppBundleToTest
Include="$([System.IO.Directory]::GetFiles('$(TestArchiveTestsRoot)$(OSPlatformConfig)', '*.zip', System.IO.SearchOption.TopDirectoryOnly))"
Exclude="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)', 'xharness-app-payload*', System.IO.SearchOption.AllDirectories))">
<TestTarget>$(AppleTestTarget)</TestTarget>
@ -116,8 +116,8 @@
</XHarnessAppBundleToTest>
<!-- To save on overall size, we compress each app after building. -->
<XHarnessAppBundleToTest Condition="Exists('$(TestArchiveRoot)runonly/$(OSPlatformConfig)') and '$(TargetOS)' != 'tvos' and '$(TargetOS)' != 'ios'"
Include="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)runonly/$(OSPlatformConfig)', '*.zip', System.IO.SearchOption.TopDirectoryOnly))"
<XHarnessAppBundleToTest Condition="Exists('$(TestArchiveRoot)runonly/$(OSPlatformConfig)') and '$(TargetOS)' != 'tvos' and '$(TargetOS)' != 'ios'"
Include="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)runonly/$(OSPlatformConfig)', '*.zip', System.IO.SearchOption.TopDirectoryOnly))"
Exclude="$([System.IO.Directory]::GetFiles('$(TestArchiveRoot)runonly', 'xharness-app-payload*', System.IO.SearchOption.AllDirectories))">
<!-- The sample app doesn't need test runner -->
<IncludesTestRunner>false</IncludesTestRunner>

View file

@ -34,15 +34,19 @@
<MicrosoftNetCoreAppRuntimePackLibDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', '$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())', 'lib', '$(_NetCoreAppCurrent)'))</MicrosoftNetCoreAppRuntimePackLibDir>
<MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', '$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
<LibraryBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'LibraryBuilder', 'Debug', '$(_NetCoreAppToolCurrent)'))</LibraryBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(_NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
<MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoTargetsTasks', 'Debug', '$(_NetCoreAppToolCurrent)'))</MonoTargetsTasksDir>
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(Configuration)', '$(_NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
<LibraryBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'LibraryBuilder', '$(Configuration)', '$(_NetCoreAppToolCurrent)'))</LibraryBuilderDir>
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', '$(Configuration)', '$(_NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
<MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoTargetsTasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)'))</MonoTargetsTasksDir>
<MonoArtifactsPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mono', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfig)'))</MonoArtifactsPath>
<MonoAotCrossDir>$([MSBuild]::NormalizePath($(MonoArtifactsPath), 'cross', '$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())'))</MonoAotCrossDir>
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>
<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.Tasks.props'))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeSrcDir)' == '' and '$(AppleBuildSupportDir)' != ''">
@ -64,8 +68,9 @@
<IlcSdkPath>$([MSBuild]::NormalizeDirectory('$(BuildBaseDir)', 'aotsdk'))</IlcSdkPath>
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackLibDir)</IlcFrameworkPath>
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</ILLinkTasksAssembly>
<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'build', ''Microsoft.NET.ILLink.Tasks.props''))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>
</PropertyGroup>
@ -83,6 +88,12 @@
<MonoTargetsTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoTargetsTasksDir)', 'MonoTargetsTasks.dll'))</MonoTargetsTasksAssemblyPath>
</PropertyGroup>
<Import Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Project="$(ILLinkPropsPath)" />
<!-- The ILLinkTasksAssembly cannot be overridden. This is the way to update the property from Microsoft.NET.ILLink.Tasks.props -->
<PropertyGroup>
<ILLinkTasksAssembly>$(_ILLinkTasksAssembly)</ILLinkTasksAssembly>
</PropertyGroup>
<!-- Due to dependencies on resolving properties like: $(MicrosoftNetCoreAppRuntimePackRidDir) we need to import the default props at the end -->
<Import Project="$(MSBuildThisFileDirectory)AppleBuild.props" />

View file

@ -34,8 +34,38 @@
<GenerateCMakeProject>false</GenerateCMakeProject>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
<!-- Suppress trimming warnings as these are tests -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<NoWarn>$(NoWarn);IL2103;IL2105;IL2025;IL2111</NoWarn>
</PropertyGroup>
<!-- This .targets file is also imported by the runtime Trimming tests, and we want to be able to manually configure trimming in them so this
should be considered if we ever want to change the Condition of the ConfigureTrimming target -->
<Target Name="ConfigureTrimming" Condition="'$(UseNativeAOTRuntime)' != 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(SkipConfigureTrimming)' != 'true'">
<ItemGroup>
<!-- Mark all the assemblies for link. We will explicitly mark the non-trimmable ones -->
<AppleAssembliesToBundle TrimMode="$(TrimMode)" />
<!-- Don't trim the main assembly.
TrimMode="" is needed so the root assemblies are correctly identified -->
<AppleAssembliesToBundle TrimMode="" Condition="'%(FileName)' == '$(AssemblyName)'" />
<TrimmerRootAssembly
Condition="'%(AppleAssembliesToBundle.FileName)%(AppleAssembliesToBundle.Extension)' == '$(AssemblyName).dll'"
Include="%(AppleAssembliesToBundle.Identity)" />
<!-- PrepareForILLink target sets the IntermediateAssembly as an entry point for ILLink
which doesn't exist at the path when BuildTestsOnHelix -->
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
<ManagedAssemblyToLink Include="@(AppleAssembliesToBundle)">
<RelativePath>%(Filename)%(Extension)</RelativePath>
</ManagedAssemblyToLink>
</ItemGroup>
</Target>
<!-- Use local runtime pack -->
<Target Name="UpdateRuntimePack" AfterTargets="ResolveFrameworkReferences" DependsOnTargets="_PrepareAndValidateAppleInputs">
<Target Name="UpdateRuntimePack" AfterTargets="ResolveFrameworkReferences" DependsOnTargets="_PrepareAndValidateAppleInputs;ConfigureTrimming">
<ItemGroup>
<ResolvedRuntimePack PackageDirectory="$(MicrosoftNetCoreAppRuntimePackLocationToUse)"
Condition="'$(MicrosoftNetCoreAppRuntimePackLocationToUse)' != '' and

View file

@ -7,7 +7,11 @@
<ExtraFilesPath>$([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'extraFiles'))</ExtraFilesPath>
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'obj'))</BaseIntermediateOutputPath>
<AppleBuildDependsOn>_PrepareForAppleBuildAppOnHelix;$(AppleBuildDependsOn);_AfterAppleBuildOnHelix</AppleBuildDependsOn>
<AppleBuildDependsOn Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">ConfigureTrimming;_AdjustTrimmedAssembliesToBundle;$(AppleBuildDependsOn)</AppleBuildDependsOn>
<AppleBuildDependsOn>_PublishRuntimePack;_PrepareForAppleBuildAppOnHelix;$(AppleBuildDependsOn);_AfterAppleBuildOnHelix</AppleBuildDependsOn>
<!-- Forced by ILLink targets -->
<SelfContained>true</SelfContained>
<PublishDir>$(OriginalPublishDir)</PublishDir>
</PropertyGroup>
<PropertyGroup Condition="'$(UseNativeAOTRuntime)' == 'true'">
@ -18,12 +22,9 @@
<_IsApplePlatform>true</_IsApplePlatform>
<TargetsAppleMobile>true</TargetsAppleMobile>
<_targetOS>$(TargetOS)</_targetOS>
<!-- Forced by ILLink targets -->
<SelfContained>true</SelfContained>
</PropertyGroup>
<PropertyGroup Condition="'$(_UseNativeAOTLibraryModeBundling)' != 'true'">
<PropertyGroup Condition="'$(_UseNativeAOTLibraryModeBundling)' != 'true' and '$(UseNativeAOTRuntime)' == 'true'">
<!-- TODO: we probably want to recreate everything in the intermediate directory instead (see library mode bellow) -->
<IntermediateOutputPath>$(OriginalPublishDir)</IntermediateOutputPath>
<NativeLib>static</NativeLib>
@ -41,6 +42,12 @@
<StripSymbols>false</StripSymbols>
</PropertyGroup>
<ItemGroup>
<!-- ReferencePath is used in the _RunILLink target as the ReferenceAssemblyPaths parameter of ILLink -->
<ReferencePath Include="@(AppleReferenceSharedPathFiles->'$(MicrosoftNetCoreAppRuntimePackLibDir)%(FileName)%(Extension)')" />
<ReferencePath Include="@(AppleReferenceExtraPathFiles->'$(ExtraFilesPath)%(FileName)%(Extension)')" />
</ItemGroup>
<ItemGroup Condition="'$(UseNativeAOTRuntime)' == 'true'">
<DirectPInvoke Include="__Internal" />
</ItemGroup>
@ -49,14 +56,14 @@
<Target Name="BundleTestAppleApp" DependsOnTargets="AppleBuild" />
<Target Name="_PrepareForAppleBuildAppOnHelix" DependsOnTargets="_PublishRuntimePack">
<Target Name="_PrepareForAppleBuildAppOnHelix">
<Message Text="** Building a proxy for the original test project, to AOT on helix. In order to do that, this recreates the original inputs for the *iOS/tvOS* part of the build. See $(MSBuildThisFileFullPath), and $(_PropsFile). **"
Importance="High" />
<PropertyGroup>
<Optimized Condition="'$(Configuration)' == 'Release'">true</Optimized>
<MainLibraryFileName Condition="'$(MainLibraryFileName)' == '' and '$(IncludesTestRunner)' == 'true'">AppleTestRunner.dll</MainLibraryFileName>
<AppleBuildDir>$(OriginalPublishDir)</AppleBuildDir>
<AppleBundleDir>$(TestRootDir)AppBundle\</AppleBundleDir>
</PropertyGroup>
@ -89,6 +96,13 @@
<RuntimeComponents Include="marshal-ilgen" />
</ItemGroup>
<ItemGroup Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAOTRuntime)' != 'true'">
<TrimmerRootDescriptor Include="$(ExtraFilesPath)**\*.xml" />
<!-- 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 -->
<RuntimeHostConfigurationOption Remove="@(_AppleUsedRuntimeHostConfigurationOption)" />
<RuntimeHostConfigurationOption Include="@(_AppleUsedRuntimeHostConfigurationOption)" />
</ItemGroup>
</Target>
<Target Name="_PublishRuntimePack"
@ -103,6 +117,14 @@
DestinationFolder="$(OriginalPublishDir)" />
</Target>
<!-- 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. -->
<Target Name="_AdjustTrimmedAssembliesToBundle" DependsOnTargets="ILLink;CopyFilesToPublishDirectory">
<ItemGroup>
<AppleAssembliesToBundle Remove="@(AppleAssembliesToBundle)" />
<AppleAssembliesToBundle Include="$(OriginalPublishDir)**\*.dll" Exclude="$(OriginalPublishDir)\**\*.resources.dll;@(_RemovedManagedAssembly)" />
</ItemGroup>
</Target>
<!-- Move the app to where the xharness runner expects it. -->
<Target Name="_AfterAppleBuildOnHelix">
<PropertyGroup>