From 1c883d10aef914f6bbbacc7a055ad4c2c76af5d1 Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Mon, 19 Oct 2020 15:30:51 -0700 Subject: [PATCH 1/5] Add a dispatch function wrapper that synchronously re-throws the exception through setImmediate so that logbox correctly displays it --- .../src/main/cpp/BabylonNativeInterop.cpp | 25 ++++++------- .../react-native/ios/BabylonNative.cpp | 19 ++++------ .../react-native/ios/BabylonNative.h | 2 +- .../react-native/ios/BabylonNativeInterop.mm | 2 +- .../react-native/shared/DispatchFunction.h | 36 +++++++++++++++++++ 5 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 Modules/@babylonjs/react-native/shared/DispatchFunction.h diff --git a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp index fe3027277..fb0262931 100644 --- a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp +++ b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp @@ -22,6 +22,10 @@ #include #include +#include "../../../../shared/DispatchFunction.h" + +using namespace facebook; + namespace Babylon { namespace @@ -36,19 +40,10 @@ namespace Babylon { public: // This class must be constructed from the JavaScript thread - Native(facebook::jsi::Runtime* jsiRuntime, std::shared_ptr callInvoker, ANativeWindow* windowPtr) - : m_env{ Napi::Attach(*jsiRuntime) } + Native(jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker, ANativeWindow* windowPtr) + : m_env{ Napi::Attach(jsiRuntime) } { - JsRuntime::DispatchFunctionT dispatchFunction = - [env = m_env, callInvoker](std::function func) - { - callInvoker->invokeAsync([env, func = std::move(func)] - { - func(env); - }); - }; - - m_runtime = &JsRuntime::CreateForJavaScript(m_env, dispatchFunction); + m_runtime = &JsRuntime::CreateForJavaScript(m_env, CreateJsRuntimeDispatcher(m_env, jsiRuntime, callInvoker)); auto width = static_cast(ANativeWindow_getWidth(windowPtr)); auto height = static_cast(ANativeWindow_getHeight(windowPtr)); @@ -135,10 +130,10 @@ extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_res extern "C" JNIEXPORT jlong JNICALL Java_com_reactlibrary_BabylonNativeInterop_create(JNIEnv* env, jclass obj, jlong jsiRuntimeRef, jobject jsCallInvokerHolder, jobject surface) { - auto jsiRuntime = reinterpret_cast(jsiRuntimeRef); - auto callInvoker = facebook::jni::alias_ref {reinterpret_cast(jsCallInvokerHolder)}->cthis()->getCallInvoker(); + auto jsiRuntime = reinterpret_cast(jsiRuntimeRef); + auto callInvoker = jni::alias_ref {reinterpret_cast(jsCallInvokerHolder)}->cthis()->getCallInvoker(); ANativeWindow* windowPtr = ANativeWindow_fromSurface(env, surface); - auto native = new Babylon::Native(jsiRuntime, callInvoker, windowPtr); + auto native = new Babylon::Native(*jsiRuntime, callInvoker, windowPtr); return reinterpret_cast(native); } diff --git a/Modules/@babylonjs/react-native/ios/BabylonNative.cpp b/Modules/@babylonjs/react-native/ios/BabylonNative.cpp index 7c215d190..eb41f29b9 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/ios/BabylonNative.cpp @@ -19,6 +19,8 @@ #include #include +#include "../shared/DispatchFunction.h" + namespace Babylon { using namespace facebook; @@ -26,8 +28,8 @@ namespace Babylon class Native::Impl { public: - Impl(facebook::jsi::Runtime* jsiRuntime, std::shared_ptr callInvoker) - : env{ Napi::Attach(*jsiRuntime) } + Impl(facebook::jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker) + : env{ Napi::Attach(jsiRuntime) } , jsCallInvoker{ callInvoker } { } @@ -39,23 +41,14 @@ namespace Babylon Plugins::NativeInput* nativeInput{}; }; - Native::Native(facebook::jsi::Runtime* jsiRuntime, std::shared_ptr callInvoker, void* windowPtr, size_t width, size_t height) + Native::Native(facebook::jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker, void* windowPtr, size_t width, size_t height) : m_impl{ std::make_unique(jsiRuntime, callInvoker) } { dispatch_sync(dispatch_get_main_queue(), ^{ m_impl->m_graphics = Graphics::InitializeFromWindow(windowPtr, width, height); }); - JsRuntime::DispatchFunctionT dispatchFunction = - [env = m_impl->env, callInvoker = m_impl->jsCallInvoker](std::function func) - { - callInvoker->invokeAsync([env, func = std::move(func)] - { - func(env); - }); - }; - - m_impl->runtime = &JsRuntime::CreateForJavaScript(m_impl->env, std::move(dispatchFunction)); + m_impl->runtime = &JsRuntime::CreateForJavaScript(m_impl->env, CreateJsRuntimeDispatcher(m_impl->env, jsiRuntime, callInvoker)); m_impl->m_graphics->AddToJavaScript(m_impl->env); diff --git a/Modules/@babylonjs/react-native/ios/BabylonNative.h b/Modules/@babylonjs/react-native/ios/BabylonNative.h index 5b780e53d..f021f7246 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNative.h +++ b/Modules/@babylonjs/react-native/ios/BabylonNative.h @@ -9,7 +9,7 @@ namespace Babylon { public: // This class must be constructed from the JavaScript thread - Native(facebook::jsi::Runtime* jsiRuntime, std::shared_ptr callInvoker, void* windowPtr, size_t width, size_t height); + Native(facebook::jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker, void* windowPtr, size_t width, size_t height); ~Native(); void Refresh(void* windowPtr, size_t width, size_t height); void Resize(size_t width, size_t height); diff --git a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm index cd9338d2b..9bab58cc9 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm +++ b/Modules/@babylonjs/react-native/ios/BabylonNativeInterop.mm @@ -132,7 +132,7 @@ + (void)setCurrentNativeInstance:(RCTBridge*)bridge mtkView:(MTKView*)mtkView wi jsi::Runtime* jsiRuntime = GetJSIRuntime(currentBridge); if (jsiRuntime) { - currentNativeInstance = std::make_unique(GetJSIRuntime(currentBridge), currentBridge.jsCallInvoker, (__bridge void*)mtkView, width, height); + currentNativeInstance = std::make_unique(*jsiRuntime, currentBridge.jsCallInvoker, (__bridge void*)mtkView, width, height); } } diff --git a/Modules/@babylonjs/react-native/shared/DispatchFunction.h b/Modules/@babylonjs/react-native/shared/DispatchFunction.h new file mode 100644 index 000000000..f623a4370 --- /dev/null +++ b/Modules/@babylonjs/react-native/shared/DispatchFunction.h @@ -0,0 +1,36 @@ +#pragma once + +#include + +#include +#include + +namespace Babylon +{ + using namespace facebook; + + inline JsRuntime::DispatchFunctionT CreateJsRuntimeDispatcher(Napi::Env env, jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker) + { + return [env, &jsiRuntime, callInvoker](std::function func) + { + callInvoker->invokeAsync([env, &jsiRuntime, func{std::move(func)}] + { + try + { + func(env); + } + catch (...) + { + auto ex{std::current_exception()}; + auto setImmediate{jsiRuntime.global().getPropertyAsFunction(jsiRuntime, "setImmediate")}; + auto throwFunc{jsi::Function::createFromHostFunction(jsiRuntime, jsi::PropNameID::forAscii(jsiRuntime, "throwFunc"), 0, + [ex](jsi::Runtime &, const jsi::Value &, const jsi::Value *, size_t) -> jsi::Value + { + std::rethrow_exception(ex); + })}; + setImmediate.call(jsiRuntime, {std::move(throwFunc)}); + } + }); + }; + } +} \ No newline at end of file From b54a64608af337814d5990b8f349456f03478f3e Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Mon, 19 Oct 2020 16:00:52 -0700 Subject: [PATCH 2/5] Add CMakeLists.txt for BabylonReactNativeShared --- Modules/@babylonjs/react-native/android/CMakeLists.txt | 4 ++++ .../android/src/main/cpp/BabylonNativeInterop.cpp | 2 +- Modules/@babylonjs/react-native/ios/BabylonNative.cpp | 2 +- Modules/@babylonjs/react-native/ios/CMakeLists.txt | 4 ++++ Modules/@babylonjs/react-native/shared/CMakeLists.txt | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 Modules/@babylonjs/react-native/shared/CMakeLists.txt diff --git a/Modules/@babylonjs/react-native/android/CMakeLists.txt b/Modules/@babylonjs/react-native/android/CMakeLists.txt index 70a095817..b504f072a 100644 --- a/Modules/@babylonjs/react-native/android/CMakeLists.txt +++ b/Modules/@babylonjs/react-native/android/CMakeLists.txt @@ -34,6 +34,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/src/") set(BABYLON_NATIVE_DIR "${CMAKE_CURRENT_LIST_DIR}/../submodules/BabylonNative") add_subdirectory(${BABYLON_NATIVE_DIR} ${BABYLON_NATIVE_DIR}/build/Android_${CMAKE_ANDROID_ARCH_ABI}/) +set(BABYLON_REACT_NATIVE_SHARED_DIR "${CMAKE_CURRENT_LIST_DIR}/../shared") +add_subdirectory(${BABYLON_REACT_NATIVE_SHARED_DIR} ${CMAKE_CURRENT_BINARY_DIR}/shared) + add_library(fbjni SHARED IMPORTED) set_target_properties(fbjni PROPERTIES IMPORTED_LOCATION ${FBJNI_LIBPATH}/${ANDROID_ABI}/libfbjni.so @@ -63,6 +66,7 @@ target_link_libraries(BabylonNative fbjni jsi turbomodulejsijni + BabylonReactNativeShared AndroidExtensions Graphics JsRuntime diff --git a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp index fb0262931..69e86db30 100644 --- a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp +++ b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp @@ -22,7 +22,7 @@ #include #include -#include "../../../../shared/DispatchFunction.h" +#include using namespace facebook; diff --git a/Modules/@babylonjs/react-native/ios/BabylonNative.cpp b/Modules/@babylonjs/react-native/ios/BabylonNative.cpp index eb41f29b9..4bae09ee8 100644 --- a/Modules/@babylonjs/react-native/ios/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/ios/BabylonNative.cpp @@ -19,7 +19,7 @@ #include #include -#include "../shared/DispatchFunction.h" +#include namespace Babylon { diff --git a/Modules/@babylonjs/react-native/ios/CMakeLists.txt b/Modules/@babylonjs/react-native/ios/CMakeLists.txt index ceec905dd..2fe30f790 100644 --- a/Modules/@babylonjs/react-native/ios/CMakeLists.txt +++ b/Modules/@babylonjs/react-native/ios/CMakeLists.txt @@ -23,6 +23,9 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/") set(BABYLON_NATIVE_DIR "${CMAKE_CURRENT_LIST_DIR}/../submodules/BabylonNative") add_subdirectory(${BABYLON_NATIVE_DIR} ${BABYLON_NATIVE_DIR}/build/ios/) +set(BABYLON_REACT_NATIVE_SHARED_DIR "${CMAKE_CURRENT_LIST_DIR}/../shared") +add_subdirectory(${BABYLON_REACT_NATIVE_SHARED_DIR} ${CMAKE_CURRENT_BINARY_DIR}/shared) + add_library(BabylonNative ${CMAKE_CURRENT_LIST_DIR}/BabylonNative.h ${CMAKE_CURRENT_LIST_DIR}/BabylonNative.cpp) @@ -38,6 +41,7 @@ target_link_libraries(BabylonNative Graphics jsi reactnative + BabylonReactNativeShared JsRuntime NativeWindow NativeEngine diff --git a/Modules/@babylonjs/react-native/shared/CMakeLists.txt b/Modules/@babylonjs/react-native/shared/CMakeLists.txt new file mode 100644 index 000000000..ea2151292 --- /dev/null +++ b/Modules/@babylonjs/react-native/shared/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(BabylonReactNativeShared INTERFACE) +target_include_directories(BabylonReactNativeShared INTERFACE ".") \ No newline at end of file From e1483e17ccfe4a9a9f30227a9d38c9b491fe0b7b Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Mon, 19 Oct 2020 16:08:56 -0700 Subject: [PATCH 3/5] Add an explanation for the dispatcher function --- .../@babylonjs/react-native/shared/DispatchFunction.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Modules/@babylonjs/react-native/shared/DispatchFunction.h b/Modules/@babylonjs/react-native/shared/DispatchFunction.h index f623a4370..b010e03bb 100644 --- a/Modules/@babylonjs/react-native/shared/DispatchFunction.h +++ b/Modules/@babylonjs/react-native/shared/DispatchFunction.h @@ -9,10 +9,20 @@ namespace Babylon { using namespace facebook; + // Creates a JsRuntime::DispatchFunctionT that integrates with the React Native execution environment. inline JsRuntime::DispatchFunctionT CreateJsRuntimeDispatcher(Napi::Env env, jsi::Runtime& jsiRuntime, std::shared_ptr callInvoker) { return [env, &jsiRuntime, callInvoker](std::function func) { + // Ideally we would just use CallInvoker::invokeAsync directly, but currently it does not seem to integrate well with the React Native logbox. + // To work around this, we wrap all functions in a try/catch, and when there is an exception, we do the following: + // 1. Call the JavaScript setImmediate function. + // 2. Have the setImmediate callback call back into native code (throwFunc). + // 3. Re-throw the exception from throwFunc. + // This works because: + // 1. setImmediate queues the callback, and that queue is drained immediately following the invocation of the function passed to CallInvoker::invokeAsync. + // 2. The immediates queue is drained as part of the class bridge, which knows how to display the logbox for unhandled exceptions. + // In the future, CallInvoker::invokeAsync likely will properly integrate with logbox, at which point we can remove the try/catch and just call func directly. callInvoker->invokeAsync([env, &jsiRuntime, func{std::move(func)}] { try From e562b29da992a4e29428e43884bea001475ecb4f Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Mon, 19 Oct 2020 16:43:28 -0700 Subject: [PATCH 4/5] Update names (but not directories) to babylonreactnative --- .../react-native/android/build.gradle | 2 +- .../android/src/main/AndroidManifest.xml | 2 +- .../src/main/cpp/BabylonNativeInterop.cpp | 18 +++++++++--------- .../java/com/reactlibrary/BabylonModule.java | 2 +- .../com/reactlibrary/BabylonNativeInterop.java | 2 +- .../java/com/reactlibrary/BabylonPackage.java | 2 +- .../main/java/com/reactlibrary/EngineView.java | 2 +- .../com/reactlibrary/EngineViewManager.java | 2 +- .../SnapshotDataReturnedEvent.java | 2 +- Package/Android/build.gradle | 2 +- Package/gulpfile.js | 14 +++++++------- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Modules/@babylonjs/react-native/android/build.gradle b/Modules/@babylonjs/react-native/android/build.gradle index 15b7cb23e..9c5657794 100644 --- a/Modules/@babylonjs/react-native/android/build.gradle +++ b/Modules/@babylonjs/react-native/android/build.gradle @@ -125,7 +125,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "com.reactlibrary" + group = "com.babylonreactnative" description packageJson.description url packageJson.repository.baseUrl diff --git a/Modules/@babylonjs/react-native/android/src/main/AndroidManifest.xml b/Modules/@babylonjs/react-native/android/src/main/AndroidManifest.xml index 20c90c41e..a98668555 100644 --- a/Modules/@babylonjs/react-native/android/src/main/AndroidManifest.xml +++ b/Modules/@babylonjs/react-native/android/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ + package="com.babylonreactnative"> diff --git a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp index 69e86db30..6f30571d7 100644 --- a/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp +++ b/Modules/@babylonjs/react-native/android/src/main/cpp/BabylonNativeInterop.cpp @@ -102,7 +102,7 @@ namespace Babylon }; } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_initialize(JNIEnv* env, jclass obj, jobject context) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_initialize(JNIEnv* env, jclass obj, jobject context) { JavaVM* javaVM{}; if (env->GetJavaVM(&javaVM) != JNI_OK) @@ -113,22 +113,22 @@ extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_ini android::global::Initialize(javaVM, context); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setCurrentActivity(JNIEnv* env, jclass obj, jobject activity) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setCurrentActivity(JNIEnv* env, jclass obj, jobject activity) { android::global::SetCurrentActivity(activity); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_pause(JNIEnv* env, jclass obj) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_pause(JNIEnv* env, jclass obj) { android::global::Pause(); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_resume(JNIEnv* env, jclass obj) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_resume(JNIEnv* env, jclass obj) { android::global::Resume(); } -extern "C" JNIEXPORT jlong JNICALL Java_com_reactlibrary_BabylonNativeInterop_create(JNIEnv* env, jclass obj, jlong jsiRuntimeRef, jobject jsCallInvokerHolder, jobject surface) +extern "C" JNIEXPORT jlong JNICALL Java_com_babylonreactnative_BabylonNativeInterop_create(JNIEnv* env, jclass obj, jlong jsiRuntimeRef, jobject jsCallInvokerHolder, jobject surface) { auto jsiRuntime = reinterpret_cast(jsiRuntimeRef); auto callInvoker = jni::alias_ref {reinterpret_cast(jsCallInvokerHolder)}->cthis()->getCallInvoker(); @@ -137,26 +137,26 @@ extern "C" JNIEXPORT jlong JNICALL Java_com_reactlibrary_BabylonNativeInterop_cr return reinterpret_cast(native); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_refresh(JNIEnv* env, jclass obj, jlong instanceRef, jobject surface) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_refresh(JNIEnv* env, jclass obj, jlong instanceRef, jobject surface) { auto native = reinterpret_cast(instanceRef); ANativeWindow* windowPtr = ANativeWindow_fromSurface(env, surface); native->Refresh(windowPtr); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setPointerButtonState(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setPointerButtonState(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y) { auto native = reinterpret_cast(instanceRef); native->SetPointerButtonState(static_cast(pointerId), static_cast(buttonId), isDown, static_cast(x), static_cast(y)); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setPointerPosition(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint x, jint y) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setPointerPosition(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint x, jint y) { auto native = reinterpret_cast(instanceRef); native->SetPointerPosition(static_cast(pointerId), static_cast(x), static_cast(y)); } -extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_destroy(JNIEnv* env, jclass obj, jlong instanceRef) +extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_destroy(JNIEnv* env, jclass obj, jlong instanceRef) { auto native = reinterpret_cast(instanceRef); delete native; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java index 0ea4bdd79..466e675e0 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import android.os.Handler; import android.os.Looper; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java index 5b65c4858..3b6a7c40d 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import android.app.Activity; import android.content.Context; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java index 63e8885ce..d5d533949 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import java.util.Arrays; import java.util.List; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java index a73e5ef61..d3bccab57 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import android.annotation.TargetApi; import android.graphics.Bitmap; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java index c6add1ade..1bfcdbcdd 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java index 328727d2b..77a9d4088 100644 --- a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java +++ b/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java @@ -1,4 +1,4 @@ -package com.reactlibrary; +package com.babylonreactnative; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/Package/Android/build.gradle b/Package/Android/build.gradle index d40988343..3c0efffdd 100644 --- a/Package/Android/build.gradle +++ b/Package/Android/build.gradle @@ -87,7 +87,7 @@ def configureReactNativePom(def pom) { name packageJson.title artifactId packageJson.name version = packageJson.version - group = "com.reactlibrary" + group = "com.babylonreactnative" description packageJson.description url packageJson.repository.baseUrl diff --git a/Package/gulpfile.js b/Package/gulpfile.js index 5be9d32d3..47325dadc 100644 --- a/Package/gulpfile.js +++ b/Package/gulpfile.js @@ -134,13 +134,13 @@ Assembled/android/src/main Assembled/android/src/main/AndroidManifest.xml Assembled/android/src/main/java Assembled/android/src/main/java/com -Assembled/android/src/main/java/com/reactlibrary -Assembled/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java -Assembled/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java -Assembled/android/src/main/java/com/reactlibrary/BabylonModule.java -Assembled/android/src/main/java/com/reactlibrary/BabylonPackage.java -Assembled/android/src/main/java/com/reactlibrary/EngineViewManager.java -Assembled/android/src/main/java/com/reactlibrary/EngineView.java +Assembled/android/src/main/java/com/babylonreactnative +Assembled/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java +Assembled/android/src/main/java/com/babylonreactnative/SnapshotDataReturnedEvent.java +Assembled/android/src/main/java/com/babylonreactnative/BabylonModule.java +Assembled/android/src/main/java/com/babylonreactnative/BabylonPackage.java +Assembled/android/src/main/java/com/babylonreactnative/EngineViewManager.java +Assembled/android/src/main/java/com/babylonreactnative/EngineView.java Assembled/android/src/main/jniLibs Assembled/android/src/main/jniLibs/armeabi-v7a Assembled/android/src/main/jniLibs/armeabi-v7a/libturbomodulejsijni.so From acd1c247ae3283f95317b26aa85d649228c54458 Mon Sep 17 00:00:00 2001 From: Ryan Tremblay Date: Mon, 19 Oct 2020 16:51:14 -0700 Subject: [PATCH 5/5] Rename directory from reactlibrary to babylonreactnative --- .../com/{reactlibrary => babylonreactnative}/BabylonModule.java | 0 .../BabylonNativeInterop.java | 0 .../com/{reactlibrary => babylonreactnative}/BabylonPackage.java | 0 .../java/com/{reactlibrary => babylonreactnative}/EngineView.java | 0 .../{reactlibrary => babylonreactnative}/EngineViewManager.java | 0 .../SnapshotDataReturnedEvent.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/BabylonModule.java (100%) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/BabylonNativeInterop.java (100%) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/BabylonPackage.java (100%) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/EngineView.java (100%) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/EngineViewManager.java (100%) rename Modules/@babylonjs/react-native/android/src/main/java/com/{reactlibrary => babylonreactnative}/SnapshotDataReturnedEvent.java (100%) diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonModule.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonModule.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonModule.java diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonPackage.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/BabylonPackage.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/BabylonPackage.java diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/EngineView.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineView.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/EngineView.java diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/EngineViewManager.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/EngineViewManager.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/EngineViewManager.java diff --git a/Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java b/Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/SnapshotDataReturnedEvent.java similarity index 100% rename from Modules/@babylonjs/react-native/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java rename to Modules/@babylonjs/react-native/android/src/main/java/com/babylonreactnative/SnapshotDataReturnedEvent.java