-
Notifications
You must be signed in to change notification settings - Fork 530
/
Microsoft.Android.Sdk.ILLink.targets
86 lines (79 loc) · 4.58 KB
/
Microsoft.Android.Sdk.ILLink.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!--
***********************************************************************************************
Microsoft.Android.Sdk.ILLink.targets
This file contains the .NET 5-specific targets to customize ILLink
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="_PrepareLinking"
Condition=" '$(PublishTrimmed)' == 'true' "
AfterTargets="ComputeResolvedFilesToPublishList"
DependsOnTargets="GetReferenceAssemblyPaths;_CreatePropertiesCache">
<ItemGroup>
<RuntimeHostConfigurationOption Include="Android.Runtime.AndroidEnvironment.VSAndroidDesignerIsEnabled"
Condition="'$(VSAndroidDesigner)' != ''"
Value="$(VSAndroidDesigner)"
Trim="true" />
<!-- Mark all assemblies to be linked for AndroidLinkMode=Full -->
<ResolvedFileToPublish
Update="@(ResolvedFileToPublish)"
Condition=" '$(AndroidLinkMode)' == 'Full' and '%(ResolvedFileToPublish.Extension)' == '.dll' and '%(ResolvedFileToPublish.AssetType)' != 'native' "
TrimMode="link"
/>
<!-- TODO: remove setting the trim mode here, once the support packages are updated to NET6 and compatability packages not needed -->
<ResolvedFileToPublish
Condition=" '$(AndroidLinkMode)' == 'SdkOnly' and ( $([System.String]::Copy(%(Filename)).StartsWith ('Xamarin.AndroidX.')) or $([System.String]::Copy(%(Filename)).StartsWith ('Xamarin.Android.Support.')) or $([System.String]::Copy(%(Filename)).StartsWith ('Xamarin.Google.')) or $([System.String]::Copy(%(Filename)).StartsWith ('Xamarin.GooglePlayServices.')) ) ">
<TrimMode>link</TrimMode>
</ResolvedFileToPublish>
<!-- Mark our entry assembly as a root assembly. -->
<TrimmerRootAssembly Include="@(ResolvedFileToPublish)" Condition=" '%(ResolvedFileToPublish.Filename)' == '$(AssemblyName)' and '%(ResolvedFileToPublish.Extension)' == '.dll' " />
</ItemGroup>
<PropertyGroup>
<!-- make the output verbose to see what the linker is doing. FIXME: make dependent upon verbosity level -->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose --deterministic --custom-data XATargetFrameworkDirectories="$(_XATargetFrameworkDirectories)"</_ExtraTrimmerArgs>
<_AdditionalTaskAssemblyDirectory>$(XamarinSdkRootDirectory)tools/dotnet-linker/</_AdditionalTaskAssemblyDirectory>
<_AdditionalTaskAssembly>$(_AdditionalTaskAssemblyDirectory)dotnet-linker.dll</_AdditionalTaskAssembly>
</PropertyGroup>
<PropertyGroup
Condition=" '$(AndroidAddKeepAlives)' != '' ">
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data AddKeepAlivesStep="$(AndroidAddKeepAlives)"</_ExtraTrimmerArgs>
</PropertyGroup>
<PropertyGroup
Condition=" '$(_ProguardProjectConfiguration)' != '' ">
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data ProguardConfiguration="$(_ProguardProjectConfiguration)"</_ExtraTrimmerArgs>
</PropertyGroup>
<PropertyGroup
Condition=" '$(AndroidLinkResources)' != '' ">
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data AndroidLinkResources="$(AndroidLinkResources)"</_ExtraTrimmerArgs>
</PropertyGroup>
<PropertyGroup
Condition=" '$(LinkerDumpDependencies)' == 'true' ">
<_ExtraTrimmerArgs>--dump-dependencies $(_ExtraTrimmerArgs)"</_ExtraTrimmerArgs>
</PropertyGroup>
<ItemGroup>
<!-- add our custom steps -->
<_TrimmerCustomSteps Include="$(MSBuildThisFileDirectory)..\tools\Microsoft.Android.Sdk.ILLink.dll">
<BeforeStep>MarkStep</BeforeStep>
<Type>Microsoft.Android.Sdk.ILLink.SetupStep</Type>
</_TrimmerCustomSteps>
</ItemGroup>
<ItemGroup>
<_PreserveLists Include="$(MSBuildThisFileDirectory)..\PreserveLists\*.xml" />
<TrimmerRootDescriptor
Condition=" '@(ResolvedFileToPublish->Count())' != '0' and '%(Filename)' != '' "
Include="@(_PreserveLists)" />
<TrimmerRootDescriptor Include="@(LinkDescription)" />
</ItemGroup>
</Target>
<Target Name="_LinkAssemblies"
DependsOnTargets="_ResolveAssemblies;_CreatePackageWorkspace;$(_BeforeLinkAssemblies);_GenerateJniMarshalMethods;_LinkAssembliesNoShrink"
/>
<Target Name="_TouchAndroidLinkFlag"
AfterTargets="ILLink"
Condition=" '$(PublishTrimmed)' == 'true' and Exists('$(_LinkSemaphore)') "
Inputs="$(_LinkSemaphore)"
Outputs="$(_AndroidLinkFlag)">
<!-- This file is an input for _RemoveRegisterAttribute -->
<Touch Files="$(_AndroidLinkFlag)" AlwaysCreate="true" />
</Target>
</Project>