Skip to content

Commit

Permalink
[browser] Remove WASM HybridGlobalization from runtime code (#110567)
Browse files Browse the repository at this point in the history
* Removal of `HybridGlobalization` code from the runtime and libs.

* Remove `HybridGlobalization` flag and clean the tests from it.

* Fix build.

* Fix build, remove unused leftovers.

* Fix linker tests.

* Fix the CI error, revert "icudt_hybrid.dat" removal.

* Fix WBT that expected `icudt_hybrid.dat` to be missing.
  • Loading branch information
ilonatommy authored Dec 17, 2024
1 parent ce9dd2a commit 8a25506
Show file tree
Hide file tree
Showing 69 changed files with 79 additions and 2,218 deletions.
4 changes: 1 addition & 3 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,13 @@
$(LibrariesNativeArtifactsPath)dotnet.js;
$(LibrariesNativeArtifactsPath)dotnet.js.map;
$(LibrariesNativeArtifactsPath)dotnet.native.js;
$(LibrariesNativeArtifactsPath)dotnet.globalization.js;
$(LibrariesNativeArtifactsPath)dotnet.runtime.js;
$(LibrariesNativeArtifactsPath)dotnet.runtime.js.map;
$(LibrariesNativeArtifactsPath)dotnet.d.ts;
$(LibrariesNativeArtifactsPath)package.json;
$(LibrariesNativeArtifactsPath)dotnet.native.wasm;
$(LibrariesNativeArtifactsPath)dotnet.native.js.symbols;
$(LibrariesNativeArtifactsPath)*.dat;
$(LibrariesNativeArtifactsPath)segmentation-rules.json;"
$(LibrariesNativeArtifactsPath)*.dat;"
IsNative="true" />
<!-- for threaded wasm -->
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'browser' and Exists('$(LibrariesNativeArtifactsPath)dotnet.native.worker.mjs')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
<PlatformManifestFileEntry Include="dotnet.runtime.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.runtime.js.map" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.globalization.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.worker.mjs" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.js.symbols" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.d.ts" IsNative="true" />
Expand All @@ -236,7 +235,6 @@
<PlatformManifestFileEntry Include="icudt_optimal.dat" IsNative="true" />
<PlatformManifestFileEntry Include="icudt_optimal_no_CJK.dat" IsNative="true" />
<PlatformManifestFileEntry Include="icudt_hybrid.dat" IsNative="true" />
<PlatformManifestFileEntry Include="segmentation-rules.json" IsNative="true" />
<PlatformManifestFileEntry Include="package.json" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.es6.pre.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.es6.lib.js" IsNative="true" />
Expand Down
14 changes: 0 additions & 14 deletions src/libraries/Common/src/Interop/Browser/Interop.Calendar.cs

This file was deleted.

22 changes: 0 additions & 22 deletions src/libraries/Common/src/Interop/Browser/Interop.CompareInfo.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/libraries/Common/src/Interop/Browser/Interop.Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ internal static partial class Interop
{
internal static unsafe partial class JsGlobalization
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern unsafe nint GetCultureInfo(char* culture, int cultureLength, char* buffer, int bufferMaxLength, out int resultLength);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern unsafe nint GetFirstDayOfWeek(char* culture, int cultureLength, out int resultPtr);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern unsafe nint GetFirstWeekOfYear(char* culture, int cultureLength, out int resultPtr);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern unsafe nint GetLocaleInfo(char* locale, int localeLength, char* culture, int cultureLength, char* buffer, int bufferLength, out int resultLength);
}
Expand Down
13 changes: 0 additions & 13 deletions src/libraries/Common/src/Interop/Browser/Interop.TextInfo.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.NoX86Intrinsics.xml" Condition="'$(SupportsX86Intrinsics)' != 'true'" />
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml" Condition="'$(SupportsWasmIntrinsics)' != 'true'" />
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.iOS.xml" Condition="'$(IsiOSLike)' == 'true'" />
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.Browser.xml" Condition="'$(TargetsBrowser)' == 'true'" />
<ILLinkLinkAttributesXmls Include="$(ILLinkSharedDirectory)ILLink.LinkAttributes.Shared.xml" />
<ILLinkSuppressionsLibraryBuildXml Include="$(ILLinkSharedDirectory)ILLink.Suppressions.LibraryBuild.xml" />
<ILLinkDescriptorsLibraryBuildXml Include="$(ILLinkSharedDirectory)ILLink.Descriptors.LibraryBuild.xml" />
Expand Down Expand Up @@ -337,7 +336,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\Calendar.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarAlgorithmType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Browser.cs" Condition="'$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Icu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Nls.cs" />
Expand All @@ -351,7 +349,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Invariant.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Nls.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Utf8.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.WebAssembly.cs" Condition="'$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.cs" />
Expand Down Expand Up @@ -413,7 +410,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.Icu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.Nls.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.WebAssembly.cs" Condition="'$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\ThaiBuddhistCalendar.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TimeSpanFormat.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TimeSpanParse.cs" />
Expand Down Expand Up @@ -1341,18 +1337,9 @@
<Compile Include="$(MSBuildThisFileDirectory)System\WeakReference.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\WeakReference.T.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\ComAwareWeakReference.cs" />
<Compile Include="$(CommonPath)Interop\Browser\Interop.CompareInfo.cs" Condition="'$(TargetsBrowser)' == 'true'">
<Link>Common\Interop\Interop.CompareInfo.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Browser\Interop.Calendar.cs" Condition="'$(TargetsBrowser)' == 'true'">
<Link>Common\Interop\Interop.Calendar.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Browser\Interop.Locale.cs" Condition="'$(TargetsBrowser)' == 'true'">
<Link>Common\Interop\Browser\Interop.Locale.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Browser\Interop.TextInfo.cs" Condition="'$(TargetsBrowser)' == 'true'">
<Link>Common\Interop\Interop.TextInfo.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Calendar.cs">
<Link>Common\Interop\Interop.Calendar.cs</Link>
</Compile>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ internal sealed partial class CalendarData
{
private bool LoadCalendarDataFromSystemCore(string localeName, CalendarId calendarId)
{
#if TARGET_BROWSER
return GlobalizationMode.Hybrid ?
JSLoadCalendarDataFromBrowser(localeName, calendarId) :
IcuLoadCalendarDataFromSystem(localeName, calendarId);
#elif TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
return GlobalizationMode.Hybrid ?
LoadCalendarDataFromNative(localeName, calendarId) :
IcuLoadCalendarDataFromSystem(localeName, calendarId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ private void InitializeEraNames(string localeName, CalendarId calendarId)
break;

default:
#if TARGET_BROWSER
if (GlobalizationMode.Hybrid && !AreEraNamesEmpty())
{
// we don't want to have this overwritten because JS already loaded it
break;
}
#endif
// Most calendars are just "A.D."
this.saEraNames = Invariant.saEraNames;
break;
Expand Down
Loading

0 comments on commit 8a25506

Please sign in to comment.