Skip to content

Commit

Permalink
Support the Hermes JS engine through JSI (#4536)
Browse files Browse the repository at this point in the history
* [10.20.0-alpha.0] PRE-RELEASE - DO NOT USE IN PRODUCTION

* [10.20.0-alpha.1] Bump version

* [10.20.0-alpha.2] Bump version

Rename namespaces in the JSI codebase to reflect that it doesn't just support Hermes (#4079)

Rework the namespace names in our Hermes/JSI layer to more accurately reflect that we support JSI, and to remove ambiguities and namespace clashes.

This closes RJS-1337.

Fixing C++ lint error

* [10.20.0-beta.0] Bump version

Hermes: Fixing a couple of breaking tests (#4120)

* Relaxing error message asserting tests

* Fixing testListSubscriptSetters

Catching missing libjsi.so as librealm.so loads (#4123)

Updated RN peer dependency version (#4124)

Fix classes not extending `Realm.Object` (#4125)

* Fixing custom classes not extending Realm.Object

* Adding a note to the changelog

* Update CHANGELOG.md

Co-authored-by: FFranck <[email protected]>

Co-authored-by: FFranck <[email protected]>

Fixed throwing "Illegal constructor" (#4128)

Clarifying the get_internal early return

Refixed throwing "Illegal constructor"

Various JSI fixes to greenlight more tests (#4129)

Flipper doesnt support inlined sourcemaps

Return an existing s_ctor

Testing with Hermes on CI (#4106)

* Adding hermes as target branch for the integration tests workflow

* Reading environment variable when enabling Hermes

* Adding test app to watchable directories

* Adding a hermes variant when testing React Native

* Making the ccache engine specific

* Moved react-native entry point to fix lint error

* Attempt at fixing ReactTestAppTests

* Update Podfile to work around the Catalyst issue

Fixes for type conversions and minor cleanups (#4137)

* [10.20.0-beta.1] Bump version

Clean up JavaScriptCore & legacy Chrome debugger RPC layer (#4203)

* Removed 0xd3adc0d3

* Providing a "soft" landing for users running in legacy debugging mode

* Simplified index.js as we have react-native/index.js

* Removed some logging

* Adding a note to the CHANGELOG

* Stop integration testing in legacy debug mode

* Incorporated feedback

* Fixed the environment check 🤦‍♂️

* Removed all mentions of GCDWebServer

Prevent dangling objects on JSCRuntime destruction (#4228)

* WIP

* Refactored to a separate js_notifications.hpp

* Using the NotificationBucket throughout the codebase

* Adding a note to the changelog

* Fixed compiling on GCC

* Trigger garbage collection after every test

* Ensure s_tokens static gets initialized before use

Removed a bash only prepare command

* [10.20.0-beta.2] Bump version

Adding changelog template

Updated package-locks

Copied up the change log

* [10.20.0-beta.3] Bump version

* [10.20.0-beta.4] Bump version

Hermes: Adding an index.native.js (#4461)

* Ading an index.native.js to help bundlers

* Adding a note to the changelog

Update CMakeLists.txt to resolve "react-native" (#4466)

* Update CMakeLists.txt to resolve "react-native"

This enables end-users to build the iOS XCFramework locally from our npm package, if they need it built with the same version of Xcode as they're using to build their app.

* Update CHANGELOG.md

* Updating package-lock.json

* Adding changelog template

* [10.20.0-beta.5] Bump version

* Adding changelog template

* Rolling up relevant notes in changelog

* Class models: `Realm.Object#constructor` for JSI / Hermes (#4435)

* Create prototyped object instead of constructor call

Recreated package-lock

* Ran lint fix

Co-authored-by: Mathias Stearn <[email protected]>

Updated the merge
  • Loading branch information
kraenhansen committed May 18, 2022
1 parent 51d1387 commit 15b24b8
Show file tree
Hide file tree
Showing 128 changed files with 45,980 additions and 25,746 deletions.
50 changes: 20 additions & 30 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:
push:
branches:
- master
- hermes

jobs:
node:
Expand Down Expand Up @@ -147,7 +148,7 @@ jobs:
MOCHA_REMOTE_CONTEXT: missingServer
MOCHA_REMOTE_REPORTER: mocha-github-actions-reporter
react-native-ios:
name: React Native on ${{matrix.platform.name}} (${{ matrix.type }})
name: React Native on ${{matrix.platform.name}} (${{ matrix.type }} using ${{ matrix.platform.engine }})
runs-on: macos-latest
timeout-minutes: 60
strategy:
Expand All @@ -158,12 +159,18 @@ jobs:
type: [Release]
platform:
- name: ios
engine: hermes
build-configuration: simulator
- name: ios
engine: jsc
build-configuration: simulator
- name: catalyst
engine: jsc
build-configuration: catalyst
env:
# Pin the Xcode version
DEVELOPER_DIR: /Applications/Xcode_12.4.app
HERMES_ENABLED: ${{ matrix.platform.engine == 'hermes' && 'true' || 'false' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -191,7 +198,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.platform.name }}-${{ matrix.type }}
key: ${{ github.job }}-${{ matrix.platform.engine }}-${{ matrix.platform.name }}-${{ matrix.type }}
- name: Prepend ccache executables to the PATH
run: echo PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV

Expand All @@ -215,25 +222,21 @@ jobs:
MOCHA_REMOTE_EXIT_ON_ERROR: true
RETRIES: 5
RETRY_DELAY: 300000 # 5 min
- name: Run tests (${{matrix.platform.name}} / Chrome Debugging)
if: ${{ false }}
run: npm run test:${{matrix.platform.name}}:chrome --prefix integration-tests/environments/react-native
env:
MOCHA_REMOTE_CONTEXT: missingServer
MOCHA_REMOTE_REPORTER: mocha-github-actions-reporter
MOCHA_REMOTE_EXIT_ON_ERROR: true
HEADLESS_DEBUGGER: true
RETRIES: 5
RETRY_DELAY: 300000 # 5 min
react-native-android:
name: React Native on Android (${{ matrix.type }})
name: React Native on Android (${{ matrix.type }} using ${{ matrix.engine }})
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
#TODO: Reactivate debug when builds are optimized
#type: [Release, Debug]
type: [Release]
type:
- Release
# TODO: Reactivate debug when builds are optimized
# - Debug
engine:
- hermes
- jsc
env:
HERMES_ENABLED: ${{ matrix.engine == 'hermes' && 'true' || 'false' }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -268,7 +271,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.type }}
key: ${{ github.job }}-${{ matrix.engine }}-${{ matrix.type }}
- name: Prepend ccache executables to the PATH
run: echo PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV

Expand Down Expand Up @@ -296,16 +299,3 @@ jobs:
MOCHA_REMOTE_REPORTER: mocha-github-actions-reporter
MOCHA_REMOTE_EXIT_ON_ERROR: true
SPAWN_LOGCAT: true
- name: Run tests (Android / Chrome Debugging)
if: ${{ false }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
target: google_apis
script: npm run test:android:chrome --prefix integration-tests/environments/react-native
env:
MOCHA_REMOTE_CONTEXT: missingServer
MOCHA_REMOTE_REPORTER: mocha-github-actions-reporter
MOCHA_REMOTE_EXIT_ON_ERROR: true
HEADLESS_DEBUGGER: true
SPAWN_LOGCAT: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ yarn.lock
# Android/IJ
/android
/react-native/android/src/main/jni/core
/react-native/android/.cxx/
/build-android/
.idea
.gradle
local.properties
Expand Down Expand Up @@ -87,7 +89,6 @@ integration-tests/**/.lock
/react-native/android/src/main/jni/src/
/build-tmp*/
/cmakebuild/
/build-realm-android/
/react-native/android/src/main/java/io/realm/react/Version.java
/react-native/android/src/main/jniLibs/
/realm*.tgz
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "vendor/GCDWebServer"]
path = vendor/GCDWebServer
url = https://github.com/swisspol/GCDWebServer.git
[submodule "docs/jsdoc-template"]
path = docs/jsdoc-template
url = https://github.com/realm/realm-jsdoc.git
Expand Down
3 changes: 1 addition & 2 deletions .watchmanconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"react-native/node_modules",
"packages/realm-app-importer",
"packages/realm-web",
"packages/realm-web-integration-tests",
"tests"
"packages/realm-web-integration-tests"
]
}
101 changes: 98 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
x.x.x Release notes (yyyy-MM-dd)
=============================================================
### Notes
Based on Realm JS v10.17.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.16.0).

### Breaking change
* Removed all code related to the legacy Chrome Debugger. Please use [Flipper](https://fbflipper.com/) as debugger.
* Model classes passed as schema to the `Realm` constructor must now extend `Realm.Object` and will no longer have their constructors called when pulling an object of that type from the database. Existing classes already extending `Realm.Object` now need to call the `super` constructor passing two arguments:
- `realm`: The Realm to create the object in.
- `values`: Values to pass to the `realm.create` call when creating the object in the database.
* Renamed the `RealmInsertionModel<T>` type to `Unmanaged<T>` to simplify and highlight its usage.

### Enhancements
* Adding support for Hermes on iOS & Android.
* Class-based models (i.e. user defined classes extending `Realm.Object` and passed through the `schema` when opening a Realm), will now create object when their constructor is called:

```ts
Expand All @@ -27,9 +32,6 @@ realm.write(() => {
});
```

### Enhancements
* None.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None.
Expand All @@ -41,6 +43,7 @@ realm.write(() => {
* File format: generates Realms with format v22 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
* Remove the previous implementation to the JavaScriptCore engine (in `src/jsc`).
* <Either mention core version or upgrade>
* <Using Realm Core vX.Y.Z>
* <Upgraded Realm Core from vX.Y.Z to vA.B.C>
Expand Down Expand Up @@ -73,6 +76,11 @@ realm.write(() => {
* Fixed a typo in the `testRealmConversions` test which prevented some test scenarios from executing.
* Upgraded Realm Core from v11.14.0 to v11.15.0.

10.20.0-beta.5 Release notes (2022-4-13)
=============================================================
### Notes
Based on Realm JS v10.16.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.15.0).

10.16.0 Release notes (2022-4-12)
=============================================================
### Enhancements
Expand All @@ -90,6 +98,15 @@ realm.write(() => {
### Internal
* Upgraded Realm Core from v11.13.0 to v11.14.0.

10.20.0-beta.4 Release notes (2022-4-11)
=============================================================
### Notes
Based on Realm JS v10.15.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.14.0).

### Fixed
* Changed "react-native" main field to point to a `lib/index.native.js` file to help bundlers pick the right file when loading our library on React Native. ([#4459](https://github.com/realm/realm-js/issues/4459))
* Fixed resolving the "react-native" package when building from source, enabling developers to run the `./scripts/build-ios.sh` script themselves to build our iOS artifacts with the same version of Xcode / LLVM as they're building their app.

10.15.0 Release notes (2022-4-11)
=============================================================
### Enhancements
Expand All @@ -111,6 +128,11 @@ realm.write(() => {
* Upgraded Realm Core from v11.12.0 to v11.13.0.
* Added a failing test case for Node.js scripts failing to exit cleanly ([#4556](https://github.com/realm/realm-js/pull/4556))

10.20.0-beta.3 Release notes (2022-3-24)
=============================================================
### Notes
Based on Realm JS v10.14.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.13.0).

10.14.0 Release notes (2022-3-24)
=============================================================
### Enhancements
Expand Down Expand Up @@ -143,6 +165,11 @@ realm.write(() => {
* Fixed React Native Android integration test harness to read only one pid when starting logcat.
* Added a script to generate JS template apps from TS, and updated JS templates. ([4374](https://github.com/realm/realm-js/pull/4374))

10.20.0-beta.2 Release notes (2022-2-14)
=============================================================
### Notes
Based on Realm JS v10.13.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.12.0).

10.13.0 Release notes (2022-2-11)
=============================================================
### Enhancements
Expand All @@ -168,6 +195,23 @@ realm.write(() => {
* Fixed an issue where some references were not updated from `Subscriptions` to `SubscriptionSet`. ([#4298](https://github.com/realm/realm-js/pull/4298))
* Submitting [analytics](https://github.com/realm/realm-js/blob/master/README.md#analytics) as a postinstall script.

10.20.0-beta.1 Release notes (2022-1-27)
=============================================================
### Notes
Based on Realm JS v10.12.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.11.0).

### Breaking change
* Removed all code related to the legacy Chrome Debugger. Please use [Flipper](https://fbflipper.com/) as debugger.

### Enhancements
* None.

### Fixed
* Fixed "JSCRuntime destroyed with a dangling API object" assertion when reloading an app in debug mode while running with Hermes engine disabled. ([#4115](https://github.com/realm/realm-js/issues/4115), since 10.20.0-alpha.0)

### Internal
* Remove the previous implementation to the JavaScriptCore engine (in `src/jsc`).

10.12.0 Release notes (2022-1-24)
=============================================================
### Notes
Expand Down Expand Up @@ -207,6 +251,18 @@ Please note the following API changes from the `10.12.0-beta.1` release of Flexi
* Enabled `strictNullChecks` for integration tests
* Updated release instructions

10.20.0-beta.0 Release notes (2021-12-21)
=============================================================
### Notes
Based on Realm JS v10.11.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.10.1).

### Enhancements
* Catching missing libjsi.so when loading the librealm.so and rethrowing a more meaningful error, instructing users to upgrade their version of React Native.

### Fixed
* Fixed support of user defined classes that don't extend `Realm.Object`.
* Fixed throwing "Illegal constructor" when `new` constructing anything other than `Realm` and `Realm.Object`.

10.11.0 Release notes (2021-12-21)
=============================================================
### Enhancements
Expand Down Expand Up @@ -258,6 +314,23 @@ const config = {
* Added a performance test suite to the integration test.
* Upgraded Realm Core from v11.6.1 to v11.7.0.

10.20.0-alpha.2 Release notes (2021-11-25)
=============================================================
### Notes
NOTE: DO NOT USE THIS RELEASE IN PRODUCTION!
NOTE: This is an early (alpha) release with Hermes/JSI support: We expect crashes and bugs.

Based on Realm JS v10.10.1: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.8.0).

### Enhancements
* None.

### Fixed
* Hot reloading on Android no longer crash the app.

### Internal
* Restructured C++ namespaces and files to reflect that we support JSI, not just Hermes.

10.10.1 Release notes (2021-11-18)
=============================================================
### Enhancements
Expand Down Expand Up @@ -370,6 +443,17 @@ const config = {
* Using Realm Core v11.4.1.
* Small fix to Jenkins to publish Docker image for Raspberry Pi.

10.20.0-alpha.1 Release notes (2021-9-1)
=============================================================
### Notes
NOTE: DO NOT USE THIS RELEASE IN PRODUCTION!
NOTE: This is an early (alpha) release with Hermes/JSI support. Only iOS is supported and we expect crashes and bugs.

Based on Realm JS v10.8.0: See changelog below for details on enhancements and fixes introduced between this and the previous pre release (which was based on Realm JS v10.7.0).

### Enhancements
* Adding support for Hermes on Android.

10.8.0 Release notes (2021-9-14)
=============================================================
### Enhancements
Expand All @@ -395,6 +479,17 @@ const config = {
* Extend Jest test runner to cover opening and closing of a Realm.
* Disable analytics if the `CI` environment variable is set to some value.

10.20.0-alpha.0 Release notes (2021-9-1)
=============================================================
### Notes
NOTE: DO NOT USE THIS RELEASE IN PRODUCTION!
NOTE: This is an early (alpha) release with Hermes/JSI support. Only iOS is supported and we expect crashes and bugs.

Based on Realm JS v10.7.0: See changelog below for details on enhancements and fixes introduced by that version.

### Enhancements
- Adding support for Hermes (iOS only).

10.7.0 Release notes (2021-8-30)
=============================================================
### Enhancements
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

set(PACKAGE_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED CMAKE_JS_VERSION)
include(NodeJSTargets)
endif()
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ ENV LD_LIBRARY_PATH /opt/rh/httpd24/root/usr/lib64:/opt/rh/python27/root/usr/lib

# Ensure a new enough version of CMake is available.
RUN cd /opt \
&& curl -O -J https://cmake.org/files/v3.15/cmake-3.15.2-Linux-x86_64.tar.gz \
&& tar zxf cmake-3.15.2-Linux-x86_64.tar.gz
ENV PATH "/opt/cmake-3.15.2-Linux-x86_64/bin:$PATH"
&& curl -O -J https://cmake.org/files/v3.21/cmake-3.21.3-linux-x86_64.tar.gz \
&& tar zxf cmake-3.21.3-linux-x86_64.tar.gz
ENV PATH "/opt/cmake-3.21.3-linux-x86_64/bin/:$PATH"
12 changes: 6 additions & 6 deletions Dockerfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RUN echo 'Installing Android SDK' && \
"platform-tools" \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-26" \
"cmake;3.10.2.4988404"\
"cmake;3.18.1"\
"system-images;android-29;default;x86" && \
\
echo 'Installing Android NDK' && \
Expand All @@ -75,8 +75,8 @@ RUN mkdir -p $NVM_DIR \
&& chmod a+rwX -R $NVM_DIR

# Ensure a new enough version of CMake is available.
RUN mkdir -p /home/jenkins/cmake && \
cd /home/jenkins/cmake && \
curl -O -J https://cmake.org/files/v3.17/cmake-3.17.5-Linux-x86_64.tar.gz &&\
tar zxf cmake-3.17.5-Linux-x86_64.tar.gz
ENV PATH "/home/jenkins/cmake/cmake-3.17.5-Linux-x86_64/bin:$PATH"
RUN mkdir -p /home/jenkins/cmake \
&& cd /home/jenkins/cmake \
&& curl -O -J https://cmake.org/files/v3.21/cmake-3.21.3-linux-x86_64.tar.gz \
&& tar zxf cmake-3.21.3-linux-x86_64.tar.gz
ENV PATH "/home/jenkins/cmake/cmake-3.21.3-linux-x86_64/bin/:$PATH"
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ def buildiOS() {
return buildMacOS {
withEnv(['SDK_ROOT_OVERRIDE=/Applications/Xcode-12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/',
'DEVELOPER_DIR_OVERRIDE=/Applications/Xcode-12.4.app']) {
sh 'npm ci'
sh './scripts/build-iOS.sh -c Release'
dir('react-native/ios') {
dir('react-native/ios') {
// Uncomment this when testing build changes if you want to be able to download pre-built artifacts from Jenkins.
// archiveArtifacts('realm-js-ios.xcframework/**')
stash includes: 'realm-js-ios.xcframework/**', name: 'realm-js-ios.xcframework'
Expand Down
Loading

0 comments on commit 15b24b8

Please sign in to comment.