You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This moves:
* C# code from `samples/NativeAOT` to a new assembly,
`Microsoft.Android.Runtime.NativeAOT.dll`.
* Java code from `samples/NativeAOT` to
`Xamarin.Android.Build.Tasks`, to be generated at build time.
* C# code from `Java.Interop.Environment.csproj` has been trimmed
down, copied into `Microsoft.Android.Runtime.NativeAOT.dll`.
* Minimum Viable Product™ "typemap" implementation.
* Change namespace to `Microsoft.Android.Runtime`
## Minimum Viable Product™ typemaps
A quick-and-dirty -- and totally unoptimized -- typemap implementation
has been added as a new `TypeMappingStep` into
`Microsoft.Android.Sdk.ILLink`.
Given this initial starting point within `NativeAotTypeManager`:
partial class NativeAotTypeManager {
IDictionary<string, Type> TypeMappings = new Dictionary<string, Type>(StringComparer.Ordinal);
NativeAotTypeManager ()
{
InitializeTypeMappings ();
}
void InitializeTypeMappings ()
{
throw new InvalidOperationException ("Should be replaced at build time!");
}
}
then at build time `TypeMappingStep` will *replace* the body of
`NativeAotTypeManager.InitializeTypeMappings()` with repeated
`IDictionary<string, Type>.Add()` calls for each type which survived
linking:
// Cecil-generated code, C# equivalent
void InitializeTypeMappings ()
{
TypeMappings.Add ("java/lang/Object", typeof (Java.Lang.Object));
TypeMappings.Add ("android/app/Application", typeof (Android.App.Application));
// …
}
// NOTE: suppressions below also in `src/Mono.Android/Android.Runtime/AndroidRuntime.cs`
74
+
[UnconditionalSuppressMessage("Trimming","IL2057",Justification="Type.GetType() can never statically know the string value parsed from parameter 'methods'.")]
75
+
[UnconditionalSuppressMessage("Trimming","IL2067",Justification="Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")]
76
+
[UnconditionalSuppressMessage("Trimming","IL2072",Justification="Delegate.CreateDelegate() can never statically know the string value parsed from parameter 'methods'.")]
// Originally from: https://github.com/dotnet/java-interop/blob/dd3c1d0514addfe379f050627b3e97493e985da6/src/Java.Runtime.Environment/Java.Interop/JreRuntime.cs
2
+
usingSystem;
3
+
usingSystem.Collections.Generic;
4
+
usingSystem.Collections.ObjectModel;
5
+
usingSystem.Diagnostics;
6
+
usingSystem.Diagnostics.CodeAnalysis;
7
+
usingSystem.Globalization;
8
+
usingSystem.IO;
9
+
usingSystem.Linq;
10
+
usingSystem.Reflection;
11
+
usingSystem.Runtime.InteropServices;
12
+
usingSystem.Threading;
13
+
usingMicrosoft.Android.Runtime;
14
+
15
+
namespaceJava.Interop{
16
+
17
+
structJavaVMInitArgs{
18
+
#pragma warning disable CS0649// Field is never assigned to;
19
+
publicJniVersionversion;/* use JNI_VERSION_1_2 or later */
0 commit comments