diff --git a/packages/expo-modules-core/android/CMakeLists.txt b/packages/expo-modules-core/android/CMakeLists.txt index 7e69193064..64cd01f802 100644 --- a/packages/expo-modules-core/android/CMakeLists.txt +++ b/packages/expo-modules-core/android/CMakeLists.txt @@ -5,7 +5,7 @@ project(expo-modules-core) 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) set(ignoreMe "${PROJECT_BUILD_DIR} ${REACT_ANDROID_BUILD_DIR} ${REACT_ANDROID_DIR}") @@ -92,14 +92,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 ) @@ -114,35 +114,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 194f8ac980..8ceda7036e 100644 --- a/packages/expo-modules-core/android/build.gradle +++ b/packages/expo-modules-core/android/build.gradle @@ -59,6 +59,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) } @@ -326,7 +330,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/fabric/FabricComponentsRegistry.h b/packages/expo-modules-core/android/src/fabric/FabricComponentsRegistry.h index aaee960b00..53bbbe02b6 100644 --- a/packages/expo-modules-core/android/src/fabric/FabricComponentsRegistry.h +++ b/packages/expo-modules-core/android/src/fabric/FabricComponentsRegistry.h @@ -9,7 +9,7 @@ namespace expo { class FabricComponentsRegistry : public facebook::jni::HybridClass { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/adapters/react/FabricComponentsRegistry;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/adapters/react/FabricComponentsRegistry;"; static void registerNatives(); 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 607ed5c2b9..97684053ea 100644 --- a/packages/expo-modules-core/android/src/main/cpp/Exceptions.h +++ b/packages/expo-modules-core/android/src/main/cpp/Exceptions.h @@ -24,7 +24,7 @@ class JSIInteropModuleRegistry; */ 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); @@ -39,7 +39,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, @@ -53,7 +53,7 @@ public: class UnexpectedException : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/exception/UnexpectedException;"; + static auto constexpr kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/exception/UnexpectedException;"; 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 53629da616..2ea542bb2d 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp +++ b/packages/expo-modules-core/android/src/main/cpp/JNIFunctionBody.cpp @@ -14,10 +14,10 @@ JNIFunctionBody::invoke(jobjectArray 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(jobjectArray)>( "invoke", - "([Ljava/lang/Object;)Lcom/facebook/react/bridge/ReadableNativeArray;" + "([Ljava/lang/Object;)L{VERSIONED_ABI_NAME}/com/facebook/react/bridge/ReadableNativeArray;" ); return method(this->self(), args); @@ -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(jobjectArray , 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 9125e980ee..a5a7b37fbb 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 ebd5c60547..c469341691 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h +++ b/packages/expo-modules-core/android/src/main/cpp/JSIInteropModuleRegistry.h @@ -27,7 +27,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/JavaReferencesCache.cpp b/packages/expo-modules-core/android/src/main/cpp/JavaReferencesCache.cpp index 21ea310271..43db4e425c 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaReferencesCache.cpp +++ b/packages/expo-modules-core/android/src/main/cpp/JavaReferencesCache.cpp @@ -25,8 +25,8 @@ void JavaReferencesCache::loadJClasses(JNIEnv *env) { {"", "(F)V"} }); - loadJClass(env, "com/facebook/react/bridge/PromiseImpl", { - {"", "(Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V"} + loadJClass(env, "{VERSIONED_ABI_NAME}/com/facebook/react/bridge/PromiseImpl", { + {"", "(L{VERSIONED_ABI_NAME}/com/facebook/react/bridge/Callback;L{VERSIONED_ABI_NAME}/com/facebook/react/bridge/Callback;)V"} }); loadJClass(env, "java/lang/Object", {}); 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 4b1a65ecab..49d5a841db 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h @@ -29,7 +29,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 cebef459cb..2a92503c3b 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptObject.h @@ -24,7 +24,7 @@ class JavaScriptValue; 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/JavaScriptTypedArray.h b/packages/expo-modules-core/android/src/main/cpp/JavaScriptTypedArray.h index 099e2f6728..10f8fee8cd 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptTypedArray.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptTypedArray.h @@ -20,7 +20,7 @@ namespace jsi = facebook::jsi; class JavaScriptTypedArray : public jni::HybridClass { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/JavaScriptTypedArray;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/JavaScriptTypedArray;"; static auto constexpr TAG = "JavaScriptTypedArray"; 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 506176ccba..fe9a0df850 100644 --- a/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h +++ b/packages/expo-modules-core/android/src/main/cpp/JavaScriptValue.h @@ -27,7 +27,7 @@ class JavaScriptTypedArray; 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(); diff --git a/packages/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp b/packages/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp index 3478452a60..2fa4354727 100644 --- a/packages/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp +++ b/packages/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp @@ -323,10 +323,10 @@ jsi::Function MethodMetadata::createPromiseBody( JNIEnv *env = jni::Environment::current(); auto &jPromise = JavaReferencesCache::instance()->getJClass( - "com/facebook/react/bridge/PromiseImpl"); + "{VERSIONED_ABI_NAME}/com/facebook/react/bridge/PromiseImpl"); jmethodID jPromiseConstructor = jPromise.getMethod( "", - "(Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V" + "(L{VERSIONED_ABI_NAME}/com/facebook/react/bridge/Callback;L{VERSIONED_ABI_NAME}/com/facebook/react/bridge/Callback;)V" ); // Creates a promise object diff --git a/packages/expo-modules-core/android/src/main/cpp/types/ExpectedType.h b/packages/expo-modules-core/android/src/main/cpp/types/ExpectedType.h index 9a722a051e..93c60369fc 100644 --- a/packages/expo-modules-core/android/src/main/cpp/types/ExpectedType.h +++ b/packages/expo-modules-core/android/src/main/cpp/types/ExpectedType.h @@ -14,7 +14,7 @@ namespace expo { */ class SingleType : public jni::JavaClass { static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/SingleType;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/SingleType;"; }; /** @@ -23,7 +23,7 @@ class SingleType : public jni::JavaClass { class ExpectedType : public jni::JavaClass { public: static auto constexpr - kJavaDescriptor = "Lexpo/modules/kotlin/jni/ExpectedType;"; + kJavaDescriptor = "L{VERSIONED_ABI_NAME}/expo/modules/kotlin/jni/ExpectedType;"; CppType getCombinedTypes(); };