-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Summary: Original Author: [email protected] Original Git: a84b2f9 Original Reviewed By: avp Original Revision: D64839005 Add Intl.Collator implementation using ICU4C for non-Android / non-Apple platforms. Classes without ICU / Platform API dependency: * Constants - String constants for options bag’s names and values, valid option values, other constants. * IntlUtils - Conversion between UTF-8 and UTF-16 ASCII strings, convert string to bool, i.e. case- insensitive match against “true”, lowercase ASCII strings. * LocaleBCP47Object - Wrapper over a BCP47Parser::ParsedLocaleIdentifier, provides factory method to create instances from a BCP47 locale string, methods to get canonicalized locale string and locale string without extensions, and implements the CanonicalizeLocaleList() spec operation. * OptionHelpers - Gets string, bool, and number option from options bag. ICU dependent classes: * Collator - Intl.Collator implementation using ICU collator API. * Locale - Conversion between BCP47 and ICU locale strings. * LocaleResolver - Implements ResolveLocale() and SupportedLocales() spec operations, supports both “lookup” and “best fit” locale matching. “best fit” locale matching uses ICU acceptLanguage API. Fix memory leaks in existing DateTimeFormat implementation in PlatformIntlICU.cpp by wrapping created ICU object pointers in unique_ptr. Migrate ResolveLocale, SupportedLocalesOf, GetCanonicalLocales API implementation to use the corresponding newly added supporting classes. Add test cases to verify invalid locales and options input would result in throwing JS exception in collation.js. Add tests cases to verify resolution of locale extensions and options in a new file collation-resolved-options.js. Pull Request resolved: #1413 Pulled By: neildhar Reviewed By: avp Differential Revision: D68920589 fbshipit-source-id: 84e18ebb06aed81bd8a2ba8b3a5c6bdcf3637df7
- Loading branch information
1 parent
c605bcb
commit 58aa95b
Showing
24 changed files
with
2,564 additions
and
685 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -53,3 +53,116 @@ jobs: | |
run: |- | ||
cmake -S hermes -B build -DCMAKE_BUILD_TYPE=Debug | ||
cmake --build build --target check-hermes all -j 4 | ||
test-windows: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
path: hermes | ||
- name: Run Hermes regression tests | ||
run: |- | ||
cmake -S hermes -B build -G 'Visual Studio 16 2019' | ||
cmake --build build --target check-hermes -- -m /p:UseMultiToolTask=true -m /p:EnforceProcessCountAcrossBuilds=true | ||
test-e2e: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
ANDROID_NDK: /usr/local/lib/android/sdk/ndk/27.1.12297006 | ||
HERMES_WS_DIR: /home/runner/work/hermes | ||
REACT_NATIVE_OVERRIDE_HERMES_DIR: /home/runner/work/hermes/hermes | ||
steps: | ||
- name: Install Node | ||
uses: actions/[email protected] | ||
- name: Install JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Checkout Hermes | ||
uses: actions/[email protected] | ||
- name: Checkout React Native | ||
run: |- | ||
cd "$HERMES_WS_DIR" | ||
git clone --depth=1 https://github.com/facebook/react-native | ||
cd react-native | ||
yarn install | ||
echo "console.log('Using Hermes: ' + (global.HermesInternal != null));" >> packages/rn-tester/js/RNTesterApp.android.js | ||
- name: Run RNTester | ||
uses: ReactiveCircus/[email protected] | ||
with: | ||
api-level: 29 | ||
ndk: 27.1.12297006 | ||
cmake: 3.22.1 | ||
script: | | ||
cd ../react-native && ./gradlew -PreactNativeArchitectures=x86 :packages:rn-tester:android:app:installHermesRelease | ||
adb shell am start com.facebook.react.uiapp/.RNTesterActivity | ||
timeout 30s adb logcat -e "Using Hermes: true" -m 1 | ||
test-e2e-intl: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
HERMES_WS_DIR: /home/runner/work/hermes | ||
ANDROID_NDK: /usr/local/lib/android/sdk/ndk/27.1.12297006 | ||
steps: | ||
- name: Checkout Hermes | ||
uses: actions/[email protected] | ||
- name: Checkout Test262 | ||
run: |- | ||
cd "$HERMES_WS_DIR" | ||
git clone https://github.com/tc39/test262 | ||
cd test262 | ||
git checkout 62626e083bd506124aac6c799464d76c2c42851b | ||
- name: Build Hermes Compiler | ||
run: |- | ||
cd "$HERMES_WS_DIR" | ||
cmake -S hermes -B ./build -DCMAKE_BUILD_TYPE=Release | ||
cmake --build ./build -j 4 --target hermesc | ||
- name: Run android tests | ||
uses: ReactiveCircus/[email protected] | ||
with: | ||
api-level: 29 | ||
emulator-options: -timezone Europe/Paris -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
script: cd android && ./gradlew :intltest:prepareTests && ./gradlew -Pabis=x86 :intltest:connectedAndroidTest | ||
test-macos-test262: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: 15.4 | ||
- uses: actions/[email protected] | ||
with: | ||
path: hermes | ||
- name: Setup dependencies | ||
run: |- | ||
brew install cmake ninja | ||
# Check out test262 at a pinned revision to reduce flakiness | ||
git clone https://github.com/tc39/test262 | ||
cd test262 | ||
git checkout 62626e083bd506124aac6c799464d76c2c42851b | ||
- name: Run Hermes tests and test262 with Intl | ||
run: |- | ||
cmake -S hermes -B build -GNinja -DHERMES_ENABLE_INTL=ON | ||
cmake --build ./build | ||
cmake --build ./build --target check-hermes | ||
python3 hermes/utils/testsuite/run_testsuite.py --test-intl test262/test -b build/bin | ||
test-linux-test262: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
path: hermes | ||
- name: Setup dependencies | ||
run: |- | ||
sudo apt update | ||
sudo apt install -y git openssh-client cmake build-essential \ | ||
libreadline-dev libicu-dev zip python3 | ||
# Check out test262 at a pinned revision to reduce flakiness | ||
git clone https://github.com/tc39/test262 | ||
cd test262 | ||
git checkout 62626e083bd506124aac6c799464d76c2c42851b | ||
- name: Run test262 with Intl | ||
run: |- | ||
cmake -S hermes -B build -DHERMES_ENABLE_INTL=ON -DCMAKE_CXX_FLAGS=-O2 -DCMAKE_C_FLAGS=-O2 | ||
cmake --build ./build -j 4 | ||
# Not running Hermes test until more of Intl is built out: | ||
# toLocaleLowerCase and toLocaleUpperCase are the two main ones. | ||
# cmake --build ./build --target check-hermes -j 4 | ||
python3 hermes/utils/testsuite/run_testsuite.py --test-intl test262/test -b build/bin |
This file contains 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 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.