Skip to content

Commit

Permalink
Rename namespaces in the JSI codebase to reflect that it doesn't just…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
FFranck authored and kraenhansen committed Nov 25, 2021
1 parent 2ce0394 commit d0a66fd
Show file tree
Hide file tree
Showing 19 changed files with 421 additions and 446 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NOTE: This is an early (alpha) release with Hermes/JSI support: We expect crashe
* 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
* None.
* Restructured C++ namespaces and files to reflect that we support JSI, not just Hermes.

10.20.0-alpha.1 Release notes (2021-9-22)
=============================================================
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
6 changes: 3 additions & 3 deletions react-native/ios/RealmReact/RealmReact.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#import "RealmReact.h"
#import "RealmAnalytics.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 @@ -94,7 +94,7 @@ - (void)removeListenerForEvent:(NSString *)eventName handler:(RealmReactEventHan
}

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

- (void)dealloc {
Expand Down Expand Up @@ -130,7 +130,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
2 changes: 1 addition & 1 deletion scripts/build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,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()
6 changes: 3 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 @@ -101,12 +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_hermes_invalidate_caches();
realm_jsi_invalidate_caches();
}
172 changes: 0 additions & 172 deletions src/hermes/hermes_return_value.hpp

This file was deleted.

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 d0a66fd

Please sign in to comment.