Skip to content

Commit

Permalink
[dotnet] Treat the ICU data file as a resource instead of an assembly.
Browse files Browse the repository at this point in the history
We can fix this better once this fix reaches us:

    dotnet/runtime#87813

because then we can set the ICU data file at build time (to a relative path).
  • Loading branch information
rolfbjarne committed Jun 22, 2023
1 parent 42d6121 commit 3c912d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
<!-- Default item includes (globs and implicit references) -->
<Import Project="Xamarin.Shared.Sdk.DefaultItems.targets" />

<PropertyGroup Condition="'$(_GlobalizationDataFileLocation)' == ''">
<_GlobalizationDataFileLocation Condition="'$(_UseNativeAot)' == 'true'">Resource</_GlobalizationDataFileLocation>
<_GlobalizationDataFileLocation Condition="'$(_UseNativeAot)' != 'true'">Assembly</_GlobalizationDataFileLocation>
</PropertyGroup>

<!-- dotnet publish -->
<Import Project="Xamarin.Shared.Sdk.Publish.targets" />

Expand Down Expand Up @@ -1650,7 +1655,7 @@
'%(ResolvedFileToPublish.Filename)%(ResolvedFileToPublish.Extension)' == '$(_GlobalizationDataFile)' And
'%(ResolvedFileToPublish.NuGetPackageId)' == '$(_MonoNugetPackageId)'
"
PublishFolderType="Assembly"
PublishFolderType="$(_GlobalizationDataFileLocation)"
/>

<!-- Remove the libxamarin-*.dylib files we don't want -->
Expand Down
2 changes: 2 additions & 0 deletions runtime/runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down

0 comments on commit 3c912d7

Please sign in to comment.