-
Notifications
You must be signed in to change notification settings - Fork 5.1k
ICU integration and asset loading overhaul #37971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
cbae5e5
initial static ICU implementation for wasm
EgorBo f9fc4e3
Update pal_icushim_internal.h
EgorBo bdc8955
Checkpoint
kg b3e2325
Add stubs for tz and calendar, enable tests
EgorBo ca35363
Update System.Private.CoreLib.Shared.projitems
EgorBo 0659c74
Merge branch 'master' of github.com:dotnet/runtime into icu-loader
EgorBo 72078b9
Fix EnumCalendarInfo for wasm (temp workaround)
EgorBo 04993e8
Merge branch 'master' of github.com:dotnet/runtime into icu-loader-egor2
EgorBo 901c499
cccc
EgorBo bf6587a
Fix small issues
EgorBo 39c315a
drop ICU_REPO
EgorBo 7c1855a
Update Program.cs
EgorBo e2a57ff
clean up
EgorBo f77ad54
Update tests.proj
EgorBo 529e8e1
Update Program.cs
EgorBo c0fb094
Update tests.proj
EgorBo 9698771
Checkpoint
kg 6d5494a
Checkpoint
kg 632d1fa
Checkpoint
kg 99b64a0
Checkpoint
kg 73e7ec3
Checkpoint
kg 857cd9b
Fix formatting error
kg 858a2af
Checkpoint
kg 5ff4030
Checkpoint
kg df66deb
bump ICU nuget, skip some tests
EgorBo fea9e1b
Merge branch 'icu-loader' of github.com:kg/runtime into icu-loader
EgorBo bf979b3
Checkpoint
kg 4872ae4
Fix whitespace
kg ec10683
Checkpoint
kg 7ec82a8
Checkpoint
kg 301b1e6
Address PR feedback, cleanup whitespace
kg 563e985
Remove testing fallback URL
kg 1a5f206
Switch back to using u_init because getCLDRVersion is broken.
kg a64b46a
Implement get_loaded_files
kg ea40744
Make loader diagnostic messages optional and off by default
kg 642d35f
Also silence the loaded assets dict
kg 960ebf0
Apply tracing flag to vfs logs as well
kg cb5c2b2
Merge branch 'master' of github.com:dotnet/runtime into icu-loader
EgorBo 54401b4
ulocdata_getCLDRVersion works with new ICU nuget
EgorBo e6faed4
Merge branch 'master' of github.com:dotnet/runtime into icu-loader
EgorBo 7f904dc
Update RegionInfoTests.cs
EgorBo 5dbe40b
Update pal_icushim_internal.h
EgorBo 5544389
Make sure the VFS files have write permissions
akoeplinger 88a776a
Address feedback
EgorBo 30af86f
Disable two tests in System.Runtime.Extensions
EgorBo 801b95e
Add satellite assemblies to VFS
akoeplinger c06c63b
EnglishName_TestData is back to normal for ICU
EgorBo 2e4ed37
Create and populate MONO.loaded_files
kg 855b840
Add icu data file to runtimepack
akoeplinger 4ea64d9
Adjust public interface for various bits of setup
kg 3fb2ec9
Add compatibility shim for runtime_and_bcl, export some APIs
kg da89834
Remove now-broken ICUDataFiles parameter from csproj
kg 4ac3230
Fix spurious ICU load error
kg 279ec28
Store asset URLs into loaded_files instead of names
kg 23ea27c
Address feedback
EgorBo cafd0f2
Update src/libraries/Common/src/Interop/Interop.TimeZoneInfo.Browser.cs
lewing c95ad39
Merge remote-tracking branch 'upstream/master' into icu-loader
kg 3eaa5fb
Revert sample changes
kg 794e290
Update src/libraries/Native/Unix/System.Globalization.Native/pal_icus…
kg 34867d7
enable NativeCalendarName and RegionInfo.NativeName tests for wasm
EgorBo fe0e686
Update Version.Details.xml
EgorBo 9b20a78
bump ICU
EgorBo 49097be
Address feedback
EgorBo adc967e
Update Interop.TimeZoneInfo.Browser.cs
EgorBo 6cf61e0
Address feedback
EgorBo eff92b4
Address feedback
EgorBo 7a1a28e
ignore Interop.TimeZoneInfo on wasm
EgorBo d64d256
Address feedback
EgorBo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/libraries/Common/src/Interop/Interop.TimeZoneDisplayNameType.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Globalization | ||
{ | ||
// needs to be kept in sync with TimeZoneDisplayNameType in System.Globalization.Native | ||
internal enum TimeZoneDisplayNameType | ||
{ | ||
Generic = 0, | ||
Standard = 1, | ||
DaylightSavings = 2, | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include "pal_icushim_internal.h" | ||
#include "pal_icushim.h" | ||
#include <unicode/putil.h> | ||
#include <unicode/uversion.h> | ||
#include <unicode/localpointer.h> | ||
#include <unicode/utrace.h> | ||
|
||
static void log_icu_error(const char* name, UErrorCode status) | ||
{ | ||
const char * statusText = u_errorName(status); | ||
fprintf(stderr, "ICU call %s failed with error #%d '%s'.\n", name, status, statusText); | ||
} | ||
|
||
static void U_CALLCONV icu_trace_data(const void* context, int32_t fnNumber, int32_t level, const char* fmt, va_list args) | ||
{ | ||
char buf[1000]; | ||
utrace_vformat(buf, sizeof(buf), 0, fmt, args); | ||
printf("[ICUDT] %s: %s\n", utrace_functionName(fnNumber), buf); | ||
} | ||
|
||
#ifdef __EMSCRIPTEN__ | ||
#include <emscripten.h> | ||
|
||
EMSCRIPTEN_KEEPALIVE int32_t mono_wasm_load_icu_data(void * pData); | ||
|
||
EMSCRIPTEN_KEEPALIVE int32_t mono_wasm_load_icu_data(void * pData) | ||
{ | ||
UErrorCode status = 0; | ||
udata_setCommonData(pData, &status); | ||
|
||
if (U_FAILURE(status)) { | ||
log_icu_error("udata_setCommonData", status); | ||
return 0; | ||
} else { | ||
//// Uncomment to enable ICU tracing, | ||
//// see https://github.com/unicode-org/icu/blob/master/docs/userguide/icu_data/tracing.md | ||
// utrace_setFunctions(0, 0, 0, icu_trace_data); | ||
// utrace_setLevel(UTRACE_VERBOSE); | ||
return 1; | ||
} | ||
} | ||
#endif | ||
|
||
int32_t GlobalizationNative_LoadICU(void) | ||
{ | ||
const char* icudir = getenv("DOTNET_ICU_DIR"); | ||
if (icudir) | ||
u_setDataDirectory(icudir); | ||
else | ||
; // default ICU search path behavior will be used, see http://userguide.icu-project.org/icudata | ||
|
||
UErrorCode status = 0; | ||
UVersionInfo version; | ||
// Request the CLDR version to perform basic ICU initialization and find out | ||
// whether it worked. | ||
ulocdata_getCLDRVersion(version, &status); | ||
|
||
if (U_FAILURE(status)) { | ||
log_icu_error("ulocdata_getCLDRVersion", status); | ||
return 0; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
void GlobalizationNative_InitICUFunctions(void* icuuc, void* icuin, const char* version, const char* suffix) | ||
{ | ||
// no-op for static | ||
} | ||
|
||
int32_t GlobalizationNative_GetICUVersion(void) | ||
{ | ||
UVersionInfo versionInfo; | ||
u_getVersion(versionInfo); | ||
|
||
return (versionInfo[0] << 24) + (versionInfo[1] << 16) + (versionInfo[2] << 8) + versionInfo[3]; | ||
EgorBo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.