-
Notifications
You must be signed in to change notification settings - Fork 569
Expand file tree
/
Copy pathPostTrimmingAddKeepAlivesStep.cs
More file actions
30 lines (26 loc) · 1.03 KB
/
PostTrimmingAddKeepAlivesStep.cs
File metadata and controls
30 lines (26 loc) · 1.03 KB
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
using System;
using Java.Interop.Tools.Cecil;
using Mono.Cecil;
using Xamarin.Android.Tasks;
namespace MonoDroid.Tuner;
/// <summary>
/// Post-trimming version of AddKeepAlives that calls AddKeepAlivesHelper directly,
/// matching the original ILLink behavior (no IsAndroidUserAssembly pre-filter).
/// The helper has its own assembly-level guards (HasTypeReference, IsDotNetAndroidAssembly).
/// </summary>
class PostTrimmingAddKeepAlivesStep : IAssemblyModifierPipelineStep
{
readonly IMetadataResolver cache;
readonly Func<AssemblyDefinition?> getCorlibAssembly;
readonly Action<string> logMessage;
public PostTrimmingAddKeepAlivesStep (IMetadataResolver cache, Func<AssemblyDefinition?> getCorlibAssembly, Action<string> logMessage)
{
this.cache = cache;
this.getCorlibAssembly = getCorlibAssembly;
this.logMessage = logMessage;
}
public void ProcessAssembly (AssemblyDefinition assembly, StepContext context)
{
context.IsAssemblyModified |= AddKeepAlivesHelper.AddKeepAlives (assembly, cache, getCorlibAssembly, logMessage);
}
}