diff --git a/eng/testing/tests.android.targets b/eng/testing/tests.android.targets index a8b279bf85317..009ba15ff6013 100644 --- a/eng/testing/tests.android.targets +++ b/eng/testing/tests.android.targets @@ -3,6 +3,7 @@ $(BundleTestAppTargets);BundleTestAndroidApp + diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 99a5c10c4c21b..1b1236a4f85f7 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -12,6 +12,7 @@ + true true diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 639247c4ba3ea..f6871e2e80fa9 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -5206,9 +5206,9 @@ add_wrappers (MonoAotCompile *acfg) MONO_DISABLE_WARNING (4310) // cast truncates constant value g_assert (*named != (char)0xFF); MONO_RESTORE_WARNING - slen = mono_metadata_decode_value (named, &named); + slen = mono_metadata_decode_value (named, &named) + (int)strlen(acfg->user_symbol_prefix); export_name = (char *)g_malloc (slen + 1); - memcpy (export_name, named, slen); + sprintf (export_name, "%s%s", acfg->user_symbol_prefix, named); export_name [slen] = 0; named += slen; } @@ -5242,13 +5242,10 @@ MONO_RESTORE_WARNING for (j = 0; j < decoded_args->named_args_num; ++j) { if (decoded_args->named_args_info [j].field && !strcmp (decoded_args->named_args_info [j].field->name, "EntryPoint")) { named = (const char *)decoded_args->named_args[j]->value.primitive; - slen = mono_metadata_decode_value (named, &named); - slen = slen + strlen(acfg->user_symbol_prefix); + slen = mono_metadata_decode_value (named, &named) + (int)strlen(acfg->user_symbol_prefix); export_name = (char *)g_malloc (slen + 1); - memcpy (export_name, named, slen); + sprintf (export_name, "%s%s", acfg->user_symbol_prefix, named); export_name [slen] = 0; - - strcat(export_name, ) } } mono_reflection_free_custom_attr_data_args_noalloc (decoded_args); diff --git a/src/mono/msbuild/android/build/AndroidApp.InTree.targets b/src/mono/msbuild/android/build/AndroidApp.InTree.targets index 2b374f617ae53..2a7e29285834b 100644 --- a/src/mono/msbuild/android/build/AndroidApp.InTree.targets +++ b/src/mono/msbuild/android/build/AndroidApp.InTree.targets @@ -4,6 +4,7 @@ + diff --git a/src/mono/msbuild/android/build/AndroidApp.props b/src/mono/msbuild/android/build/AndroidApp.props index 3e8f62b3e0a4b..bb8b716d049bc 100644 --- a/src/mono/msbuild/android/build/AndroidApp.props +++ b/src/mono/msbuild/android/build/AndroidApp.props @@ -4,6 +4,8 @@ true true + <_NativeLibraryTarget Condition="'$(NativeLibrary)' != ''">_BuildNativeLibrary; + Publish _InitializeCommonProperties; @@ -11,6 +13,7 @@ _AndroidResolveReferences; _AndroidPrepareProfiledAot; _AndroidAotCompileApp; + $(_NativeLibraryTarget) _AndroidGenerateAppBundle; _AfterAndroidBuildApp diff --git a/src/mono/msbuild/android/build/AndroidApp.targets b/src/mono/msbuild/android/build/AndroidApp.targets index 3d6024763b0f9..274fbab334a4b 100644 --- a/src/mono/msbuild/android/build/AndroidApp.targets +++ b/src/mono/msbuild/android/build/AndroidApp.targets @@ -12,6 +12,96 @@ <_MobileIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'mobile')) + + + + + + + + + <_UsedComponents + Condition="'$(RuntimeComponents)' != '' and '$(RuntimeComponents)' != '*'" + Include="$(RuntimeComponents)" /> + + <_RuntimeLibraries + Condition="'$(_TargetsDevice)' == 'true'" + Include="$(AndroidAppDir)\*.a" + Exclude="$(AndroidAppDir)\*-stub-static.a" /> + <_RuntimeLibraries + Condition="'$(_TargetsDevice)' == ''" + Include="$(AndroidAppDir)\*.dylib;$(AndroidAppDir)\libmonosgen*.a;$(AndroidAppDir)\*-static.a" + Exclude="$(AndroidAppDir)\libmonosgen*.dylib;$(AndroidAppDir)\*-stub-static.a" /> + + + + + <_RuntimeLibraries + Condition="'@(_UsedComponents->Count())' > 0" + Remove="$(AndroidAppDir)\libmono-component-*-static.a" /> + <_RuntimeLibraries + Condition="'@(_UsedComponents->Count())' > 0" + Include="$(AndroidAppDir)\*-stub-static.a" /> + <_RuntimeLibraries + Condition="'@(_UsedComponents->Count())' == 0" + Remove="$(AndroidAppDir)\*-static.a" /> + <_RuntimeLibraries + Condition="'@(_UsedComponents->Count())' == 0" + Include="$(AndroidAppDir)\*-stub-static.a" /> + + + + + <_CommonLinkerArgs Include="libz.so" /> + <_CommonLinkerArgs Include="log" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_LoadICU" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_GetLatestJapaneseEra" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_ChangeCase" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_CloseSortHandle" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocales" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocaleInfoInt" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_GetLocaleTimeFormat" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_ToUnicode" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_NormalizeString" /> + <_CommonLinkerArgs Include="-u GlobalizationNative_GetTimeZoneDisplayName" /> + <_CommonLinkerArgs Include="-Wl,-exported_symbols_list symbols.txt" /> + + + + <_RuntimeSymbolsToKeep> +_register_aot_modules +_mono_jit_init_version +_mono_jit_exec +_mono_assembly_get_name +_mono_assembly_name_get_culture +_mono_assembly_name_get_name +_mono_assembly_open +_mono_class_get_method_from_name +_mono_class_get_name +_mono_class_get_namespace +_mono_debug_init +_mono_dllmap_insert +_mono_domain_get +_mono_gc_init_finalizer_thread +_mono_get_exception_class +_mono_install_assembly_preload_hook +_mono_install_load_aot_data_hook +_mono_install_unhandled_exception_hook +_mono_jit_cleanup +_mono_jit_parse_options +_mono_jit_set_aot_mode +_mono_object_get_class +_mono_object_get_virtual_method +_mono_runtime_invoke +_mono_set_crash_chaining +_mono_set_signal_chaining +_mono_string_to_utf8 +_mono_trace_set_log_handler +_monovm_initialize +_monovm_runtimeconfig_initialize + + + @@ -120,7 +210,9 @@ - + marshal-ilgen diff --git a/src/mono/msbuild/apple/build/AppleApp.targets b/src/mono/msbuild/apple/build/AppleApp.targets index 36442e39ca7df..7d451538d24aa 100644 --- a/src/mono/msbuild/apple/build/AppleApp.targets +++ b/src/mono/msbuild/apple/build/AppleApp.targets @@ -1,8 +1,6 @@ - @@ -75,7 +73,7 @@ <_CommonLinkerArgs Include="-liconv" /> <_CommonLinkerArgs Include="-Wl,-exported_symbols_list symbols.txt" /> - + <_RuntimeSymbolsToKeep> _register_aot_modules @@ -209,7 +207,9 @@ _monovm_runtimeconfig_initialize - + diff --git a/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt b/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt index b3032a9e5557e..faa02abc3e1b7 100644 --- a/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt +++ b/src/tasks/AndroidAppBuilder/Templates/CMakeLists-android.txt @@ -8,11 +8,12 @@ if(ANDROID_NDK_MAJOR VERSION_LESS "23") message(FATAL_ERROR "Error: need at least Android NDK 23, got ${ANDROID_NDK_REVISION}!") endif() +include(${CMAKE_CURRENT_LIST_DIR}/dotnet_library.cmake) + add_library( monodroid SHARED monodroid.c - %AotModulesSource% ) %AotSources% @@ -23,16 +24,6 @@ include_directories("%MonoInclude%") target_link_libraries( monodroid - %NativeLibrariesToLink% libz.so log - "-u GlobalizationNative_LoadICU" - "-u GlobalizationNative_GetLatestJapaneseEra" - "-u GlobalizationNative_ChangeCase" - "-u GlobalizationNative_CloseSortHandle" - "-u GlobalizationNative_GetLocales" - "-u GlobalizationNative_GetLocaleInfoInt" - "-u GlobalizationNative_GetLocaleTimeFormat" - "-u GlobalizationNative_ToUnicode" - "-u GlobalizationNative_NormalizeString" - "-u GlobalizationNative_GetTimeZoneDisplayName") +) diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template index 887db58c2e2f2..c6ad3fb9af612 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template @@ -12,7 +12,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/dotnet_library.cmake) set_target_properties(lib-%ProjectName% PROPERTIES FRAMEWORK TRUE FRAMEWORK_VERSION C - MACOSX_FRAMEWORK_IDENTIFIER lib-%LIBRARY_NAME% + MACOSX_FRAMEWORK_IDENTIFIER lib-%ProjectName% XCODE_ATTRIBUTE_INSTALL_PATH "@executable_path/Frameworks" XCODE_ATTRIBUTE_SUPPORTS_MACCATALYST "YES" ) @@ -39,6 +39,7 @@ set_target_properties(%ProjectName% PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING "NO" XCODE_EMIT_EFFECTIVE_PLATFORM_NAME "YES" + XCODE_EMBED_FRAMEWORKS lib-%ProjectName% RESOURCE "${APP_RESOURCES}" ) @@ -65,6 +66,7 @@ endif() target_link_libraries( %ProjectName% + lib-%ProjectName% "-framework Foundation" "-framework Security" "-framework UIKit"