Skip to content

Commit

Permalink
[10.20.0-alpha.2] Bump version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kraenhansen committed Mar 31, 2022
1 parent c730605 commit e7089b9
Show file tree
Hide file tree
Showing 36 changed files with 2,534 additions and 1,584 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@ 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)
=============================================================
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 @@ -282,7 +298,7 @@ const config = {
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 detailes on enhancements and fixes introduced by that version.
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.
Expand Down Expand Up @@ -317,7 +333,7 @@ Based on Realm JS v10.8.0: See changelog below for detailes on enhancements and
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 detailes on enhancements and fixes introduced by that version.
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).
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"
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def buildWindows(nodeVersion, arch) {

def buildiOS() {
return buildMacOS {
sh 'npm ci'
sh './scripts/build-iOS.sh -c Release'
dir('react-native/ios') {
// Uncomment this when testing build changes if you want to be able to download pre-built artifacts from Jenkins.
Expand Down
2 changes: 1 addition & 1 deletion RealmJS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Pod::Spec.new do |s|
'HEADER_SEARCH_PATHS' => [
'"$(PODS_TARGET_SRCROOT)/react-native/ios/RealmReact/"',
'"$(PODS_TARGET_SRCROOT)/src/"',
'"$(PODS_TARGET_SRCROOT)/src/hermes/"',
'"$(PODS_TARGET_SRCROOT)/src/jsi/"',
'"$(PODS_ROOT)/Headers/Public/React-Core/"'
#"'#{app_path}/ios/Pods/Headers/Public/React-Core'" # Use this line instead of 👆 while linting
].join(' ')
Expand Down
2 changes: 1 addition & 1 deletion dependencies.list
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME=realm-js
VERSION=10.20.0-alpha.1
VERSION=10.20.0-alpha.2
REALM_CORE_VERSION=11.12.0
NAPI_VERSION=4
OPENSSL_VERSION=1.1.1g
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
375107B1CEC322A5F727A381 /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2A032A4CADCC321F5F8C8B /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
F7BEFC8033C76CBEC124044B /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA2A032A4CADCC321F5F8C8B /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -52,7 +52,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F7BEFC8033C76CBEC124044B /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a in Frameworks */,
375107B1CEC322A5F727A381 /* libPods-RealmReactNativeTests-RealmReactNativeTestsTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "realm",
"description": "Realm is a mobile database: an alternative to SQLite and key-value stores",
"version": "10.20.0-alpha.1",
"version": "10.20.0-alpha.2",
"license": "See the actual license in the file LICENSE",
"homepage": "https://realm.io",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,21 @@ public RealmReactModule(ReactApplicationContext reactContext) {
setDefaultRealmFileDirectory(fileDir, assetManager);

// Get the javascript runtime and install our native module with it

// TODO: Update this to use reactContext.getRuntimeExecutor() instead (since this is calling a deprecated method underneath)
// Using the RuntimeExecutor however, requires that we link our native module against fbjni.

JavaScriptContextHolder jsContext = reactContext.getJavaScriptContextHolder();
synchronized(jsContext) {
install(jsContext.get());
}
}

@Override
public void invalidate() {
invalidateCaches();
}

@Override
public String getName() {
return NAME;
Expand All @@ -89,4 +98,6 @@ public Map<String, Object> getConstants() {
private native void setDefaultRealmFileDirectory(String fileDir, AssetManager assets);

private native void install(long runtimePointer);

private native void invalidateCaches();
}
6 changes: 3 additions & 3 deletions react-native/ios/RealmReact/RealmReact.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#import "RealmReact.h"

#import <realm-js-ios/hermes_init.h>
#import <realm-js-ios/jsi_init.h>

#import <React/RCTBridge+Private.h>
#import <jsi/jsi.h>
Expand Down Expand Up @@ -91,7 +91,7 @@ - (void)removeListenerForEvent:(NSString *)eventName handler:(RealmReactEventHan
}

- (void)invalidate {
realm_hermes_invalidate_caches();
realm_jsi_invalidate_caches();
}

- (void)dealloc {
Expand Down Expand Up @@ -127,7 +127,7 @@ - (void)setBridge:(RCTBridge *)bridge {

auto& rt = *static_cast<facebook::jsi::Runtime*>(bridge.runtime);
auto exports = jsi::Object(rt);
realm_hermes_init(rt, exports);
realm_jsi_init(rt, exports);
} queue:RCTJSThread];
}
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fi
DESTINATIONS=()
LIBRARIES=()
BUILD_LIB_CMDS=()

for platform in "${PLATFORMS[@]}"; do
case "$platform" in
ios)
Expand Down Expand Up @@ -107,7 +108,7 @@ done

rm -rf _include
mkdir -p _include/realm-js-ios
cp "$PROJECT_ROOT"/src/hermes/hermes_init.h _include/realm-js-ios/
cp "$PROJECT_ROOT"/src/jsi/jsi_init.h _include/realm-js-ios/

rm -rf ../realm-js-ios.xcframework
xcodebuild -create-xcframework \
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ target_include_directories(realm-js-shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(DEFINED CMAKE_JS_VERSION)
add_subdirectory(node)
elseif(ANDROID)
add_subdirectory(hermes)
add_subdirectory(jsi)
add_subdirectory(android)
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
add_subdirectory(hermes)
add_subdirectory(jsi)
add_subdirectory(ios)
endif()
11 changes: 8 additions & 3 deletions src/android/io_realm_react_RealmReactModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <android/asset_manager_jni.h>
#include <jsi/jsi.h>

#include <hermes/hermes_init.h>
#include <jsi/jsi_init.h>
#include "platform.hpp"
#include "jni_utils.hpp"
#include "hack.hpp"
Expand Down Expand Up @@ -93,7 +93,6 @@ JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_setDefaultRealmFileD
realm::default_realm_file_directory().c_str());
}


JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_install(JNIEnv*, jclass, jlong runtimePointer)
{
__android_log_print(ANDROID_LOG_VERBOSE, "JSRealm", "install");
Expand All @@ -102,6 +101,12 @@ JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_install(JNIEnv*, jcl
__android_log_print(ANDROID_LOG_VERBOSE, "JSRealm", "Building an exports object");
auto exports = jsi::Object(*runtime);
__android_log_print(ANDROID_LOG_VERBOSE, "JSRealm", "Initializing ...");
realm_hermes_init(*runtime, exports);
realm_jsi_init(*runtime, exports);
}
}

JNIEXPORT void JNICALL Java_io_realm_react_RealmReactModule_invalidateCaches(JNIEnv*, jclass)
{
__android_log_print(ANDROID_LOG_VERBOSE, "JSRealm", "invalidateCaches");
realm_jsi_invalidate_caches();
}
8 changes: 8 additions & 0 deletions src/android/io_realm_react_RealmReactModule.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/hermes/CMakeLists.txt → src/jsi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(REACT_NATIVE_ROOT_DIR "${PACKAGE_ROOT_DIR}/node_modules/react-native")
set(JSI_HEADER_DIR "${REACT_NATIVE_ROOT_DIR}/ReactCommon/jsi")

add_library(realm-js-hermes OBJECT
hermes_init.cpp
jsi_init.cpp
)

target_include_directories(realm-js-hermes PRIVATE ${JSI_HEADER_DIR})
Expand Down
Loading

0 comments on commit e7089b9

Please sign in to comment.