From 9104fe7877aec03dce37d3ff480408a23071e8db Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 7 Jun 2021 13:53:33 -0500 Subject: [PATCH 1/7] [One .NET] *.runtimeconfig.json support WIP, I implemented the MSBuild side partially. --- .../Microsoft.Android.Sdk.After.targets | 1 + ...soft.Android.Sdk.DefaultProperties.targets | 1 - ...icrosoft.Android.Sdk.RuntimeConfig.targets | 43 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets index b749937120c..c33c2104cbc 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets @@ -23,5 +23,6 @@ This file is imported *after* the Microsoft.NET.Sdk/Sdk.targets. + diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets index 969d09519aa..6f434688cc3 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets @@ -12,7 +12,6 @@ Xamarin.Android.Net.AndroidClientHandler true false - false false false diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets new file mode 100644 index 00000000000..b0fed7b3b54 --- /dev/null +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets @@ -0,0 +1,43 @@ + + + + + + + + $([System.IO.Path]::GetDirectoryName($(RuntimeConfigParserTasksAssemblyPath)))/net6.0/$([System.IO.Path]::GetFileName($(RuntimeConfigParserTasksAssemblyPath))) + <_BinaryRuntimeConfigPath>$(IntermediateOutputPath)$(ProjectRuntimeConfigFileName).bin + + + + + + + + + + + + From ff92920966b0c07c69b4a229724e4e914179b30a Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 7 Jun 2021 14:01:30 -0500 Subject: [PATCH 2/7] Add @(_RuntimeConfigReservedProperties) Context: https://gist.github.com/grendello/5d884251bd854846d04f8f5010378a8d#file-rcp-diff-L20-L33 --- ...Microsoft.Android.Sdk.RuntimeConfig.targets | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets index b0fed7b3b54..f96972dba33 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets @@ -18,12 +18,24 @@ See: https://github.com/dotnet/runtime/blob/b13715b6984889a709ba29ea8a1961db469f <_BinaryRuntimeConfigPath>$(IntermediateOutputPath)$(ProjectRuntimeConfigFileName).bin + + + <_RuntimeConfigReservedProperties Include="TRUSTED_PLATFORM_ASSEMBLIES"/> + <_RuntimeConfigReservedProperties Include="APP_PATHS"/> + <_RuntimeConfigReservedProperties Include="APP_NI_PATHS"/> + <_RuntimeConfigReservedProperties Include="NATIVE_DLL_SEARCH_DIRECTORIES"/> + <_RuntimeConfigReservedProperties Include="PLATFORM_RESOURCE_ROOTS"/> + <_RuntimeConfigReservedProperties Include="PINVOKE_OVERRIDE"/> + + From ea815d7060d07e5d7c0464fe54a4a414602d6bad Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Tue, 8 Jun 2021 23:23:50 +0200 Subject: [PATCH 3/7] [WIP] Include blob in apk and load it on runtime --- ...icrosoft.Android.Sdk.RuntimeConfig.targets | 1 + .../Tasks/BuildApk.cs | 6 ++++ .../Tasks/GeneratePackageManagerJava.cs | 3 ++ .../PackagingTest.cs | 1 + .../Utilities/EnvironmentHelper.cs | 18 +++++++---- .../Xamarin.Android.Build.Tests/XASdkTests.cs | 3 +- ...pplicationConfigNativeAssemblyGenerator.cs | 4 +++ .../Xamarin.Android.Common.targets | 4 ++- src/monodroid/jni/application_dso_stub.cc | 1 + src/monodroid/jni/embedded-assemblies-zip.cc | 13 ++++++++ src/monodroid/jni/embedded-assemblies.hh | 20 ++++++++++++ src/monodroid/jni/monodroid-glue-internal.hh | 2 ++ src/monodroid/jni/monodroid-glue.cc | 31 +++++++++++++++++++ src/monodroid/jni/shared-constants.hh | 4 +++ src/monodroid/jni/xamarin-app.hh | 1 + 15 files changed, 104 insertions(+), 8 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets index f96972dba33..abe140679aa 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets @@ -40,6 +40,7 @@ See: https://github.com/dotnet/runtime/blob/b13715b6984889a709ba29ea8a1961db469f (ApplicationConfigTaskState.RegisterTaskObjectKey, RegisteredTaskObjectLifetime.Build); foreach (string abi in SupportedAbis) { NativeAssemblerTargetProvider asmTargetProvider = GetAssemblyTargetProvider (abi); @@ -279,6 +281,7 @@ void AddEnvironment () BoundExceptionType = boundExceptionType, InstantRunEnabled = InstantRunEnabled, JniAddNativeMethodRegistrationAttributePresent = appConfState != null ? appConfState.JniAddNativeMethodRegistrationAttributePresent : false, + HaveRuntimeConfigBlob = haveRuntimeConfigBlob, }; using (var sw = MemoryStreamPool.Shared.CreateStreamWriter ()) { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs index 972e2832852..262b7479428 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs @@ -86,6 +86,7 @@ public void CheckIncludedAssemblies () new [] { "Java.Interop.dll", "Mono.Android.dll", + "rc.bin", "System.Private.CoreLib.dll", "System.Runtime.dll", "System.Linq.dll", diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs index 68ff5179448..d2217190c6f 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs @@ -25,13 +25,14 @@ public sealed class ApplicationConfig public bool broken_exception_transitions; public bool instant_run_enabled; public bool jni_add_native_method_registration_attribute_present; + public bool have_runtime_config_blob; public byte bound_stream_io_exception_type; public uint package_naming_policy; public uint environment_variable_count; public uint system_property_count; public string android_package_name; }; - const uint ApplicationConfigFieldCount = 12; + const uint ApplicationConfigFieldCount = 13; static readonly object ndkInitLock = new object (); static readonly char[] readElfFieldSeparator = new [] { ' ', '\t' }; @@ -150,27 +151,32 @@ static ApplicationConfig ReadApplicationConfig (string envFile) ret.jni_add_native_method_registration_attribute_present = ConvertFieldToBool ("jni_add_native_method_registration_attribute_present", envFile, i, field [1]); break; - case 7: // bound_stream_io_exception_type: byte / .byte + case 7: + AssertFieldType (envFile, ".byte", field [0], i); + ret.have_runtime_config_blob = ConvertFieldToBool ("have_runtime_config_blob", envFile, i, field [1]); + break; + + case 8: // bound_stream_io_exception_type: byte / .byte AssertFieldType (envFile, ".byte", field [0], i); ret.bound_stream_io_exception_type = ConvertFieldToByte ("bound_stream_io_exception_type", envFile, i, field [1]); break; - case 8: // package_naming_policy: uint32_t / .word | .long + case 9: // package_naming_policy: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile}:{i}': {field [0]}"); ret.package_naming_policy = ConvertFieldToUInt32 ("package_naming_policy", envFile, i, field [1]); break; - case 9: // environment_variable_count: uint32_t / .word | .long + case 10: // environment_variable_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile}:{i}': {field [0]}"); ret.environment_variable_count = ConvertFieldToUInt32 ("environment_variable_count", envFile, i, field [1]); break; - case 10: // system_property_count: uint32_t / .word | .long + case 11: // system_property_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile}:{i}': {field [0]}"); ret.system_property_count = ConvertFieldToUInt32 ("system_property_count", envFile, i, field [1]); break; - case 11: // android_package_name: string / [pointer type] + case 12: // android_package_name: string / [pointer type] Assert.IsTrue (expectedPointerTypes.Contains (field [0]), $"Unexpected pointer field type in '{envFile}:{i}': {field [0]}"); pointers.Add (field [1].Trim ()); break; diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs index 74e8c000c2b..ddf5df41a01 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs @@ -412,6 +412,7 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease) "es", $"{proj.ProjectName}.dll", $"{proj.ProjectName}.pdb", + $"{proj.ProjectName}.runtimeconfig.json", $"{proj.ProjectName}.xml", }; CollectionAssert.AreEqual (expectedFiles, files, $"Expected: {string.Join (";", expectedFiles)}\n Found: {string.Join (";", files)}"); @@ -574,7 +575,7 @@ public abstract class Foo : AbstractViewHandler @@ -2036,7 +2037,8 @@ because xbuild doesn't support framework reference assemblies. UncompressedFileExtensions="$(AndroidStoreUncompressedFileExtensions)" ProjectFullPath="$(MSBuildProjectFullPath)" IncludeWrapSh="$(AndroidIncludeWrapSh)" - CheckedBuild="$(_AndroidCheckedBuild)"> + CheckedBuild="$(_AndroidCheckedBuild)" + RuntimeConfigBinFilePath="$(_BinaryRuntimeConfigPath)"> entry_name; +#if defined (NET6) + bool runtime_config_blob_found = false; +#endif // def NET6 // clang-tidy claims we have a leak in the loop: // @@ -87,6 +90,16 @@ EmbeddedAssemblies::zip_load_entries (int fd, const char *apk_name, monodroid_sh if (strncmp (prefix, file_name, prefix_len) != 0) continue; +#if defined (NET6) + if (application_config.have_runtime_config_blob && !runtime_config_blob_found) { + if (utils.ends_with (file_name, SharedConstants::RUNTIME_CONFIG_BLOB_NAME)) { + runtime_config_blob_found = true; + runtime_config_blob_mmap = md_mmap_apk_file (fd, data_offset, file_size, file_name, apk_name); + continue; + } + } +#endif // def NET6 + // assemblies must be 4-byte aligned, or Bad Things happen if ((data_offset & 0x3) != 0) { log_fatal (LOG_ASSEMBLY, "Assembly '%s' is located at bad offset %lu within the .apk\n", file_name, data_offset); diff --git a/src/monodroid/jni/embedded-assemblies.hh b/src/monodroid/jni/embedded-assemblies.hh index 2ce875dbe1f..204b14d1a0a 100644 --- a/src/monodroid/jni/embedded-assemblies.hh +++ b/src/monodroid/jni/embedded-assemblies.hh @@ -3,6 +3,7 @@ #define INC_MONODROID_EMBEDDED_ASSEMBLIES_H #include +#include #include #include @@ -12,6 +13,7 @@ #include "strings.hh" #include "xamarin-app.hh" +#include "cpp-util.hh" struct TypeMapHeader; @@ -71,6 +73,21 @@ namespace xamarin::android::internal { void set_assemblies_prefix (const char *prefix); +#if defined (NET6) + void get_runtime_config_blob (const char *& area, uint32_t& size) const + { + area = static_cast(runtime_config_blob_mmap.area); + + abort_unless (runtime_config_blob_mmap.size < std::numeric_limits::max (), "Runtime config binary blob size exceeds %u bytes", std::numeric_limits::max ()); + size = static_cast(runtime_config_blob_mmap.size); + } + + bool have_runtime_config_blob () const + { + return application_config.have_runtime_config_blob && runtime_config_blob_mmap.area != nullptr; + } +#endif + private: const char* typemap_managed_to_java (MonoType *type, MonoClass *klass, const uint8_t *mvid); MonoReflectionType* typemap_java_to_managed (const char *java_type_name); @@ -140,6 +157,9 @@ namespace xamarin::android::internal { size_t type_map_count; #endif // DEBUG || !ANDROID const char *assemblies_prefix_override = nullptr; +#if defined (NET6) + md_mmap_info runtime_config_blob_mmap{}; +#endif // def NET6 }; } diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index ff076860669..0a416a77036 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -204,6 +204,7 @@ namespace xamarin::android::internal static const char* get_my_location (bool remove_file_name = true); #endif // defined(WINDOWS) || defined(APPLE_OS_X) #if defined (NET6) + static void cleanup_runtime_config (MonovmRuntimeConfigArguments *args, void *user_data); static void* load_library_entry (std::string const& library_name, std::string const& entrypoint_name, pinvoke_api_map_ptr api_map); static void* fetch_or_create_pinvoke_map_entry (std::string const& library_name, std::string const& entrypoint_name, pinvoke_api_map_ptr api_map, bool need_lock); static void* monodroid_pinvoke_override (const char *library_name, const char *entrypoint_name); @@ -305,6 +306,7 @@ namespace xamarin::android::internal static pinvoke_api_map xa_pinvoke_map; static pinvoke_library_map other_pinvoke_map; static MonoCoreRuntimeProperties monovm_core_properties; + MonovmRuntimeConfigArguments runtime_config_args; #else // def NET6 static std::mutex api_init_lock; static void *api_dso_handle; diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index 897be3c16c1..3a49fd60bbe 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -843,6 +843,20 @@ MonodroidRuntime::mono_runtime_init ([[maybe_unused]] dynamic_local_stringkind != 1 || args->runtimeconfig.data.data == nullptr) { + return; + } + +#if !defined (WINDOWS) + munmap (static_cast(const_cast(args->runtimeconfig.data.data)), args->runtimeconfig.data.data_len); +#endif // ndef WINDOWS +} +#endif // def NET6 + MonoDomain* MonodroidRuntime::create_domain (JNIEnv *env, jstring_array_wrapper &runtimeApks, bool is_root_domain) { @@ -855,6 +869,23 @@ MonodroidRuntime::create_domain (JNIEnv *env, jstring_array_wrapper &runtimeApks gather_bundled_assemblies (runtimeApks, &user_assemblies_count); +#if defined (NET6) + timing_period blob_time; + if (XA_UNLIKELY (utils.should_log (LOG_TIMING))) + blob_time.mark_start (); + + if (embeddedAssemblies.have_runtime_config_blob ()) { + runtime_config_args.kind = 1; + embeddedAssemblies.get_runtime_config_blob (runtime_config_args.runtimeconfig.data.data, runtime_config_args.runtimeconfig.data.data_len); + monovm_runtimeconfig_initialize (&runtime_config_args, cleanup_runtime_config, nullptr); + } + + if (XA_UNLIKELY (utils.should_log (LOG_TIMING))) { + blob_time.mark_end (); + Timing::info (blob_time, "Register runtimeconfig binary blob"); + } +#endif // def NET6 + if (!have_mono_mkbundle_init && user_assemblies_count == 0 && androidSystem.count_override_assemblies () == 0 && !is_running_on_desktop) { log_fatal (LOG_DEFAULT, "No assemblies found in '%s' or '%s'. Assuming this is part of Fast Deployment. Exiting...", androidSystem.get_override_dir (0), diff --git a/src/monodroid/jni/shared-constants.hh b/src/monodroid/jni/shared-constants.hh index 376aad43678..e5e61e8dd8a 100644 --- a/src/monodroid/jni/shared-constants.hh +++ b/src/monodroid/jni/shared-constants.hh @@ -15,6 +15,10 @@ namespace xamarin::android::internal class SharedConstants { public: +#if defined (NET6) + static constexpr char RUNTIME_CONFIG_BLOB_NAME[] = "rc.bin"; +#endif // def NET6 + #if defined (ANDROID) || defined (__linux__) || defined (__linux) static constexpr char MONO_SGEN_SO[] = "libmonosgen-2.0.so"; static constexpr char MONO_SGEN_ARCH_SO[] = "libmonosgen-" __BITNESS__ "-2.0.so"; diff --git a/src/monodroid/jni/xamarin-app.hh b/src/monodroid/jni/xamarin-app.hh index b6303dfddca..6b5cb9ba41e 100644 --- a/src/monodroid/jni/xamarin-app.hh +++ b/src/monodroid/jni/xamarin-app.hh @@ -105,6 +105,7 @@ struct ApplicationConfig bool broken_exception_transitions; bool instant_run_enabled; bool jni_add_native_method_registration_attribute_present; + bool have_runtime_config_blob; uint8_t bound_exception_type; uint32_t package_naming_policy; uint32_t environment_variable_count; From ab244d54aa5b0f30cd52a7a0614b3715a9ffe347 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 11 Jun 2021 08:16:05 -0500 Subject: [PATCH 4/7] Add runtime tests for AppContext --- ...icrosoft.Android.Sdk.RuntimeConfig.targets | 6 ---- .../Mono.Android.NET-Tests.csproj | 1 + .../System/AppContextTests.cs | 31 +++++++++++++++++++ .../runtimeconfig.template.json | 7 +++++ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs create mode 100644 tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/runtimeconfig.template.json diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets index abe140679aa..80123bd04f2 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.RuntimeConfig.targets @@ -32,12 +32,6 @@ See: https://github.com/dotnet/runtime/blob/b13715b6984889a709ba29ea8a1961db469f <_RuntimeConfigReservedProperties Include="PINVOKE_OVERRIDE"/> - - + diff --git a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs new file mode 100644 index 00000000000..e560664d3ec --- /dev/null +++ b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs @@ -0,0 +1,31 @@ +using NUnit.Framework; +using System; + +namespace SystemTests +{ + [TestFixture] + public class AppContextTests + { + static readonly object [] GetDataSource = new object [] { + new object [] { + /* name */ "test_bool", + /* expected */ true, + }, + new object [] { + /* name */ "test_integer", + /* expected */ 42, + }, + new object [] { + /* name */ "test_string", + /* expected */ "foo", + }, + }; + + [Test] + [TestCaseSource (nameof (GetDataSource))] + public void GetData (string name, object expected) + { + Assert.AreEqual (expected, AppContext.GetData (name)); + } + } +} diff --git a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/runtimeconfig.template.json b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/runtimeconfig.template.json new file mode 100644 index 00000000000..a9abdfc23f0 --- /dev/null +++ b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/runtimeconfig.template.json @@ -0,0 +1,7 @@ +{ + "configProperties": { + "test_bool": true, + "test_integer": 42, + "test_string": "foo" + } +} \ No newline at end of file From b60daceac3a80a6cd3ce8bd5d83b72d07a769b58 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 11 Jun 2021 10:58:26 -0500 Subject: [PATCH 5/7] Update AppContextTests.cs Values are always strings --- .../Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs index e560664d3ec..aa8a462d0d8 100644 --- a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs +++ b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/System/AppContextTests.cs @@ -9,11 +9,11 @@ public class AppContextTests static readonly object [] GetDataSource = new object [] { new object [] { /* name */ "test_bool", - /* expected */ true, + /* expected */ "true", }, new object [] { /* name */ "test_integer", - /* expected */ 42, + /* expected */ "42", }, new object [] { /* name */ "test_string", @@ -23,7 +23,7 @@ public class AppContextTests [Test] [TestCaseSource (nameof (GetDataSource))] - public void GetData (string name, object expected) + public void GetData (string name, string expected) { Assert.AreEqual (expected, AppContext.GetData (name)); } From 7ee681d0ebf3febe4b9ca43a347d983e6332a7a4 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 11 Jun 2021 11:01:58 -0500 Subject: [PATCH 6/7] Include assemblies/rc.bin in App Bundles --- src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | 3 ++- 1 file changed, 2 insertions(+), 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 82b58871bc2..f92653485b3 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2069,7 +2069,8 @@ because xbuild doesn't support framework reference assemblies. UncompressedFileExtensions="$(AndroidStoreUncompressedFileExtensions)" ProjectFullPath="$(MSBuildProjectFullPath)" IncludeWrapSh="$(AndroidIncludeWrapSh)" - CheckedBuild="$(_AndroidCheckedBuild)"> + CheckedBuild="$(_AndroidCheckedBuild)" + RuntimeConfigBinFilePath="$(_BinaryRuntimeConfigPath)"> Date: Mon, 14 Jun 2021 14:55:50 -0400 Subject: [PATCH 7/7] Add comment for have_runtime_config_blob --- .../Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs index d2217190c6f..478aade9493 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs @@ -151,7 +151,7 @@ static ApplicationConfig ReadApplicationConfig (string envFile) ret.jni_add_native_method_registration_attribute_present = ConvertFieldToBool ("jni_add_native_method_registration_attribute_present", envFile, i, field [1]); break; - case 7: + case 7: // have_runtime_config_blob: bool / .byte AssertFieldType (envFile, ".byte", field [0], i); ret.have_runtime_config_blob = ConvertFieldToBool ("have_runtime_config_blob", envFile, i, field [1]); break;