Skip to content

Commit

Permalink
[iOS] HybridGlobalization set flag in SDK (#18498)
Browse files Browse the repository at this point in the history
Add HybridGlobalization flag in SDK and load icudt_hybrid.dat file when
HybridGlobalization is on.

Contributes to dotnet/runtime#80689
  • Loading branch information
mkhamoyan authored Jun 28, 2023
1 parent c0fa2ef commit 3f6d43c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<HybridGlobalization Condition="'$(HybridGlobalization)' == ''">false</HybridGlobalization>
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == '' And '$(_BundlerDebug)' != 'true'">true</UseSystemResourceKeys>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == '' And '$(_BundlerDebug)' == 'true'">false</UseSystemResourceKeys>
Expand All @@ -143,7 +144,8 @@
</PropertyGroup>

<PropertyGroup>
<_GlobalizationDataFile Condition="'$(_PlatformName)' != 'macOS' And '$(InvariantGlobalization)' != 'true' And '$(_GlobalizationDataFile)' == ''">icudt.dat</_GlobalizationDataFile>
<_GlobalizationDataFile Condition="'$(_PlatformName)' != 'macOS' And '$(InvariantGlobalization)' != 'true' And '$(HybridGlobalization)' != 'true' And '$(_GlobalizationDataFile)' == ''">icudt.dat</_GlobalizationDataFile>
<_GlobalizationDataFile Condition="'$(_PlatformName)' != 'macOS' And '$(InvariantGlobalization)' != 'true' And '$(HybridGlobalization)' == 'true' And '$(_GlobalizationDataFile)' == ''">icudt_hybrid.dat</_GlobalizationDataFile>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -494,6 +496,7 @@
Interpreter=$(MtouchInterpreter)
IntermediateLinkDir=$(IntermediateLinkDir)
InvariantGlobalization=$(InvariantGlobalization)
HybridGlobalization=$(HybridGlobalization)
ItemsDirectory=$(_LinkerItemsDirectory)
IsAppExtension=$(IsAppExtension)
IsSimulatorBuild=$(_SdkIsSimulator)
Expand Down
1 change: 1 addition & 0 deletions tests/common/DotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public static void CompareApps (string old_app, string new_app)
var filename = Path.GetFileName (v);
switch (filename) {
case "icudt.dat":
case "icudt_hybrid.dat":
return false; // ICU data file only present on .NET
case "runtime-options.plist":
return false; // the .NET runtime will deal with selecting the http handler, no need for us to do anything
Expand Down
4 changes: 4 additions & 0 deletions tools/dotnet-linker/LinkerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class LinkerConfiguration {
public string GlobalizationDataFile { get; private set; } = string.Empty;
public string IntermediateLinkDir { get; private set; } = string.Empty;
public bool InvariantGlobalization { get; private set; }
public bool HybridGlobalization { get; private set; }
public string ItemsDirectory { get; private set; } = string.Empty;
public bool IsSimulatorBuild { get; private set; }
public string PartialStaticRegistrarLibrary { get; set; } = string.Empty;
Expand Down Expand Up @@ -316,6 +317,9 @@ public static LinkerConfiguration GetInstance (LinkContext context)
case "InvariantGlobalization":
InvariantGlobalization = string.Equals ("true", value, StringComparison.OrdinalIgnoreCase);
break;
case "HybridGlobalization":
HybridGlobalization = string.Equals ("true", value, StringComparison.OrdinalIgnoreCase);
break;
case "XamarinNativeLibraryDirectory":
XamarinNativeLibraryDirectory = value;
break;
Expand Down
2 changes: 2 additions & 0 deletions tools/dotnet-linker/Steps/GenerateMainStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ protected override void TryEndProcess ()
if (Configuration.InvariantGlobalization) {
contents.AppendLine ("\tsetenv (\"DOTNET_SYSTEM_GLOBALIZATION_INVARIANT\", \"1\", 1);");
} else {
if (Configuration.HybridGlobalization)
contents.AppendLine ("\tsetenv (\"DOTNET_SYSTEM_GLOBALIZATION_HYBRID\", \"1\", 1);");
contents.AppendLine ($"\txamarin_icu_dat_file_name = \"{Configuration.GlobalizationDataFile}\";");
}
if (Configuration.Application.PackageManagedDebugSymbols && Configuration.Application.UseInterpreter)
Expand Down

6 comments on commit 3f6d43c

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.