diff --git a/packages/expo-modules-core/android/CMakeLists.txt b/packages/expo-modules-core/android/CMakeLists.txt index d710ce4f8f..3562c513b3 100644 --- a/packages/expo-modules-core/android/CMakeLists.txt +++ b/packages/expo-modules-core/android/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.4.1) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_ANDROID_STL_TYPE c++_shared) set(CMAKE_CXX_STANDARD 17) -set(PACKAGE_NAME "expo-modules-core") +set(PACKAGE_NAME "expo-modules-core_{VERSIONED_ABI_NAME}") set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) if (${NATIVE_DEBUG}) @@ -61,14 +61,14 @@ find_library(LOG_LIB log) if(${REACT_NATIVE_TARGET_VERSION} LESS 69) find_library( FOLLY_LIB - folly_json + folly_json_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) else() find_library( FOLLY_LIB - folly_runtime + folly_runtime_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) @@ -83,35 +83,35 @@ find_library( find_library( JSI_LIB - jsi + jsi_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) find_library( REACT_NATIVE_JNI_LIB - reactnativejni + reactnativejni_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) find_library( REACT_NATIVE_MODULES_CORE - react_nativemodule_core + react_nativemodule_core_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) find_library( HERMES_LIB - hermes + hermes_{VERSIONED_ABI_NAME} PATHS ${HERMES_SO_DIR} NO_CMAKE_FIND_ROOT_PATH ) find_library( JSEXECUTOR_LIB - jscexecutor + jscexecutor_{VERSIONED_ABI_NAME} PATHS ${LIBRN_DIR} NO_CMAKE_FIND_ROOT_PATH ) diff --git a/packages/expo-modules-core/android/build.gradle b/packages/expo-modules-core/android/build.gradle index 37f9d48029..2ed8dc1e09 100644 --- a/packages/expo-modules-core/android/build.gradle +++ b/packages/expo-modules-core/android/build.gradle @@ -55,6 +55,10 @@ def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE def REACT_NATIVE_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE ? Paths.get(findProject(":ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni") : "${buildDir}/react-native-0*/jni" +REACT_NATIVE_DIR = "${rootDir}/versioned-react-native" +REACT_NATIVE_BUILD_FROM_SOURCE = false +REACT_NATIVE_SO_DIR = "${buildDir}/reactandroid-{VERSIONED_ABI_NAME}-*/jni" +def REACT_NATIVE_AAR_DIR = "${rootDir}/versioned-abis/expoview-{VERSIONED_ABI_NAME}/maven" def reactProperties = new Properties() file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } @@ -270,7 +274,7 @@ task createNativeDepsDirectories() { // JNI def extractReactNativeAAR = { buildType -> def suffix = buildType == 'Debug' ? '-debug' : '-release' - def rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*${suffix}.aar" } + def rnAARs = fileTree(REACT_NATIVE_AAR_DIR).matching { include "**/*.aar" } if (rnAARs.isEmpty()) { rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*.aar" } } diff --git a/packages/expo-modules-core/android/src/main/cpp/Exceptions.h b/packages/expo-modules-core/android/src/main/cpp/Exceptions.h index 3565306601..984166f10f 100644 --- a/packages/expo-modules-core/android/src/main/cpp/Exceptions.h +++ b/packages/expo-modules-core/android/src/main/cpp/Exceptions.h @@ -17,7 +17,7 @@ namespace expo { */ class CodedException : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/exception/CodedException;"; + static auto constexpr kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/exception/CodedException;"; static jni::local_ref create(const std::string &message); }; @@ -28,7 +28,7 @@ public: class JavaScriptEvaluateException : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/exception/JavaScriptEvaluateException;"; + static auto constexpr kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/exception/JavaScriptEvaluateException;"; static jni::local_ref create( const std::string &message, diff --git a/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp b/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp index ae14c3396a..c2fe1fce5f 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp +++ b/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp @@ -13,7 +13,7 @@ JNIFunctionBody::invoke(jni::local_ref> &&args) { // Because of that, it can't be cached - we will try to invoke the nonexistent method // if we receive an object of a different class than the one used to obtain the method id. // The only cacheable method id can be obtain from the base class. - static const auto method = jni::findClassLocal("expo/modules/kotlin/jni/JNIFunctionBody") + static const auto method = jni::findClassLocal("{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JNIFunctionBody") ->getMethod< react::ReadableNativeArray::javaobject(jni::local_ref>) >( @@ -32,7 +32,7 @@ void JNIAsyncFunctionBody::invoke( // Because of that, it can't be cached - we will try to invoke the nonexistent method // if we receive an object of a different class than the one used to obtain the method id. // The only cacheable method id can be obtain from the base class. - static const auto method = jni::findClassLocal("expo/modules/kotlin/jni/JNIAsyncFunctionBody") + static const auto method = jni::findClassLocal("{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JNIAsyncFunctionBody") ->getMethod< void(jni::local_ref>, jobject) >( diff --git a/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.h b/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.h index 4d86132af1..b96eeb3303 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.h +++ b/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.h @@ -15,7 +15,7 @@ namespace expo { */ class JNIFunctionBody : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/jni/JNIFunctionBody;"; + static auto constexpr kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JNIFunctionBody;"; /** * Invokes a Kotlin's implementation of this function. @@ -34,7 +34,7 @@ public: */ class JNIAsyncFunctionBody : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/jni/JNIAsyncFunctionBody;"; + static auto constexpr kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JNIAsyncFunctionBody;"; /** * Invokes a Kotlin's implementation of this async function. diff --git a/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h b/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h index 32fbabd146..f94b37ee16 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h +++ b/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h @@ -25,7 +25,7 @@ namespace expo { class JSIInteropModuleRegistry : public jni::HybridClass { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/JSIInteropModuleRegistry;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JSIInteropModuleRegistry;"; static auto constexpr TAG = "JSIInteropModuleRegistry"; static jni::local_ref initHybrid(jni::alias_ref jThis); diff --git a/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h b/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h index 994df84423..c22a1ec267 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h @@ -28,7 +28,7 @@ class JSIInteropModuleRegistry; class JavaScriptModuleObject : public jni::HybridClass { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/JavaScriptModuleObject;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JavaScriptModuleObject;"; static auto constexpr TAG = "JavaScriptModuleObject"; static jni::local_ref initHybrid(jni::alias_ref jThis); diff --git a/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h b/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h index 1a4bd3fdb2..6ccc28b07d 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h @@ -25,7 +25,7 @@ class JavaScriptRuntime; class JavaScriptObject : public jni::HybridClass, JSIObjectWrapper { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/JavaScriptObject;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JavaScriptObject;"; static auto constexpr TAG = "JavaScriptObject"; static void registerNatives(); diff --git a/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h b/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h index 1f016714bc..3fe3c32737 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h @@ -23,7 +23,7 @@ class JavaScriptObject; class JavaScriptValue : public jni::HybridClass, JSIValueWrapper { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/JavaScriptValue;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JavaScriptValue;"; static auto constexpr TAG = "JavaScriptValue"; static void registerNatives();