From 6d2e0b5de8820a29a4e0dc95dbdb04143c6a2bd8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 20 Jun 2023 12:08:15 +0200 Subject: [PATCH] [dotnet] Treat the ICU data file as a resource instead of an assembly. We can fix this better once this fix reaches us: https://github.com/dotnet/runtime/pull/87813 because then we can set the ICU data file at build time (to a relative path). --- dotnet/targets/Xamarin.Shared.Sdk.targets | 7 ++++++- runtime/runtime.m | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 142d8753a86a..37f84d48c5f0 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -153,6 +153,11 @@ + + <_GlobalizationDataFileLocation Condition="'$(_UseNativeAot)' == 'true'">Resource + <_GlobalizationDataFileLocation Condition="'$(_UseNativeAot)' != 'true'">Assembly + + @@ -1651,7 +1656,7 @@ '%(ResolvedFileToPublish.Filename)%(ResolvedFileToPublish.Extension)' == '$(_GlobalizationDataFile)' And '%(ResolvedFileToPublish.NuGetPackageId)' == '$(_MonoNugetPackageId)' " - PublishFolderType="Assembly" + PublishFolderType="$(_GlobalizationDataFileLocation)" /> diff --git a/runtime/runtime.m b/runtime/runtime.m index 1c0e08f544a4..dfb9123876d3 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -2589,12 +2589,14 @@ -(void) xamarinSetFlags: (enum XamarinGCHandleFlags) flags; int subtractPropertyCount = 0; if (xamarin_icu_dat_file_name != NULL && *xamarin_icu_dat_file_name != 0) { +#if !defined (NATIVEAOT) char path [1024]; if (!xamarin_locate_app_resource (xamarin_icu_dat_file_name, path, sizeof (path))) { LOG (PRODUCT ": Could not locate the ICU data file '%s' in the app bundle.\n", xamarin_icu_dat_file_name); } else { icu_dat_file_path = strdup (path); } +#endif // !defined (NATIVEAOT) } else { subtractPropertyCount++; }