From 59cbd309763bd2b4496ad888dafcf207936688df Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Tue, 18 Feb 2025 19:32:04 +0100 Subject: [PATCH 01/11] Another set of changes from #9572 --- Configuration.props | 8 +- .../Microsoft.Android.Runtime.proj | 27 ++- .../Android.Runtime/DotNetRuntimeType.cs | 32 +++ .../Android.Runtime/JNIEnvInit.cs | 7 +- src/Mono.Android/Mono.Android.csproj | 1 + .../Tasks/GenerateJavaStubs.cs | 2 +- ...pplicationConfigNativeAssemblyGenerator.cs | 6 + .../LlvmIrGenerator/LlvmIrGenerator.cs | 20 +- .../LlvmIrGenerator/MemberInfoUtilities.cs | 12 ++ .../NativeAssemblerAttribute.cs | 23 ++ .../LlvmIrGenerator/StructureMemberInfo.cs | 27 +++ .../Utilities/ManifestDocument.cs | 13 +- .../Utilities/MonoAndroidHelper.Basic.cs | 2 + .../Utilities/TypeMapGenerator.cs | 11 +- .../Utilities/TypeMapHelper.cs | 14 +- src/native/CMakeLists.txt | 138 +++++++++--- src/native/CMakePresets.json.in | 1 - .../common/include/managed-interface.hh | 55 +++++ .../common/include/runtime-base/search.hh | 13 +- src/native/common/java-interop/CMakeLists.txt | 3 +- src/native/mono/monodroid/CMakeLists.txt | 6 +- .../mono/monodroid/monodroid-glue-internal.hh | 41 +--- src/native/mono/monodroid/monodroid-glue.cc | 1 + .../mono/pinvoke-override/CMakeLists.txt | 2 +- .../generate-pinvoke-tables.cc | 4 +- .../pinvoke-override/pinvoke-tables.include | 2 +- src/native/mono/runtime-base/CMakeLists.txt | 2 +- src/native/mono/shared/CMakeLists.txt | 5 +- src/native/mono/shared/cpp-util.hh | 2 +- src/native/mono/tracing/CMakeLists.txt | 2 +- .../mono/xamarin-app-stub/CMakeLists.txt | 2 +- .../xamarin-debug-app-helper/CMakeLists.txt | 2 +- src/native/native-mono.csproj | 3 +- src/native/native.targets | 204 +++++++++++------- 34 files changed, 506 insertions(+), 187 deletions(-) create mode 100644 src/Mono.Android/Android.Runtime/DotNetRuntimeType.cs create mode 100644 src/native/common/include/managed-interface.hh diff --git a/Configuration.props b/Configuration.props index a9348d6de96..07a4740807e 100644 --- a/Configuration.props +++ b/Configuration.props @@ -56,16 +56,18 @@ Microsoft.Android.Sdk.Darwin + $(BuildOutputDirectory)lib\packs\ False False <_XABinRelativeInstallPrefix>lib\xamarin.android $(MSBuildThisFileDirectory)bin\$(Configuration)\$(_XABinRelativeInstallPrefix)\ <_MonoAndroidNETOutputRoot>$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\ <_MonoAndroidNETDefaultOutDir>$(_MonoAndroidNETOutputRoot)$(AndroidApiLevel)\ - $(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidApiLevel)\$(AndroidPackVersion)\ref\$(DotNetTargetFramework)\ - $(BuildOutputDirectory)lib\packs\$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\ + $(BuildOutputDirectory)lib\runtimes\ + $(MicrosoftAndroidPacksRootDir)Microsoft.Android.Ref.$(AndroidApiLevel)\$(AndroidPackVersion)\ref\$(DotNetTargetFramework)\ + $(MicrosoftAndroidPacksRootDir)$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\ $(MicrosoftAndroidSdkPackDir)\tools\ - $(BuildOutputDirectory)lib\packs\Microsoft.Android.Ref.$(AndroidLatestStableApiLevel)\$(AndroidPackVersion)\analyzers\dotnet\cs\ + $(MicrosoftAndroidPacksRootDir)Microsoft.Android.Ref.$(AndroidLatestStableApiLevel)\$(AndroidPackVersion)\analyzers\dotnet\cs\ -j$(HostCpuCount) mono --debug=casts diff --git a/build-tools/create-packs/Microsoft.Android.Runtime.proj b/build-tools/create-packs/Microsoft.Android.Runtime.proj index 5f19f16ffdc..af99678ba05 100644 --- a/build-tools/create-packs/Microsoft.Android.Runtime.proj +++ b/build-tools/create-packs/Microsoft.Android.Runtime.proj @@ -31,6 +31,8 @@ projects that use the Microsoft.Android framework in .NET 6+. DependsOnTargets="_GetLicense"> $(IntermediateOutputPath)$(AndroidRID)\RuntimeList.xml + <_RuntimeFlavorDirName Condition=" '$(AndroidRuntime)' == 'CoreCLR' ">clr + <_RuntimeFlavorDirName Condition=" '$(AndroidRuntime)' == 'Mono' Or '$(AndroidRuntime)' == '' ">mono @@ -45,12 +47,27 @@ projects that use the Microsoft.Android framework in .NET 6+. <_AndroidRuntimePackAssemblies Include="$(_MonoAndroidNETOutputRoot)$(AndroidLatestStableApiLevel)\Mono.Android.Export.dll" /> + + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.debug.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.debug.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.release.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libnet-android.release.so" /> + + - <_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libmono-android.debug.so" /> - <_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libmono-android.release.so" /> - <_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libxamarin-debug-app-helper.so" /> - <_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libxamarin-native-tracing.so" /> - <_AndroidRuntimePackAssets Include="$(MicrosoftAndroidSdkOutDir)lib\$(AndroidRID)\libunwind_xamarin.a" /> + <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.debug.so" /> + <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.release.so" /> + <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-debug-app-helper.so" /> + <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-native-tracing.so" /> + <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libunwind_xamarin.a" /> + + + + + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\liblog.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\liblog.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libm.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libm.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libz.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libz.so" /> + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so" /> diff --git a/src/Mono.Android/Android.Runtime/DotNetRuntimeType.cs b/src/Mono.Android/Android.Runtime/DotNetRuntimeType.cs new file mode 100644 index 00000000000..db0afcd495e --- /dev/null +++ b/src/Mono.Android/Android.Runtime/DotNetRuntimeType.cs @@ -0,0 +1,32 @@ +using System; + +namespace Android.Runtime; + +enum DotNetRuntimeType +{ + Unknown, + MonoVM, + CoreCLR, + NativeAOT, +} + +// This looks weird, see comments in RuntimeTypeInternal.cs +class DotNetRuntimeTypeConverter +{ + // Values for the JnienvInitializeArgs.runtimeType field + // + // NOTE: Keep this in sync with managed side in src/native/common/include/managed-interface.hh + const uint RuntimeTypeMonoVM = 0x0001; + const uint RuntimeTypeCoreCLR = 0x0002; + const uint RuntimeTypeNativeAOT = 0x0004; + + public static DotNetRuntimeType Convert (uint runtimeType) + { + return runtimeType switch { + RuntimeTypeMonoVM => DotNetRuntimeType.MonoVM, + RuntimeTypeCoreCLR => DotNetRuntimeType.CoreCLR, + RuntimeTypeNativeAOT => DotNetRuntimeType.NativeAOT, + _ => throw new NotSupportedException ($"Internal error: unsupported runtime type {runtimeType:x}") + }; + } +} diff --git a/src/Mono.Android/Android.Runtime/JNIEnvInit.cs b/src/Mono.Android/Android.Runtime/JNIEnvInit.cs index 2499b693cf2..8c4ed9c5b7b 100644 --- a/src/Mono.Android/Android.Runtime/JNIEnvInit.cs +++ b/src/Mono.Android/Android.Runtime/JNIEnvInit.cs @@ -13,7 +13,7 @@ namespace Android.Runtime static internal class JNIEnvInit { #pragma warning disable 0649 - // NOTE: Keep this in sync with the native side in src/native/monodroid/monodroid-glue-internal.hh + // NOTE: Keep this in sync with the native side in src/native/common/include/managed-interface.hh internal struct JnienvInitializeArgs { public IntPtr javaVm; public IntPtr env; @@ -32,6 +32,7 @@ internal struct JnienvInitializeArgs { public bool jniRemappingInUse; public bool marshalMethodsEnabled; public IntPtr grefGCUserPeerable; + public uint runtimeType; } #pragma warning restore 0649 @@ -48,6 +49,8 @@ internal struct JnienvInitializeArgs { internal static JniRuntime? androidRuntime; + public static DotNetRuntimeType RuntimeType { get; private set; } = DotNetRuntimeType.Unknown; + [UnmanagedCallersOnly] static unsafe void RegisterJniNatives (IntPtr typeName_ptr, int typeName_len, IntPtr jniClass, IntPtr methods_ptr, int methods_len) { @@ -87,6 +90,8 @@ internal static void InitializeJniRuntime (JniRuntime runtime) [UnmanagedCallersOnly] internal static unsafe void Initialize (JnienvInitializeArgs* args) { + RuntimeType = DotNetRuntimeTypeConverter.Convert (args->runtimeType); + IntPtr total_timing_sequence = IntPtr.Zero; IntPtr partial_timing_sequence = IntPtr.Zero; diff --git a/src/Mono.Android/Mono.Android.csproj b/src/Mono.Android/Mono.Android.csproj index 6c409057f53..c454b84895c 100644 --- a/src/Mono.Android/Mono.Android.csproj +++ b/src/Mono.Android/Mono.Android.csproj @@ -221,6 +221,7 @@ + diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs index a908645c829..5bb3b0d403d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs @@ -480,7 +480,7 @@ void SaveResource (string resource, string filename, string destDir, Func 1; string? prevItemComment = null; ulong counter = 0; + bool writeStringInComment = !ignoreComments && (elementType == typeof(string) || elementType == typeof(StringHolder)); if (entries != null) { foreach (object entry in entries) { @@ -871,7 +875,13 @@ void WriteArrayEntries (GeneratorWriteContext context, LlvmIrVariable variable, } if (writeIndices && String.IsNullOrEmpty (prevItemComment)) { - prevItemComment = $" {counter}"; + string stringComment = String.Empty; + if (writeStringInComment) { + var holder = StringHolder.AsHolder (entry); + stringComment = $" ('{holder.Data}')"; + } + + prevItemComment = $" {counter}{stringComment}"; } } @@ -1098,6 +1108,10 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si) context.IncreaseIndent (); for (int i = 0; i < si.Members.Count; i++) { StructureMemberInfo info = si.Members[i]; + if (!info.IsSupportedForTarget (context.Target)) { + continue; + } + string nativeType = MapManagedTypeToNative (info.MemberType); // TODO: nativeType can be an array, update to indicate that (and get the size) @@ -1108,7 +1122,7 @@ void WriteStructureDeclaration (GeneratorWriteContext context, StructureInfo si) arraySize = String.Empty; } - var comment = $" {nativeType} {info.Info.Name}{arraySize}"; + var comment = $" {nativeType} {info.MappedName}{arraySize}"; WriteStructureDeclarationField (info.IRType, comment, i == si.Members.Count - 1); } context.DecreaseIndent (); diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/MemberInfoUtilities.cs b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/MemberInfoUtilities.cs index 500e5f8f398..aac8b8b3636 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/MemberInfoUtilities.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/MemberInfoUtilities.cs @@ -56,6 +56,18 @@ public static LlvmIrStringEncoding GetStringEncoding (this MemberInfo mi, LlvmIr return attr.IsUTF16 ? LlvmIrStringEncoding.Unicode : DefaultStringEncoding; } + public static string? GetOverriddenName (this MemberInfo mi, LlvmIrTypeCache cache) + { + var attr = cache.GetNativeAssemblerAttribute (mi); + return attr != null ? attr.MemberName : null; + } + + public static NativeAssemblerValidTarget GetValidTarget (this MemberInfo mi, LlvmIrTypeCache cache) + { + var attr = cache.GetNativeAssemblerAttribute (mi); + return attr != null ? attr.ValidTarget : NativeAssemblerValidTarget.Any; + } + public static bool ShouldBeIgnored (this MemberInfo mi, LlvmIrTypeCache cache) { var attr = cache.GetNativeAssemblerAttribute (mi); diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/NativeAssemblerAttribute.cs b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/NativeAssemblerAttribute.cs index 58b86b29dc4..8bf20c60513 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/NativeAssemblerAttribute.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/NativeAssemblerAttribute.cs @@ -2,6 +2,13 @@ namespace Xamarin.Android.Tasks { + enum NativeAssemblerValidTarget + { + Any, + ThirtyTwoBit, + SixtyFourBit, + } + [AttributeUsage (AttributeTargets.Field | AttributeTargets.Property, Inherited = true)] class NativeAssemblerAttribute : Attribute { @@ -41,6 +48,22 @@ class NativeAssemblerAttribute : Attribute /// the native assembly file. /// public bool IsUTF16 { get; set; } + + /// + /// Allows choosing that a structure/class field/property will be considered only for the target of + /// specific bitness. Mainly useful when dealing with hash fields. + /// + public NativeAssemblerValidTarget ValidTarget { get; set; } = NativeAssemblerValidTarget.Any; + + /// + /// Allows overriding of the field name when mapping the structure. This is purely cosmetic, but allows to avoid + /// confusion when dealing with fields/properties that have a different size for 32-bit and 64-bit targets. In such + /// case the structure being mapped will have a separate member per bitness, with the members requiring different names + /// while in reality they have the same name in the native world, regardless of bitness. + /// + /// This field is only considered only when is not set to + /// + public string? MemberName { get; set; } } [AttributeUsage (AttributeTargets.Class, Inherited = true)] diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/StructureMemberInfo.cs b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/StructureMemberInfo.cs index a93c232561b..76baddf1d34 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/StructureMemberInfo.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator/StructureMemberInfo.cs @@ -27,9 +27,25 @@ sealed class StructureMemberInfo public bool IsInlineArray { get; } public bool NeedsPadding { get; } + /// + /// Some fields/properties may override their name for presentation purposes, . + /// In such instances, this property will return the overridden/mapped name, otherwise it returns . + /// This property should be used only for "presentation" purposes - for instance when generating comments which refer to + /// native field names. + /// + public string MappedName { + get { + string? name = Info.GetOverriddenName (typeCache); + return String.IsNullOrEmpty (name) ? Info.Name : name; + } + } + + readonly LlvmIrTypeCache typeCache; + public StructureMemberInfo (MemberInfo mi, LlvmIrModule module, LlvmIrTypeCache cache) { Info = mi; + typeCache = cache; MemberType = mi switch { FieldInfo fi => fi.FieldType, @@ -97,6 +113,17 @@ public StructureMemberInfo (MemberInfo mi, LlvmIrModule module, LlvmIrTypeCache } } + public bool IsSupportedForTarget (LlvmIrModuleTarget target) + { + NativeAssemblerValidTarget validTarget = Info.GetValidTarget (typeCache); + return validTarget switch { + NativeAssemblerValidTarget.Any => true, + NativeAssemblerValidTarget.ThirtyTwoBit => !target.Is64Bit, + NativeAssemblerValidTarget.SixtyFourBit => target.Is64Bit, + _ => throw new NotSupportedException ($"Internal error: unsupported native assembler valid target value: {validTarget}") + }; + } + public object? GetValue (object instance) { if (Info is FieldInfo fi) { diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs b/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs index 0930f930428..cb42ffafaac 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs @@ -673,14 +673,13 @@ XElement CreateApplicationElement (XElement manifest, string applicationClass, L IList AddMonoRuntimeProviders (XElement app) { - if (AndroidRuntime == AndroidRuntime.CoreCLR) { - //TODO: implement provider logic for CoreCLR - return []; - } + (string packageName, string className) = AndroidRuntime switch { + AndroidRuntime.MonoVM => ("mono", "MonoRuntimeProvider"), + AndroidRuntime.CoreCLR => ("mono", "MonoRuntimeProvider"), + AndroidRuntime.NativeAOT => ("net.dot.jni.nativeaot", "NativeAotRuntimeProvider"), + _ => throw new NotSupportedException ($"Internal error: unsupported runtime type: {AndroidRuntime}") + }; - bool isMonoVM = AndroidRuntime == AndroidRuntime.MonoVM; - string packageName = isMonoVM ? "mono" : "net.dot.jni.nativeaot"; - string className = isMonoVM ? "MonoRuntimeProvider" : "NativeAotRuntimeProvider"; app.Add (CreateMonoRuntimeProvider ($"{packageName}.{className}", null, --AppInitOrder)); var providerNames = new List (); diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Basic.cs b/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Basic.cs index e87e3b7a96b..a0c5bc10cbe 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Basic.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Basic.cs @@ -149,6 +149,7 @@ public static string ArchToAbi (AndroidTargetArch arch) } public static bool IsValidAbi (string abi) => AbiToRidMap.ContainsKey (abi); + public static bool IsValidRID (string rid) => RidToAbiMap.ContainsKey (rid); public static string? CultureInvariantToString (object? obj) { @@ -228,6 +229,7 @@ public static ulong GetMangledAssemblyNameSizeOverhead () } public static byte[] Utf8StringToBytes (string str) => Encoding.UTF8.GetBytes (str); + public static byte[] Utf16StringToBytes (string str) => Encoding.Unicode.GetBytes (str); public static ulong GetXxHash (string str, bool is64Bit) => GetXxHash (Utf8StringToBytes (str), is64Bit); diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs b/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs index bae482b121d..32ee751b0c2 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs @@ -131,13 +131,15 @@ public void AddKnownAssembly (TypeDefinition td) readonly byte[] typemapIndexMagicString; readonly TaskLoggingHelper log; readonly NativeCodeGenState state; + readonly AndroidRuntime runtime; public IList GeneratedBinaryTypeMaps { get; } = new List (); - public TypeMapGenerator (TaskLoggingHelper log, NativeCodeGenState state) + public TypeMapGenerator (TaskLoggingHelper log, NativeCodeGenState state, AndroidRuntime runtime) { this.log = log ?? throw new ArgumentNullException (nameof (log)); this.state = state ?? throw new ArgumentNullException (nameof (state)); + this.runtime = runtime; outputEncoding = Files.UTF8withoutBOM; moduleMagicString = outputEncoding.GetBytes (TypeMapMagicString); typemapIndexMagicString = outputEncoding.GetBytes (TypeMapIndexMagicString); @@ -444,7 +446,12 @@ bool GenerateRelease (bool skipJniAddNativeMethodRegistrationAttributeScan, stri module.Types = module.TypesScratch.Values.ToArray (); } - var composer = new TypeMappingReleaseNativeAssemblyGenerator (log, new NativeTypeMappingData (log, modules)); + LLVMIR.LlvmIrComposer composer = runtime switch { + AndroidRuntime.MonoVM => new TypeMappingReleaseNativeAssemblyGenerator (log, new NativeTypeMappingData (log, modules)), + AndroidRuntime.CoreCLR => throw new NotImplementedException ("CoreCLR support not implemented yet"), + _ => throw new NotSupportedException ($"Internal error: unsupported runtime {runtime}") + }; + GenerateNativeAssembly (composer, composer.Construct (), outputDirectory); return true; diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapHelper.cs b/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapHelper.cs index 5da1f7722df..0366033f173 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapHelper.cs @@ -7,7 +7,7 @@ namespace Xamarin.Android.Tasks; static class TypeMapHelper { /// - /// Hash the given Java type name for use in java-to-managed typemap array. + /// Hash the given Java type name for use in java-to-managed typemap array (MonoVM version) /// public static ulong HashJavaName (string name, bool is64Bit) { @@ -20,6 +20,18 @@ public static ulong HashJavaName (string name, bool is64Bit) return HashBytes (Encoding.Unicode.GetBytes (name), is64Bit); } + /// + /// Hash the given Java type name for use in java-to-managed typemap array (CoreCLR version) + /// + public static ulong HashJavaNameForCLR (string name, bool is64Bit) + { + if (name.Length == 0) { + return UInt64.MaxValue; + } + + return HashBytes (Encoding.UTF8.GetBytes (name), is64Bit); + } + static ulong HashBytes (byte[] bytes, bool is64Bit) { if (is64Bit) { diff --git a/src/native/CMakeLists.txt b/src/native/CMakeLists.txt index 72b2165bd4d..a1cee1367a6 100644 --- a/src/native/CMakeLists.txt +++ b/src/native/CMakeLists.txt @@ -10,7 +10,7 @@ project( android-native-bits VERSION ${XA_VERSION} DESCRIPTION ".NET for Android native runtime" - HOMEPAGE_URL "https://github.com/xamarin/xamarin-android" + HOMEPAGE_URL "https://github.com/dotnet/android" LANGUAGES CXX C ASM ) @@ -29,6 +29,7 @@ ensure_variable_set(CMAKE_BUILD_TYPE) ensure_variable_set(OUTPUT_PATH) ensure_variable_set(XA_BUILD_CONFIGURATION) ensure_variable_set(XA_LIB_TOP_DIR) +ensure_variable_set(RUNTIME_FLAVOR) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_PATH}/${ANDROID_RID}" CACHE PATH "" FORCE) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}/${ANDROID_RID}" CACHE PATH "" FORCE) @@ -44,6 +45,19 @@ set(CMAKE_C_EXTENSIONS OFF) include("${CMAKE_ANDROID_NDK}/build/cmake/abis.cmake") include("${CMAKE_SOURCE_DIR}/cmake/ArchiveDSOStub.cmake") +string(TOLOWER "${RUNTIME_FLAVOR}" RUNTIME_FLAVOR_LOWER) +if (RUNTIME_FLAVOR_LOWER STREQUAL monovm) + set(IS_MONO_RUNTIME True) + set(IS_CLR_RUNTIME False) + set(SOURCES_PREFIX "mono") +elseif(RUNTIME_FLAVOR_LOWER STREQUAL coreclr) + set(IS_MONO_RUNTIME False) + set(IS_CLR_RUNTIME True) + set(SOURCES_PREFIX "clr") +else() + message(FATAL "Unknown runtime flavor ${RUNTIME_FLAVOR}") +endif() + if(CMAKE_BUILD_TYPE STREQUAL Debug) set(DEBUG_BUILD True) else() @@ -140,17 +154,43 @@ include("${XA_BUILD_DIR}/xa_build_configuration.cmake") # # Paths # +if(IS_CLR_RUNTIME) + set(RUNTIME_DIR_ARM64 "${CORECLR_APP_RUNTIME_DIR_ARM64}") + set(RUNTIME_DIR_ARM "${CORECLR_APP_RUNTIME_DIR_ARM}") + set(RUNTIME_DIR_X86_64 "${CORECLR_APP_RUNTIME_DIR_X86_64}") + set(RUNTIME_DIR_X86 "${CORECLR_APP_RUNTIME_DIR_X86}") + + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_NETCORE_RUNTIME_DIR_ARM64 "${NETCORE_APP_RUNTIME_DIR_ARM64}") + set(TEMP_NETCORE_RUNTIME_DIR_ARM "${NETCORE_APP_RUNTIME_DIR_ARM}") + set(TEMP_NETCORE_RUNTIME_DIR_X86_64 "${NETCORE_APP_RUNTIME_DIR_X86_64}") + set(TEMP_NETCORE_RUNTIME_DIR_X86 "${NETCORE_APP_RUNTIME_DIR_X86}") +elseif(IS_MONO_RUNTIME) + set(RUNTIME_DIR_ARM64 "${NETCORE_APP_RUNTIME_DIR_ARM64}") + set(RUNTIME_DIR_ARM "${NETCORE_APP_RUNTIME_DIR_ARM}") + set(RUNTIME_DIR_X86_64 "${NETCORE_APP_RUNTIME_DIR_X86_64}") + set(RUNTIME_DIR_X86 "${NETCORE_APP_RUNTIME_DIR_X86}") +endif() + if(ANDROID_ABI MATCHES "^arm64-v8a") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM64}") + set(NET_RUNTIME_DIR "${RUNTIME_DIR_ARM64}") + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_NETCORE_NET_RUNTIME_DIR "${TEMP_NETCORE_RUNTIME_DIR_ARM64}") set(TOOLCHAIN_TRIPLE "${NDK_ABI_arm64-v8a_TRIPLE}") elseif(ANDROID_ABI MATCHES "^armeabi-v7a") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_ARM}") + set(NET_RUNTIME_DIR "${RUNTIME_DIR_ARM}") + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_NETCORE_NET_RUNTIME_DIR "${TEMP_NETCORE_RUNTIME_DIR_ARM}") set(TOOLCHAIN_TRIPLE "${NDK_ABI_armeabi-v7a_TRIPLE}") elseif(ANDROID_ABI MATCHES "^x86_64") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86_64}") + set(NET_RUNTIME_DIR "${RUNTIME_DIR_X86_64}") + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_NETCORE_NET_RUNTIME_DIR "${TEMP_NETCORE_RUNTIME_DIR_X86_64}") set(TOOLCHAIN_TRIPLE "${NDK_ABI_x86_64_TRIPLE}") elseif(ANDROID_ABI MATCHES "^x86") - set(NET_RUNTIME_DIR "${NETCORE_APP_RUNTIME_DIR_X86}") + set(NET_RUNTIME_DIR "${RUNTIME_DIR_X86}") + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_NETCORE_NET_RUNTIME_DIR "${TEMP_NETCORE_RUNTIME_DIR_X86}") set(TOOLCHAIN_TRIPLE "${NDK_ABI_x86_TRIPLE}") else() message(FATAL "${ANDROID_ABI} is not supported for .NET 6+ builds") @@ -167,11 +207,37 @@ set(ROBIN_MAP_DIR "${EXTERNAL_DIR}/robin-map") # Include directories # set(SYSROOT_CXX_INCLUDE_DIR ${CMAKE_SYSROOT}/usr/include/c++/v1) -set(MONO_RUNTIME_INCLUDE_DIR ${NET_RUNTIME_DIR}/native/include/mono-2.0) + +if(IS_MONO_RUNTIME) + set(RUNTIME_INCLUDE_DIR ${NET_RUNTIME_DIR}/native/include/mono-2.0) +else() + # TEMPORARY: for now JI needs to build with MonoVM embedding APIs + set(TEMP_MONO_RUNTIME_INCLUDE_DIR ${TEMP_NETCORE_NET_RUNTIME_DIR}/native/include/mono-2.0) + set(RUNTIME_INCLUDE_DIR ${NET_RUNTIME_DIR}/native/include/clr) +endif() + set(JAVA_INTEROP_INCLUDE_DIR ${JAVA_INTEROP_SRC_PATH}) +set(CONSTEXPR_XXH3_DIR "${EXTERNAL_DIR}/constexpr-xxh3") +set(XXHASH_DIR "${EXTERNAL_DIR}/xxHash") include_directories(common/include) -include_directories(mono) + +if(IS_CLR_RUNTIME) + set(XA_RUNTIME_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/clr/include) + + macro(xa_add_include_directories TARGET) + target_include_directories( + ${TARGET} + PRIVATE + ${XA_RUNTIME_INCLUDE_DIR} + ${EXTERNAL_DIR} + ${CONSTEXPR_XXH3_DIR} + ${RUNTIME_INCLUDE_DIR} + ) + endmacro() +else() + include_directories(mono) +endif() # # Compiler defines @@ -192,6 +258,21 @@ macro(xa_add_compile_definitions TARGET) ANDROID64 ) endif() + + if(IS_CLR_RUNTIME) + target_compile_definitions( + ${TARGET} + PRIVATE + TARGET_ANDROID + XA_HOST_CLR + ) + else() + target_compile_definitions( + ${TARGET} + PRIVATE + XA_HOST_MONOVM + ) + endif() endmacro() if(NOT BUILD_ARCHIVE_DSO_STUB) @@ -485,26 +566,35 @@ endmacro() if(BUILD_ARCHIVE_DSO_STUB) add_subdirectory(common/archive-dso-stub) else() + add_subdirectory(common/java-interop) + add_subdirectory(common/libstub) add_subdirectory(common/libunwind) add_subdirectory(common/lz4) - add_subdirectory(common/libstub) - add_subdirectory(mono/shared) - add_subdirectory(common/java-interop) - add_subdirectory(mono/xamarin-app-stub) - add_subdirectory(mono/runtime-base) - add_subdirectory(mono/tracing) - add_subdirectory(mono/pinvoke-override) - if(DEBUG_BUILD) - add_subdirectory(mono/xamarin-debug-app-helper) - endif() + add_subdirectory(${SOURCES_PREFIX}/runtime-base) + add_subdirectory(${SOURCES_PREFIX}/shared) + add_subdirectory(${SOURCES_PREFIX}/xamarin-app-stub) - add_subdirectory(mono/monodroid) + if (IS_MONO_RUNTIME) + add_subdirectory(mono/tracing) + add_subdirectory(mono/pinvoke-override) - add_custom_target(run_static_analysis - COMMAND ${ANDROID_TOOLCHAIN_ROOT}/bin/clang-check -analyze -p="${CMAKE_CURRENT_BINARY_DIR}" ${CLANG_CHECK_SOURCES} > ${CMAKE_SOURCE_DIR}/static-analysis.${ANDROID_ABI}.${CMAKE_BUILD_TYPE}.txt 2>&1 - COMMAND_EXPAND_LISTS - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - USES_TERMINAL - ) + if(DEBUG_BUILD) + add_subdirectory(mono/xamarin-debug-app-helper) + endif() + + add_subdirectory(mono/monodroid) + + add_custom_target(run_static_analysis + COMMAND ${ANDROID_TOOLCHAIN_ROOT}/bin/clang-check -analyze -p="${CMAKE_CURRENT_BINARY_DIR}" ${CLANG_CHECK_SOURCES} > ${CMAKE_SOURCE_DIR}/static-analysis.${ANDROID_ABI}.${CMAKE_BUILD_TYPE}.txt 2>&1 + COMMAND_EXPAND_LISTS + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + USES_TERMINAL + ) + endif() + + if (IS_CLR_RUNTIME) + add_subdirectory(clr/host) + add_subdirectory(clr/startup) + endif() endif() diff --git a/src/native/CMakePresets.json.in b/src/native/CMakePresets.json.in index 33c910f6845..5544b1252b0 100644 --- a/src/native/CMakePresets.json.in +++ b/src/native/CMakePresets.json.in @@ -21,7 +21,6 @@ "ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES": "ON", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_MAKE_PROGRAM": "@NinjaPath@", - "OUTPUT_PATH": "@OutputPath@", "XA_LIB_TOP_DIR": "@MicrosoftAndroidSdkOutDir@", "XA_BUILD_CONFIGURATION": "@XA_BUILD_CONFIGURATION@" } diff --git a/src/native/common/include/managed-interface.hh b/src/native/common/include/managed-interface.hh new file mode 100644 index 00000000000..a755b060cf8 --- /dev/null +++ b/src/native/common/include/managed-interface.hh @@ -0,0 +1,55 @@ +#pragma once + +#include + +#include + +namespace xamarin::android { + // Values for the JnienvInitializeArgs.runtimeType field + // + // NOTE: Keep this in sync with managed side in src/Mono.Android/Android.Runtime/DotNetRuntimeType.cs + static inline constexpr uint32_t RuntimeTypeMonoVM = 0x0001; + static inline constexpr uint32_t RuntimeTypeCoreCLR = 0x0002; + static inline constexpr uint32_t RuntimeTypeNativeAOT = 0x0004; + + // Values must be identical to those in src/Mono.Android/Android.Runtime/RuntimeNativeMethods.cs + enum class TraceKind : uint32_t + { + Java = 0x01, + Managed = 0x02, + Native = 0x04, + Signals = 0x08, + }; + + // NOTE: Keep this in sync with managed side in src/Mono.Android/Android.Runtime/JNIEnvInit.cs + struct JnienvInitializeArgs { + JavaVM *javaVm; + JNIEnv *env; + jobject grefLoader; + jmethodID Loader_loadClass; + jclass grefClass; + unsigned int logCategories; + int version; + int grefGcThreshold; + jobject grefIGCUserPeer; + int isRunningOnDesktop; + uint8_t brokenExceptionTransitions; + int packageNamingPolicy; + uint8_t boundExceptionType; + int jniAddNativeMethodRegistrationAttributePresent; + bool jniRemappingInUse; + bool marshalMethodsEnabled; + jobject grefGCUserPeerable; + uint32_t runtimeType; + }; + + // Keep the enum values in sync with those in src/Mono.Android/AndroidRuntime/BoundExceptionType.cs + enum class BoundExceptionType : uint8_t + { + System = 0x00, + Java = 0x01, + }; + + using jnienv_initialize_fn = void (*) (JnienvInitializeArgs*); + using jnienv_register_jni_natives_fn = void (*)(const jchar *typeName_ptr, int32_t typeName_len, jclass jniClass, const jchar *methods_ptr, int32_t methods_len); +} diff --git a/src/native/common/include/runtime-base/search.hh b/src/native/common/include/runtime-base/search.hh index c6c3311795f..4c789b1bffc 100644 --- a/src/native/common/include/runtime-base/search.hh +++ b/src/native/common/include/runtime-base/search.hh @@ -9,9 +9,9 @@ namespace xamarin::android { class Search final { public: - template + template [[gnu::always_inline]] - static ssize_t binary_search (hash_t key, const T *arr, size_t n) noexcept + static ssize_t binary_search (TKey key, const T *arr, size_t n) noexcept { static_assert (equal != nullptr, "equal is a required template parameter"); static_assert (less_than != nullptr, "less_than is a required template parameter"); @@ -31,13 +31,20 @@ namespace xamarin::android { return equal (arr[right], key) ? right : -1z; } + template + [[gnu::always_inline]] + static ssize_t binary_search (hash_t key, const T *arr, size_t n) noexcept + { + return binary_search (key, arr, n); + } + [[gnu::always_inline]] static ssize_t binary_search (hash_t key, const hash_t *arr, size_t n) noexcept { auto equal = [](hash_t const& entry, hash_t key) -> bool { return entry == key; }; auto less_than = [](hash_t const& entry, hash_t key) -> bool { return entry < key; }; - return binary_search (key, arr, n); + return binary_search (key, arr, n); } [[gnu::always_inline]] diff --git a/src/native/common/java-interop/CMakeLists.txt b/src/native/common/java-interop/CMakeLists.txt index 7a822a5dc46..d9b20742a9a 100644 --- a/src/native/common/java-interop/CMakeLists.txt +++ b/src/native/common/java-interop/CMakeLists.txt @@ -30,7 +30,8 @@ target_include_directories( ${LIB_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} + ${TEMP_MONO_RUNTIME_INCLUDE_DIR} ) target_compile_options( diff --git a/src/native/mono/monodroid/CMakeLists.txt b/src/native/mono/monodroid/CMakeLists.txt index 8f140f062c5..00c05f97d18 100644 --- a/src/native/mono/monodroid/CMakeLists.txt +++ b/src/native/mono/monodroid/CMakeLists.txt @@ -69,10 +69,6 @@ elseif(NOT ANALYZERS_ENABLED) set(BUILD_STATIC_LIBRARY OFF) # Turn off for now, until we implement dynamic runtime linking at app build time endif() -# Library directories -set(XA_LIBRARY_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/lib/${ANDROID_RID}") -set(XA_LIBRARY_STUBS_OUTPUT_DIRECTORY "${XA_LIB_TOP_DIR}/libstubs/${ANDROID_RID}") - # Header checks if(ENABLE_CLANG_UBSAN OR ENABLE_CLANG_ASAN) @@ -207,7 +203,7 @@ macro(lib_target_options TARGET_NAME) ${TARGET_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ${NATIVE_TRACING_INCLUDE_DIRS} ${LIBUNWIND_INCLUDE_DIRS} ) diff --git a/src/native/mono/monodroid/monodroid-glue-internal.hh b/src/native/mono/monodroid/monodroid-glue-internal.hh index f5125cb9a5a..2708ac58205 100644 --- a/src/native/mono/monodroid/monodroid-glue-internal.hh +++ b/src/native/mono/monodroid/monodroid-glue-internal.hh @@ -12,6 +12,7 @@ #include #include #include "monodroid-dl.hh" +#include #include #include @@ -51,15 +52,6 @@ extern mono_bool mono_opt_aot_lazy_assembly_load; namespace xamarin::android::internal { - // Values must be identical to those in src/Mono.Android/Android.Runtime/RuntimeNativeMethods.cs - enum class TraceKind : uint32_t - { - Java = 0x01, - Managed = 0x02, - Native = 0x04, - Signals = 0x08, - }; - class MonodroidRuntime { using load_assemblies_context_type = MonoAssemblyLoadContextGCHandle; @@ -76,37 +68,6 @@ namespace xamarin::android::internal }; #endif - // Keep the enum values in sync with those in src/Mono.Android/AndroidRuntime/BoundExceptionType.cs - enum class BoundExceptionType : uint8_t - { - System = 0x00, - Java = 0x01, - }; - - // NOTE: Keep this in sync with managed side in src/Mono.Android/Android.Runtime/JNIEnvInit.cs - struct JnienvInitializeArgs { - JavaVM *javaVm; - JNIEnv *env; - jobject grefLoader; - jmethodID Loader_loadClass; - jclass grefClass; - unsigned int logCategories; - int version; - int grefGcThreshold; - jobject grefIGCUserPeer; - int isRunningOnDesktop; - uint8_t brokenExceptionTransitions; - int packageNamingPolicy; - uint8_t boundExceptionType; - int jniAddNativeMethodRegistrationAttributePresent; - bool jniRemappingInUse; - bool marshalMethodsEnabled; - jobject grefGCUserPeerable; - }; - - using jnienv_initialize_fn = void (*) (JnienvInitializeArgs*); - using jnienv_register_jni_natives_fn = void (*)(const jchar *typeName_ptr, int32_t typeName_len, jclass jniClass, const jchar *methods_ptr, int32_t methods_len); - private: static constexpr std::string_view base_apk_name { "/base.apk" }; static constexpr size_t SMALL_STRING_PARSE_BUFFER_LEN = 50uz; diff --git a/src/native/mono/monodroid/monodroid-glue.cc b/src/native/mono/monodroid/monodroid-glue.cc index fac103d595e..26547c8e476 100644 --- a/src/native/mono/monodroid/monodroid-glue.cc +++ b/src/native/mono/monodroid/monodroid-glue.cc @@ -838,6 +838,7 @@ MonodroidRuntime::init_android_runtime (JNIEnv *env, jclass runtimeClass, jobjec mono_add_internal_call ("Android.Runtime.RuntimeNativeMethods::monodroid_unhandled_exception", reinterpret_cast(monodroid_unhandled_exception)); struct JnienvInitializeArgs init = {}; + init.runtimeType = RuntimeTypeMonoVM; init.javaVm = osBridge.get_jvm (); init.env = env; init.logCategories = log_categories; diff --git a/src/native/mono/pinvoke-override/CMakeLists.txt b/src/native/mono/pinvoke-override/CMakeLists.txt index 82dd535fafe..e791f67507f 100644 --- a/src/native/mono/pinvoke-override/CMakeLists.txt +++ b/src/native/mono/pinvoke-override/CMakeLists.txt @@ -66,7 +66,7 @@ macro(create_library _libname _alias _sources) ${_libname} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_link_libraries( diff --git a/src/native/mono/pinvoke-override/generate-pinvoke-tables.cc b/src/native/mono/pinvoke-override/generate-pinvoke-tables.cc index 24fb3f5a24d..082c672e22c 100644 --- a/src/native/mono/pinvoke-override/generate-pinvoke-tables.cc +++ b/src/native/mono/pinvoke-override/generate-pinvoke-tables.cc @@ -1,7 +1,7 @@ // // To build and run this utility run (on Linux or macOS): // -// ../../../build-tools/scripts/generate-pinvoke-tables.sh +// ../../../../build-tools/scripts/generate-pinvoke-tables.sh // // A reasonable C++20 compiler is required (g++ 10+, clang 11+, on mac it may require XCode 12.5 or newer) // @@ -699,7 +699,7 @@ int main (int argc, char **argv) output << "//" << std::endl; output << "// Autogenarated file. DO NOT EDIT." << std::endl; output << "//" << std::endl; - output << "// To regenerate run ../../../build-tools/scripts/generate-pinvoke-tables.sh on Linux or macOS" << std::endl; + output << "// To regenerate run ../../../../build-tools/scripts/generate-pinvoke-tables.sh on Linux or macOS" << std::endl; output << "// A compiler with support for C++20 ranges is required" << std::endl; output << "//" << std::endl << std::endl; diff --git a/src/native/mono/pinvoke-override/pinvoke-tables.include b/src/native/mono/pinvoke-override/pinvoke-tables.include index cdb46532b1e..8b38d425190 100644 --- a/src/native/mono/pinvoke-override/pinvoke-tables.include +++ b/src/native/mono/pinvoke-override/pinvoke-tables.include @@ -1,7 +1,7 @@ // // Autogenarated file. DO NOT EDIT. // -// To regenerate run ../../../build-tools/scripts/generate-pinvoke-tables.sh on Linux or macOS +// To regenerate run ../../../../build-tools/scripts/generate-pinvoke-tables.sh on Linux or macOS // A compiler with support for C++20 ranges is required // diff --git a/src/native/mono/runtime-base/CMakeLists.txt b/src/native/mono/runtime-base/CMakeLists.txt index 15af7a83d37..9441f86d8f8 100644 --- a/src/native/mono/runtime-base/CMakeLists.txt +++ b/src/native/mono/runtime-base/CMakeLists.txt @@ -46,7 +46,7 @@ target_include_directories( ${LIB_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_link_libraries( diff --git a/src/native/mono/shared/CMakeLists.txt b/src/native/mono/shared/CMakeLists.txt index 75f4b0c4616..4dec3c59790 100644 --- a/src/native/mono/shared/CMakeLists.txt +++ b/src/native/mono/shared/CMakeLists.txt @@ -7,9 +7,6 @@ set(XA_SHARED_SOURCES ) add_clang_check_sources("${XA_SHARED_SOURCES};") -set(XXHASH_DIR "${EXTERNAL_DIR}/xxHash") -set(CONSTEXPR_XXH3_DIR "${EXTERNAL_DIR}/constexpr-xxh3") - add_library( ${LIB_NAME} STATIC @@ -41,7 +38,7 @@ macro(lib_target_options TARGET_NAME) ${TARGET_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_compile_options( diff --git a/src/native/mono/shared/cpp-util.hh b/src/native/mono/shared/cpp-util.hh index abbaa95bb79..aa5df834a37 100644 --- a/src/native/mono/shared/cpp-util.hh +++ b/src/native/mono/shared/cpp-util.hh @@ -129,7 +129,7 @@ abort_if_negative_integer_argument (int arg, const char *arg_name, std::source_l arg > 0, [&arg_name, &sloc] { return xamarin::android::detail::_format_message ( - "%s: parameter '%s' must be a valid pointer", + "%s: parameter '%s' must be a positive integer", xamarin::android::detail::get_function_name (sloc.function_name ()).c_str (), arg_name ); diff --git a/src/native/mono/tracing/CMakeLists.txt b/src/native/mono/tracing/CMakeLists.txt index 558b3513659..b4e1f07bb62 100644 --- a/src/native/mono/tracing/CMakeLists.txt +++ b/src/native/mono/tracing/CMakeLists.txt @@ -27,7 +27,7 @@ target_include_directories( ${LIB_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_compile_definitions( diff --git a/src/native/mono/xamarin-app-stub/CMakeLists.txt b/src/native/mono/xamarin-app-stub/CMakeLists.txt index 13044940b7a..6ee654daed7 100644 --- a/src/native/mono/xamarin-app-stub/CMakeLists.txt +++ b/src/native/mono/xamarin-app-stub/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories( ${LIB_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_compile_options( diff --git a/src/native/mono/xamarin-debug-app-helper/CMakeLists.txt b/src/native/mono/xamarin-debug-app-helper/CMakeLists.txt index 1bda5881907..33adc3c0bde 100644 --- a/src/native/mono/xamarin-debug-app-helper/CMakeLists.txt +++ b/src/native/mono/xamarin-debug-app-helper/CMakeLists.txt @@ -18,7 +18,7 @@ target_include_directories( ${LIB_NAME} SYSTEM PRIVATE ${SYSROOT_CXX_INCLUDE_DIR} - ${MONO_RUNTIME_INCLUDE_DIR} + ${RUNTIME_INCLUDE_DIR} ) target_compile_definitions( diff --git a/src/native/native-mono.csproj b/src/native/native-mono.csproj index 38b77115100..518fd728712 100644 --- a/src/native/native-mono.csproj +++ b/src/native/native-mono.csproj @@ -11,7 +11,8 @@ - $(MicrosoftAndroidSdkOutDir)lib\ + $(NativeRuntimeOutputRootDir)mono + MonoVM diff --git a/src/native/native.targets b/src/native/native.targets index 5f0443460f6..15b6afbfacd 100644 --- a/src/native/native.targets +++ b/src/native/native.targets @@ -1,75 +1,97 @@ + + + + $(IntermediateOutputPath)\$(CMakeRuntimeFlavor)\ + + + + DependsOnTargets="_PrepareCommonProperties;_ConfigureAndBuildArchiveDSOStub;_ConfigureRuntimes;_BuildAndroidRuntimes;_BuildAndroidAnalyzerRuntimes;_CopyToPackDirs"> + /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release" /> - <_ConfigureRuntimesInputs Include="CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="java-interop\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="libstub\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="libunwind\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="lz4\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="monodroid\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="runtime-base\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="shared\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="shared\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="tracing\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="xamarin-app-debug-helper\CMakeLists.txt" /> - <_ConfigureRuntimesInputs Include="xamarin-app-stub\CMakeLists.txt" /> <_ConfigureRuntimesInputs Include="..\..\build-tools\scripts\Ndk.targets" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-asan-Debug\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-asan-Release\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-ubsan-Debug\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-ubsan-Release\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> - <_OutputDirsToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_ConfigureRuntimesInputs Include="CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="common\java-interop\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="common\libstub\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="common\libunwind\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="common\lz4\CMakeLists.txt" /> + + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> + + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug" /> + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-Release" /> + + + + <_ConfigureRuntimesInputs Include="mono\monodroid\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\runtime-base\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\shared\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\shared\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\tracing\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\xamarin-app-debug-helper\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="mono\xamarin-app-stub\CMakeLists.txt" /> + + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-asan-Debug\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-asan-Release\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-ubsan-Debug\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_ConfigureRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-ubsan-Release\CMakeCache.txt')" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + <_OutputDirsToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release" Condition="'$(EnableNativeAnalyzers)' == 'true'" /> + + + + <_ConfigureRuntimesInputs Include="clr\host\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="clr\runtime-base\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="clr\shared\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="clr\startup\CMakeLists.txt" /> + <_ConfigureRuntimesInputs Include="clr\xamarin-app-stub\CMakeLists.txt" /> - <_ArchiveDSOInput Include="archive-dso-stub\CMakeLists.txt" /> + <_ArchiveDSOInput Include="common\archive-dso-stub\CMakeLists.txt" /> - <_ArchiveDSOOutput Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-archive-dso-stub\CMakeCache.txt')" /> + <_ArchiveDSOOutput Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-archive-dso-stub\CMakeCache.txt')" /> - <_ArchiveOutputDirToCreate Include="$(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub" /> + <_ArchiveOutputDirToCreate Include="$(FlavorIntermediateOutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub" /> <_ConfigureArchiveDSOStubCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) - --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub + -DOUTPUT_PATH="$(OutputPath)" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub @@ -78,7 +100,7 @@ + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub" /> @@ -91,46 +113,46 @@ <_NoInline Condition=" '$(DoNotInlineMonodroid)' == 'true' ">-DDONT_INLINE=ON <_NoStrip Condition=" '$(DoNotStripMonodroid)' == 'true' ">-DSTRIP_DEBUG=OFF - <_CmakeAndroidFlags>$(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" + <_CmakeAndroidFlags>-DOUTPUT_PATH="$(OutputPath)" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" $(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset default-debug-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release - + <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset asan-debug-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset asan-release-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset ubsan-debug-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug <_ConfigureRuntimeCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) --preset ubsan-release-%(AndroidSupportedTargetJitAbi.Identity) $(_CmakeAndroidFlags) - $(IntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release + $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release @@ -140,34 +162,56 @@ - + - <_MonoDroidSources Include="android-dso-stub\*.cc;libstub\*.hh" /> - <_MonoDroidSources Include="libstub\*.cc;libstub\*.hh" /> - <_MonoDroidSources Include="monodroid\*.cc;monodroid\*.hh" /> - <_MonoDroidSources Include="runtime-base\*.cc;runtime-base\*.hh" /> - <_MonoDroidSources Include="shared\*.cc;shared\*.hh" /> - <_MonoDroidSources Include="tracing\*.cc;tracing\*.hh" /> - <_MonoDroidSources Include="xamarin-app-stub\*.cc;xamarin-app-stub\*.hh" /> - <_MonoDroidSources Include="xamarin-debug-app-helper\*.cc;xamarin-debug-app-helper\*.hh" /> - <_MonoDroidSources Include="$(JavaInteropFullPath)\src\java-interop\*.cc;$(JavaInteropFullPath)\src\java-interop\*.h" /> - <_MonoDroidSources Include="$(LZ4SourceFullPath)\lib\lz4.c;$(LZ4SourceFullPath)\lib\lz4.h" /> + <_RuntimeSources Include="$(JavaInteropFullPath)\src\java-interop\*.cc;$(JavaInteropFullPath)\src\java-interop\*.h" /> + <_RuntimeSources Include="common\archive-dso-stub\*.cc" /> + <_RuntimeSources Include="common\libstub\*.cc;common\libstub\*.hh" /> + <_RuntimeSources Include="$(LZ4SourceFullPath)\lib\lz4.c;$(LZ4SourceFullPath)\lib\lz4.h" /> + + + + <_RuntimeSources Include="mono\monodroid\*.cc;mono\monodroid\*.hh" /> + <_RuntimeSources Include="mono\runtime-base\*.cc;mono\runtime-base\*.hh" /> + <_RuntimeSources Include="mono\shared\*.cc;mono\shared\*.hh" /> + <_RuntimeSources Include="mono\tracing\*.cc;mono\tracing\*.hh" /> + <_RuntimeSources Include="mono\xamarin-app-stub\*.cc;mono\xamarin-app-stub\*.hh" /> + <_RuntimeSources Include="mono\xamarin-debug-app-helper\*.cc;mono\xamarin-debug-app-helper\*.hh" /> + + + + <_RuntimeSources Include="clr\host\*.cc;clr\host\*.hh" /> + <_RuntimeSources Include="clr\include\**\*.hh" /> + <_RuntimeSources Include="clr\startup\*.cc;clr\startup\*.hh" /> + <_RuntimeSources Include="clr\xamarin-app-stub\*.cc;clr\xamarin-app-stub\*.hh" /> + <_RuntimeSources Include="clr\runtime-base\*.cc;clr\runtime-base\*.hh" /> + <_RuntimeSources Include="clr\shared\*.cc;clr\shared\*.hh" /> + DependsOnTargets="_FindRuntimeSources"> - <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> - <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(IntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> - <_BuildAndroidRuntimesInputs Include="@(_MonoDroidSources)" /> + <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-Debug\CMakeCache.txt')" /> + <_BuildAndroidRuntimesInputs Include="@(AndroidSupportedTargetJitAbi->'$(FlavorIntermediateOutputPath)\%(AndroidRID)-Release\CMakeCache.txt')" /> + <_BuildAndroidRuntimesInputs Include="@(_RuntimeSources)" /> <_BuildAndroidRuntimesInputs Include="..\..\build-tools\scripts\Ndk.targets" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.debug.so')" /> - <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.release.so')" /> + <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Debug\libxamarin-app.so')" /> <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\Release\libxamarin-app.so')" /> - + + + <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.debug.so')" /> + <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android.release.so')" /> + + + + <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libnet-android.debug.so')" /> + <_BuildAndroidRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libnet-android.release.so')" /> + + + <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+ubsan.debug.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+asan.debug.so')" /> <_BuildAndroidAnalyzerRuntimesOutputs Include="@(AndroidSupportedTargetJitAbi->'$(OutputPath)\%(AndroidRID)\libmono-android-checked+asan.release.so')" /> @@ -181,54 +225,54 @@ Outputs="@(_BuildAndroidRuntimesOutputs)"> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Debug" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Debug" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-asan-Release" /> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-ubsan-Release" /> + AfterTargets="Clean"> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-android-dso-stub"/> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Debug"/> + WorkingDirectory="$(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-Release"/> - - + + @@ -242,14 +286,22 @@ + + <_RuntimePackName Condition=" '$(CMakeRuntimeFlavor)' == 'MonoVM' ">Mono + <_RuntimePackName Condition=" '$(CMakeRuntimeFlavor)' == 'CoreCLR' ">CoreCLR + + - <_RuntimePackFiles Include="$(OutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)\*" AndroidRID="%(AndroidSupportedTargetJitAbi.AndroidRID)" AndroidRuntime="Mono" /> + <_RuntimePackFiles Include="$(OutputPath)\%(AndroidSupportedTargetJitAbi.AndroidRID)\*" + AndroidRID="%(AndroidSupportedTargetJitAbi.AndroidRID)" + AndroidRuntime="$(CMakeRuntimeFlavor)" + RuntimePackName="$(_RuntimePackName)" /> From cff7455114f2e6a8bd9b8663d5908c61d9c68383 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Tue, 18 Feb 2025 21:32:35 -0500 Subject: [PATCH 02/11] Fix Windows build? By convention (and often enforced requirement), `$(OutputPath)` ends with `\`, which means that quoting it for use with ``: will often result in an *invalid* command, because the `\` escapes the quote! whatever "C:\path\to\output\" # ruh roh! The fix is to instead use `$(OutputPath.OutputPath.TrimEnd('\')`, which ensures that the path does *not* end in `\`, preventing the unintentional escape usage: whatever "C:\path\to\output" # yay! --- src/native/native-mono.csproj | 2 +- src/native/native.targets | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/native/native-mono.csproj b/src/native/native-mono.csproj index 518fd728712..5800dd911d1 100644 --- a/src/native/native-mono.csproj +++ b/src/native/native-mono.csproj @@ -11,7 +11,7 @@ - $(NativeRuntimeOutputRootDir)mono + $(NativeRuntimeOutputRootDir)mono\ MonoVM diff --git a/src/native/native.targets b/src/native/native.targets index 15b6afbfacd..4df76b789d3 100644 --- a/src/native/native.targets +++ b/src/native/native.targets @@ -90,7 +90,7 @@ <_ConfigureArchiveDSOStubCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) - -DOUTPUT_PATH="$(OutputPath)" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" + -DOUTPUT_PATH="$(OutputPath.TrimEnd('\')" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub @@ -113,7 +113,7 @@ <_NoInline Condition=" '$(DoNotInlineMonodroid)' == 'true' ">-DDONT_INLINE=ON <_NoStrip Condition=" '$(DoNotStripMonodroid)' == 'true' ">-DSTRIP_DEBUG=OFF - <_CmakeAndroidFlags>-DOUTPUT_PATH="$(OutputPath)" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" $(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" + <_CmakeAndroidFlags>-DOUTPUT_PATH="$(OutputPath.TrimEnd('\')" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" $(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" From f23cfa037648922d77d088384e05ced81d753412 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Wed, 19 Feb 2025 09:43:24 +0100 Subject: [PATCH 03/11] Add missing parentheses --- src/native/native.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/native/native.targets b/src/native/native.targets index 4df76b789d3..6b997259f4a 100644 --- a/src/native/native.targets +++ b/src/native/native.targets @@ -90,7 +90,7 @@ <_ConfigureArchiveDSOStubCommands Include="@(AndroidSupportedTargetJitAbi)"> $(CmakePath) - -DOUTPUT_PATH="$(OutputPath.TrimEnd('\')" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" + -DOUTPUT_PATH="$(OutputPath.TrimEnd('\'))" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" --preset default-release-%(AndroidSupportedTargetJitAbi.Identity) -DBUILD_ARCHIVE_DSO_STUB=ON -DSTRIP_DEBUG=ON "$(MSBuildThisFileDirectory)" $(FlavorIntermediateOutputPath)%(AndroidSupportedTargetJitAbi.AndroidRID)-archive-dso-stub @@ -113,7 +113,7 @@ <_NoInline Condition=" '$(DoNotInlineMonodroid)' == 'true' ">-DDONT_INLINE=ON <_NoStrip Condition=" '$(DoNotStripMonodroid)' == 'true' ">-DSTRIP_DEBUG=OFF - <_CmakeAndroidFlags>-DOUTPUT_PATH="$(OutputPath.TrimEnd('\')" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" $(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" + <_CmakeAndroidFlags>-DOUTPUT_PATH="$(OutputPath.TrimEnd('\'))" -DRUNTIME_FLAVOR="$(CMakeRuntimeFlavor)" $(_NoInline) $(_NoStrip) "$(MSBuildThisFileDirectory)" From 5514c957426491f536b0a586f83f644334cedfce Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Wed, 19 Feb 2025 18:40:56 +0000 Subject: [PATCH 04/11] Update build-tools/create-packs/Microsoft.Android.Runtime.proj Co-authored-by: Jonathan Peppers --- build-tools/create-packs/Microsoft.Android.Runtime.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/create-packs/Microsoft.Android.Runtime.proj b/build-tools/create-packs/Microsoft.Android.Runtime.proj index af99678ba05..6d1820cff7c 100644 --- a/build-tools/create-packs/Microsoft.Android.Runtime.proj +++ b/build-tools/create-packs/Microsoft.Android.Runtime.proj @@ -60,7 +60,7 @@ projects that use the Microsoft.Android framework in .NET 6+. <_AndroidRuntimePackAssets Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libunwind_xamarin.a" /> - + <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libc.so" /> <_AndroidRuntimePackAssets Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libdl.so" /> From 791666e958b35e295b3d4e78a05c84aceb996b29 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Wed, 19 Feb 2025 13:57:10 -0500 Subject: [PATCH 05/11] Skip LLVM-IR typemaps for NativeAOT Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=11036370&view=ms.vss-test-web.build-test-results-tab&runId=122368005&resultId=100098&paneView=attachments Will hopefully fix/avoid the build error: D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: System.NotSupportedException: Internal error: unsupported runtime NativeAOT [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Xamarin.Android.Tasks.TypeMapGenerator.GenerateRelease(Boolean skipJniAddNativeMethodRegistrationAttributeScan, String outputDirectory) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs:line 452 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Xamarin.Android.Tasks.TypeMapGenerator.Generate(Boolean debugBuild, Boolean skipJniAddNativeMethodRegistrationAttributeScan, String outputDirectory, Boolean generateNativeAssembly) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs:line 175 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(NativeCodeGenState state) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 484 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Xamarin.Android.Tasks.GenerateJavaStubs.Run(Boolean useMarshalMethods) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 272 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 115 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7015: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/4/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 [D:\a\_work\1\a\TestRelease\02-19_09.11.14\temp\NativeAOT\Hello.csproj] --- src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs index 5bb3b0d403d..f1fa773dab3 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs @@ -479,6 +479,10 @@ void SaveResource (string resource, string filename, string destDir, Func Date: Wed, 19 Feb 2025 14:02:14 -0500 Subject: [PATCH 06/11] Skip LLVM-IR typemaps for CoreCLR, too Context: 7d04764b9a12388767366f0cc8cebed46cc87ed8 Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=11036370&view=ms.vss-test-web.build-test-results-tab&runId=122366823&resultId=100099&paneView=attachments Commit 7d04764b9 asserts that CoreCLR *builds*. This set of changes starts adding incremental support for CoreCLR, but typemap support is still lacking, meaning `BasicApplicationOtherRuntime(True)` fails: D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: System.NotImplementedException: CoreCLR support not implemented yet [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Xamarin.Android.Tasks.TypeMapGenerator.GenerateRelease(Boolean skipJniAddNativeMethodRegistrationAttributeScan, String outputDirectory) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs:line 451 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Xamarin.Android.Tasks.TypeMapGenerator.Generate(Boolean debugBuild, Boolean skipJniAddNativeMethodRegistrationAttributeScan, String outputDirectory, Boolean generateNativeAssembly) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/TypeMapGenerator.cs:line 175 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(NativeCodeGenState state) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 484 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Xamarin.Android.Tasks.GenerateJavaStubs.Run(Boolean useMarshalMethods) in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 272 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() in /Users/builder/azdo/_work/4/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 115 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] D:\a\_work\1\s\bin\Release\dotnet\packs\Microsoft.Android.Sdk.Windows\35.99.0-ci.dev-grendel-clr-bits-two.174\tools\Xamarin.Android.Common.targets(1509,3): error XAGJS7000: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/4/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 [D:\a\_work\1\a\TestRelease\02-19_09.08.39\temp\BasicApplicationOtherRuntimeTrue\UnnamedProject.csproj] Skip LLVM-IR typemaps for CoreCLR for now. --- src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs index f1fa773dab3..ef32c24c8eb 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs @@ -483,6 +483,10 @@ void WriteTypeMappings (NativeCodeGenState state) // NativeAOT typemaps are generated in `Microsoft.Android.Sdk.ILLink.TypeMappingStep` return; } + if (androidRuntime == Xamarin.Android.Tasks.AndroidRuntime.CoreCLR) { + // TODO: CoreCLR typemaps will be emitted later + return; + } Log.LogDebugMessage ($"Generating type maps for architecture '{state.TargetArch}'"); var tmg = new TypeMapGenerator (Log, state, androidRuntime); if (!tmg.Generate (Debug, SkipJniAddNativeMethodRegistrationAttributeScan, TypemapOutputDirectory, GenerateNativeAssembly)) { From 93b12588db09a04dd268917e36f1ebd359431b96 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Wed, 19 Feb 2025 22:37:41 +0100 Subject: [PATCH 07/11] Don't generate typemap sources for NativeAOT --- src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 6287233e8a1..48991f4cccb 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1455,7 +1455,7 @@ because xbuild doesn't support framework reference assemblies. - + Date: Wed, 19 Feb 2025 23:33:25 +0100 Subject: [PATCH 08/11] Perhaps this --- src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 48991f4cccb..4e368e19852 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1455,7 +1455,7 @@ because xbuild doesn't support framework reference assemblies. - + Date: Thu, 20 Feb 2025 12:07:47 +0100 Subject: [PATCH 09/11] Change runtime check condition to check for == 'MonoVM' This is needed until #9572 is merged, since the != 'NativeAOT' would enable the guarded code to run also for `CoreCLR`, which is not fully functional in this PR. --- .../Xamarin.Android.Common.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 4e368e19852..7c935d15895 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1455,7 +1455,7 @@ because xbuild doesn't support framework reference assemblies. - + @@ -1958,7 +1958,7 @@ because xbuild doesn't support framework reference assemblies. From c6b29f2d021ea683ea2d7fa1a5aa99034b7e7d92 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Thu, 20 Feb 2025 12:13:55 +0100 Subject: [PATCH 10/11] Create assembly store directory --- .../Utilities/AssemblyStoreGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/AssemblyStoreGenerator.cs b/src/Xamarin.Android.Build.Tasks/Utilities/AssemblyStoreGenerator.cs index 896c17e43c3..06c1809f3d9 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/AssemblyStoreGenerator.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/AssemblyStoreGenerator.cs @@ -115,6 +115,7 @@ string Generate (string baseOutputDirectory, AndroidTargetArch arch, List Date: Thu, 20 Feb 2025 13:27:00 +0100 Subject: [PATCH 11/11] libxamarin-app.so exist only in MonoVM atm --- src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 7c935d15895..2bf1562968e 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2034,7 +2034,7 @@ because xbuild doesn't support framework reference assemblies. - + <_ApplicationSharedLibrary Include="$(_AndroidApplicationSharedLibraryPath)%(_BuildTargetAbis.Identity)\libxamarin-app.so"> %(_BuildTargetAbis.Identity)