mobile: fix patches

This commit is contained in:
ammarahm-ed
2022-11-23 19:30:47 +05:00
parent 1500d50ba9
commit 95dd84695b
4 changed files with 0 additions and 1835 deletions

View File

@@ -1,833 +0,0 @@
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock b/node_modules/react-native-reanimated/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock
deleted file mode 100644
index fabf460..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/dependencies-accessors/gc.properties b/node_modules/react-native-reanimated/android/.gradle/7.2/dependencies-accessors/gc.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.bin b/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.bin
deleted file mode 100644
index a73e625..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.lock b/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.lock
deleted file mode 100644
index 3c6c4ff..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/executionHistory/executionHistory.lock and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/fileChanges/last-build.bin b/node_modules/react-native-reanimated/android/.gradle/7.2/fileChanges/last-build.bin
deleted file mode 100644
index f76dd23..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/fileChanges/last-build.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.bin b/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.bin
deleted file mode 100644
index 2c5c450..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.lock b/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.lock
deleted file mode 100644
index f611649..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/fileHashes.lock and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/resourceHashesCache.bin b/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/resourceHashesCache.bin
deleted file mode 100644
index be6673f..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/7.2/fileHashes/resourceHashesCache.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/7.2/gc.properties b/node_modules/react-native-reanimated/android/.gradle/7.2/gc.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
deleted file mode 100644
index 17defa6..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/cache.properties b/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/cache.properties
deleted file mode 100644
index 1184471..0000000
--- a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/cache.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-#Fri Jul 01 09:56:56 UTC 2022
-gradle.version=7.2
diff --git a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/outputFiles.bin b/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/outputFiles.bin
deleted file mode 100644
index 2467136..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/checksums/checksums.lock b/node_modules/react-native-reanimated/android/.gradle/checksums/checksums.lock
deleted file mode 100644
index 3c0a9ad..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/checksums/checksums.lock and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/checksums/md5-checksums.bin b/node_modules/react-native-reanimated/android/.gradle/checksums/md5-checksums.bin
deleted file mode 100644
index bbd404e..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/checksums/md5-checksums.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/checksums/sha1-checksums.bin b/node_modules/react-native-reanimated/android/.gradle/checksums/sha1-checksums.bin
deleted file mode 100644
index 89c4caa..0000000
Binary files a/node_modules/react-native-reanimated/android/.gradle/checksums/sha1-checksums.bin and /dev/null differ
diff --git a/node_modules/react-native-reanimated/android/.gradle/vcs-1/gc.properties b/node_modules/react-native-reanimated/android/.gradle/vcs-1/gc.properties
deleted file mode 100644
index e69de29..0000000
diff --git a/node_modules/react-native-reanimated/android/CMakeLists.txt b/node_modules/react-native-reanimated/android/CMakeLists.txt
index 063582c..472019c 100644
--- a/node_modules/react-native-reanimated/android/CMakeLists.txt
+++ b/node_modules/react-native-reanimated/android/CMakeLists.txt
@@ -3,49 +3,47 @@ cmake_minimum_required(VERSION 3.5.1)
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 14)
-set (CMAKE_CXX_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=${FOR_HERMES} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare")
+set (CMAKE_CXX_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare")
-if(${NATIVE_DEBUG})
+if (${NATIVE_DEBUG})
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
-endif()
+endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
-set (PACKAGE_NAME "reanimated")
-set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
-set (SRC_DIR ${CMAKE_SOURCE_DIR}/src)
+set(PACKAGE_NAME "reanimated")
+set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
+set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
-if(${CLIENT_SIDE_BUILD})
- set (NODE_MODULES_DIR "${CMAKE_SOURCE_DIR}/../../")
- set (COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
-else()
- set (NODE_MODULES_DIR "../node_modules")
- set (COMMON_SRC_DIR "${SRC_DIR}/main/Common")
-endif()
+if (${CLIENT_SIDE_BUILD})
+ set(COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
+else ()
+ set(COMMON_SRC_DIR "${SRC_DIR}/main/Common")
+endif ()
-set (RN_SO_DIR ${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/first-party/react/jni)
-set (FBJNI_HEADERS_DIR ${RN_SO_DIR}/../../fbjni/headers)
+set(RN_SO_DIR ${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/first-party/react/jni)
+set(FBJNI_HEADERS_DIR ${RN_SO_DIR}/../../fbjni/headers)
# reanimated shared
-file(GLOB sources_tools "${COMMON_SRC_DIR}/cpp/Tools/*.cpp")
-file(GLOB sources_native_modules "${COMMON_SRC_DIR}/cpp/NativeModules/*.cpp")
-file(GLOB sources_shared_items "${COMMON_SRC_DIR}/cpp/SharedItems/*.cpp")
-file(GLOB sources_registries "${COMMON_SRC_DIR}/cpp/Registries/*.cpp")
-file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
-
-if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
- set (
- INCLUDE_JSI_CPP
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
- )
- set (
- INCLUDE_JSIDYNAMIC_CPP
- "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/JSIDynamic.cpp"
- )
-endif()
+file(GLOB sources_tools "${COMMON_SRC_DIR}/cpp/Tools/*.cpp")
+file(GLOB sources_native_modules "${COMMON_SRC_DIR}/cpp/NativeModules/*.cpp")
+file(GLOB sources_shared_items "${COMMON_SRC_DIR}/cpp/SharedItems/*.cpp")
+file(GLOB sources_registries "${COMMON_SRC_DIR}/cpp/Registries/*.cpp")
+file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
+
+if (${REACT_NATIVE_TARGET_VERSION} LESS 66)
+ set(
+ INCLUDE_JSI_CPP
+ "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
+ )
+ set(
+ INCLUDE_JSIDYNAMIC_CPP
+ "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/JSIDynamic.cpp"
+ )
+endif ()
add_library(
${PACKAGE_NAME}
@@ -69,7 +67,7 @@ add_library(
# includes
-file (GLOB LIBFBJNI_INCLUDE_DIR ${FBJNI_HEADERS_DIR})
+file(GLOB LIBFBJNI_INCLUDE_DIR ${FBJNI_HEADERS_DIR})
target_include_directories(
${PACKAGE_NAME}
@@ -88,7 +86,6 @@ target_include_directories(
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi"
"${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule/core"
"${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule"
- "${NODE_MODULES_DIR}/hermes-engine/android/include/"
"${COMMON_SRC_DIR}/cpp/headers/Tools"
"${COMMON_SRC_DIR}/cpp/headers/SpecTools"
"${COMMON_SRC_DIR}/cpp/headers/NativeModules"
@@ -102,41 +99,12 @@ target_include_directories(
# find libraries
-file (GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
-file (GLOB HERMES_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
+file(GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
find_library(
LOG_LIB
log
)
-find_library(
- HERMES_LIB
- hermes
- PATHS ${HERMES_DIR}
- NO_CMAKE_FIND_ROOT_PATH
-)
-find_library(
- JSEXECUTOR_LIB
- jscexecutor
- PATHS ${LIBRN_DIR}
- NO_CMAKE_FIND_ROOT_PATH
-)
-
-if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
- find_library(
- FOLLY_LIB
- folly_json
- PATHS ${LIBRN_DIR}
- NO_CMAKE_FIND_ROOT_PATH
- )
-else()
- find_library(
- FOLLY_LIB
- folly_runtime
- PATHS ${LIBRN_DIR}
- NO_CMAKE_FIND_ROOT_PATH
- )
-endif()
find_library(
REACT_NATIVE_JNI_LIB
@@ -144,14 +112,12 @@ find_library(
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
-
find_library(
GLOG_LIB
glog
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
-
find_library(
FBJNI_LIB
fbjni
@@ -159,22 +125,53 @@ find_library(
NO_CMAKE_FIND_ROOT_PATH
)
-if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
- set (JSI_LIB "")
-else()
- find_library(
- JSI_LIB
- jsi
- PATHS ${LIBRN_DIR}
- NO_CMAKE_FIND_ROOT_PATH
- )
-endif()
+if (${REACT_NATIVE_TARGET_VERSION} LESS 69)
+ find_library(
+ FOLLY_LIB
+ folly_json
+ PATHS ${LIBRN_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+else ()
+ find_library(
+ FOLLY_LIB
+ folly_runtime
+ PATHS ${LIBRN_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+endif ()
+
+if (${REACT_NATIVE_TARGET_VERSION} LESS 66)
+ set(JSI_LIB "")
+else ()
+ find_library(
+ JSI_LIB
+ jsi
+ PATHS ${LIBRN_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+endif ()
# build shared lib
set_target_properties(${PACKAGE_NAME} PROPERTIES LINKER_LANGUAGE CXX)
-if(${FOR_HERMES})
+
+if (${JS_RUNTIME} STREQUAL "hermes")
+ string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
+ target_include_directories(
+ ${PACKAGE_NAME}
+ PRIVATE
+ "${JS_RUNTIME_DIR}/android/include"
+ )
+ file(GLOB HERMES_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
+ find_library(
+ HERMES_LIB
+ hermes
+ PATHS ${HERMES_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+
target_link_libraries(
${PACKAGE_NAME}
${LOG_LIB}
@@ -186,7 +183,40 @@ if(${FOR_HERMES})
${REACT_NATIVE_JNI_LIB}
android
)
-else()
+elseif (${JS_RUNTIME} STREQUAL "v8")
+ string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_V8=1")
+ target_include_directories(
+ ${PACKAGE_NAME}
+ PRIVATE
+ "${JS_RUNTIME_DIR}/src"
+ )
+ file(GLOB V8_SO_DIR "${JS_RUNTIME_DIR}/android/build/intermediates/library_jni/*/jni/${ANDROID_ABI}")
+ find_library(
+ V8EXECUTOR_LIB
+ v8executor
+ PATHS ${V8_SO_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+ target_link_libraries(
+ ${PACKAGE_NAME}
+ ${LOG_LIB}
+ ${JSI_LIB}
+ ${FOLLY_LIB}
+ ${V8EXECUTOR_LIB}
+ ${GLOG_LIB}
+ ${FBJNI_LIB}
+ ${REACT_NATIVE_JNI_LIB}
+ android
+ )
+else ()
+ set(ignoreMe "${JS_RUNTIME_DIR}")
+ string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
+ find_library(
+ JSEXECUTOR_LIB
+ jscexecutor
+ PATHS ${LIBRN_DIR}
+ NO_CMAKE_FIND_ROOT_PATH
+ )
target_link_libraries(
${PACKAGE_NAME}
${LOG_LIB}
@@ -198,9 +228,9 @@ else()
${REACT_NATIVE_JNI_LIB}
android
)
-endif()
+endif ()
-if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
+if (${REACT_NATIVE_TARGET_VERSION} LESS 64)
add_library(
turbomodulejsijni
# Sets the library as a shared library.
@@ -208,4 +238,4 @@ if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
# Provides a relative path to your source file(s).
./empty.cpp
)
-endif()
+endif ()
\ No newline at end of file
diff --git a/node_modules/react-native-reanimated/android/build.gradle b/node_modules/react-native-reanimated/android/build.gradle
index dfb79c8..323e5ec 100644
--- a/node_modules/react-native-reanimated/android/build.gradle
+++ b/node_modules/react-native-reanimated/android/build.gradle
@@ -1,10 +1,9 @@
+
+import com.android.Version
+
import java.nio.file.Paths
import org.apache.tools.ant.filters.ReplaceTokens
-
-import java.util.regex.Matcher
-import java.util.regex.Pattern
import groovy.json.JsonSlurper
-import java.util.zip.ZipFile
/**
* Finds the path of the installed npm package with the given name using Node's
@@ -45,18 +44,6 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
-def getCurrentFlavor() {
- String taskRequestName = getGradle().getStartParameter().getTaskRequests().toString()
- Pattern pattern = Pattern.compile("(assemble|bundle|install|generate)(\\w*)(Release|Debug)")
- Matcher matcher = pattern.matcher(taskRequestName)
-
- if (matcher.find()) {
- return matcher.group(2)
- }
-
- return "NOT-FOUND"
-}
-
def resolveBuildType() {
def buildType = System.getenv("CLIENT_SIDE_BUILD")
if (buildType != null) {
@@ -86,127 +73,6 @@ def resolveReactNativeDirectory() {
return file("$projectDir/../../react-native")
}
-abstract class replaceSoTask extends DefaultTask {
- public static String appName = ":app"
- public static String buildDir = "../../../android/app/build"
- public static String fbjniVersion = "0.3.0"
-
- @TaskAction
- def run() {
- def libSoDir = new File("${buildDir}/tmp/libSo")
- if (!libSoDir.exists()) {
- libSoDir.mkdirs()
- def fbjniUrl = "https://repo1.maven.org/maven2/com/facebook/fbjni/fbjni/${fbjniVersion}/fbjni-${fbjniVersion}.aar"
- def aarFile = new File("${libSoDir.path}/fbjni-${fbjniVersion}.aar")
- aarFile.createNewFile()
- aarFile.withOutputStream { out ->
- def url = new URL(fbjniUrl).openConnection()
- out << url.inputStream
- }
- if (!aarFile.exists()) {
- println("Unable to find ${libSoDir.path}/fbjni-${fbjniVersion}.aar")
- return
- }
- def zipFile = new ZipFile(new File("${libSoDir.path}/fbjni-${fbjniVersion}.aar"))
- zipFile.entries().each {
- def zipIt = it
- if (zipIt.name.contains("libfbjni.so")) {
- new File("${libSoDir.path}/" + zipIt.name.replace("/libfbjni.so", "")).mkdirs()
- new File("${libSoDir.path}/" + zipIt.name).withOutputStream{
- it << zipFile.getInputStream(zipIt)
- }
- }
- }
- }
- for(def abiVersion in ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]) {
- ant.sequential {
- copy(
- tofile: "${buildDir}/intermediates/merged_native_libs/debug/out/lib/${abiVersion}/libfbjni.so",
- file: "${buildDir}/tmp/libSo/jni/${abiVersion}/libfbjni.so",
- overwrite: true
- )
- }
- }
- }
-}
-
-def detectAAR(minor, engine) {
- def rnMinorVersionCopy = Integer.parseInt(minor)
- def aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
-
- if (aar.exists()) {
- println "AAR for react-native-reanimated has been found\n$aar"
- return aar
- } else {
- while (!aar.exists() && rnMinorVersionCopy >= 63) {
- rnMinorVersionCopy -= 1
- aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
- }
-
- if (rnMinorVersionCopy < 63) {
- println "No AAR for react-native-reanimated found. Attempting to build from source."
- } else { // aar exists, but was build for lower react-native version
- println "\n\n\n"
- println "****************************************************************************************"
- println "\n\n\n"
- println "WARNING reanimated - no version-specific reanimated AAR for react-native version $minor found."
- println "Falling back to AAR for react-native version $rnMinorVersionCopy."
- println "The react-native JSI interface is not ABI-safe yet, this may result in crashes."
- println "Please post a pull request to implement support for react-native version $minor to the reanimated repo."
- println "Thanks!"
- println "\n\n\n"
- println "****************************************************************************************"
-
- return aar
- }
- }
- return null
-}
-
-def detectJsRuntime() {
- def runtimeType = "jsc"
- rootProject.getSubprojects().forEach({project ->
- if (project.plugins.hasPlugin("com.android.application")) {
- if (project.ext.react.enableHermes) {
- runtimeType = "hermes"
- }
- }
- })
- return runtimeType
-}
-
-def detectReanimatedConfig() {
- def buildFromSourceConf = false
- rootProject.getSubprojects().forEach({project ->
- if (project.plugins.hasPlugin("com.android.application")) {
- if (
- project.ext.has("reanimated")
- && project.ext.reanimated.buildFromSource
- ) {
- buildFromSourceConf = true
- }
- }
- })
- return buildFromSourceConf
-}
-
-def shouldBuildFromSource(aar) {
- if (isDeveloperMode()) {
- // Example app
- return true
- }
- else if (detectReanimatedConfig()) {
- // on user demand
- return true
- }
- else if (aar != null) {
- // when binary exist
- return false
- }
- // when binary is not found
- return true
-}
-
boolean CLIENT_SIDE_BUILD = resolveBuildType()
if (CLIENT_SIDE_BUILD) {
configurations.maybeCreate("default")
@@ -217,70 +83,6 @@ def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.
def reactNativeVersion = reactNativeManifestAsJson.version as String
def (major, minor, patch) = reactNativeVersion.tokenize('.')
def rnMinorVersion = Integer.parseInt(minor)
-def engine = detectJsRuntime()
-def aar = detectAAR(minor, engine)
-boolean BUILD_FROM_SOURCE = shouldBuildFromSource(aar)
-
-def getTaskByPath(project, String appName, String secondPart, String flavorString, String lastPart) {
- String pathName = "${appName}:${secondPart}${flavorString}${lastPart}"
- Task task = project.getTasks().findByPath(pathName)
- if (task != null) {
- return task
- }
- pathName = "${appName}:${secondPart}${flavorString.capitalize()}${lastPart}"
- return project.getTasks().findByPath(pathName)
-}
-
-if (!BUILD_FROM_SOURCE) {
- if (rnMinorVersion < 65) {
- tasks.register("replaceSoTaskDebug", replaceSoTask)
- tasks.register("replaceSoTaskRelease", replaceSoTask)
- Task replaceSoTaskDebug = project.getTasks().findByPath(":react-native-reanimated:replaceSoTaskDebug")
- Task replaceSoTaskRelease = project.getTasks().findByPath(":react-native-reanimated:replaceSoTaskRelease")
-
- if (replaceSoTaskDebug != null && replaceSoTaskRelease != null) {
- rootProject.getSubprojects().forEach({project ->
- if (project.plugins.hasPlugin("com.android.application") && project.getProperties().get("android")) {
- def projectProperties = project.getProperties()
- def flavorString = getCurrentFlavor()
- def reanimatedConf = projectProperties.get("reanimated")
-
- if (
- flavorString != "NOT-FOUND"
- && (!reanimatedConf || (reanimatedConf && !reanimatedConf.get("enablePackagingOptions")))
- ) {
- replaceSoTask.appName = projectProperties.path
- replaceSoTask.buildDir = projectProperties.buildDir
- def appName = projectProperties.path
-
- Task debugNativeLibsTask = getTaskByPath(project, appName, "merge", flavorString, "DebugNativeLibs")
- Task debugDebugSymbolsTask = getTaskByPath(project, appName, "strip", flavorString, "DebugDebugSymbols")
- Task releaseNativeLibsTask = getTaskByPath(project, appName, "merge", flavorString, "ReleaseNativeLibs")
- Task releaseDebugSymbolsTask = getTaskByPath(project, appName, "strip", flavorString, "ReleaseDebugSymbols")
- Task debugTask = getTaskByPath(project, appName, "package", flavorString, "Debug")
- Task releaseTask = getTaskByPath(project, appName, "package", flavorString, "Release")
-
- if (
- debugNativeLibsTask != null && debugDebugSymbolsTask != null
- && releaseNativeLibsTask != null && releaseDebugSymbolsTask != null
- && debugTask != null && releaseTask != null
- ) {
- replaceSoTaskDebug.dependsOn(debugNativeLibsTask, debugDebugSymbolsTask)
- debugTask.dependsOn(replaceSoTaskDebug)
- replaceSoTaskRelease.dependsOn(releaseNativeLibsTask, releaseDebugSymbolsTask)
- releaseTask.dependsOn(replaceSoTaskRelease)
- }
- }
- }
- })
- }
- }
-
- artifacts.add("default", aar)
-}
-
-// end if already loaded aar
-if (!BUILD_FROM_SOURCE) return
def localProps = new Properties()
def localPropertiesFile = file("local.properties")
@@ -309,13 +111,36 @@ def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
def reactNativeThirdParty = new File("$reactNative/ReactAndroid/src/main/jni/third-party")
def _stackProtectorFlag = true
-def FOR_HERMES = ""
-if (findProject(":app")) {
- FOR_HERMES = project(":app").ext.react.enableHermes;
-} else {
- FOR_HERMES = System.getenv("FOR_HERMES") == "True";
-}
+def CMAKE_NODE_MODULES_DIR = CLIENT_SIDE_BUILD
+ ? project.getProjectDir().getParentFile().getParent()
+ : Paths.get(project.getProjectDir().getParent(), getPlaygroundAppName(), "node_modules").toString()
+
+def JS_RUNTIME = {
+ // Returns the js runtime explicitly requested in the environment variable
+ if (System.getenv("JS_RUNTIME")) {
+ return System.getenv("JS_RUNTIME")
+ }
+
+ // Detect js runtime from project setup
+ def defaultRuntimeType = "jsc";
+ def v8Project = rootProject.getSubprojects().find { project -> project.name == "react-native-v8" }
+ if (v8Project != null) {
+ return "v8"
+ }
+ def appProject = findProject(":app") ? project(":app") : null
+ return appProject?.ext?.react?.enableHermes ? "hermes" : defaultRuntimeType
+}.call()
+
+def jsRuntimeDir = {
+ if (JS_RUNTIME == "hermes") {
+ return Paths.get(CMAKE_NODE_MODULES_DIR, "hermes-engine")
+ } else if (JS_RUNTIME == "v8") {
+ return findProject(":react-native-v8").getProjectDir().getParent()
+ } else {
+ return Paths.get(CMAKE_NODE_MODULES_DIR, "react-native", "ReactCommon", "jsi")
+ }
+}.call()
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
@@ -351,8 +176,8 @@ buildscript {
}
}
dependencies {
- classpath "com.android.tools.build:gradle:7.1.1"
- classpath "de.undercouch:gradle-download-task:5.0.1"
+ classpath "com.android.tools.build:gradle:4.2.2"
+ classpath "de.undercouch:gradle-download-task:4.1.2"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.15.0"
}
}
@@ -376,13 +201,15 @@ android {
cmake {
arguments "-DANDROID_STL=c++_shared",
"-DNATIVE_DEBUG=${debugNativeLibraries}",
- "-DREACT_NATIVE_TARGET_VERSION=${REACT_VERSION}",
+ "-DREACT_NATIVE_TARGET_VERSION=${rnMinorVersion}",
"-DANDROID_TOOLCHAIN=clang",
"-DBOOST_VERSION=${BOOST_VERSION}",
"-DBUILD_DIR=${buildDir}",
- "-DFOR_HERMES=${FOR_HERMES}",
+ "-DNODE_MODULES_DIR=${CMAKE_NODE_MODULES_DIR}",
+ "-DJS_RUNTIME=${JS_RUNTIME}",
+ "-DJS_RUNTIME_DIR=${jsRuntimeDir}",
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}"
- abiFilters (*reactNativeArchitectures())
+ abiFilters(*reactNativeArchitectures())
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
}
}
@@ -411,6 +238,8 @@ android {
"**/libhermes.so",
"**/libreactnativejni.so",
"**/libjscexecutor.so",
+ "**/libv8executor.so",
+ "META-INF/MANIFEST.MF"
]
}
tasks.withType(JavaCompile) {
@@ -435,7 +264,7 @@ task cleanCmakeCache() {
}
task printVersions {
- println "Android gradle plugin: ${com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION}"
+ println "Android gradle plugin: ${Version.ANDROID_GRADLE_PLUGIN_VERSION}"
println "Gradle: ${project.gradle.gradleVersion}"
}
@@ -446,10 +275,10 @@ task Log {
task applyJavaPatches(type: Copy) {
def patchDirectory = file("${projectDir}/rnVersionPatch/${rnMinorVersion}")
if (patchDirectory.exists()) {
- from ("${patchDirectory}") {
+ from("${patchDirectory}") {
include "**/*.java"
}
- into ("${projectDir}/src/main/java/com/swmansion/reanimated")
+ into("${projectDir}/src/main/java/com/swmansion/reanimated")
}
}
@@ -643,7 +472,7 @@ task extractSOFiles {
task packageNdkLibs(type: Copy) {
from("$buildDir/reanimated-ndk/all")
include("**/libreanimated.so")
- if(REACT_VERSION < 64) {
+ if (REACT_VERSION < 64) {
include("**/libturbomodulejsijni.so")
}
into("$projectDir/src/main/jniLibs")
@@ -668,8 +497,7 @@ dependencies {
implementation "com.facebook.yoga:proguard-annotations:1.19.0"
if (isDeveloperMode()) {
implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
- }
- else {
+ } else {
implementation "com.facebook.fbjni:fbjni-java-only:" + FBJNI_VERSION
}
implementation "com.facebook.react:react-native:+" // From node_modules
@@ -677,6 +505,11 @@ dependencies {
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
+ def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
+ extractSO(files(jscAAR))
+}
+
+task unpackReactNativeAAR {
def buildType = "debug"
tasks.all({ task ->
if (task.name == "buildCMakeRelease") {
@@ -688,25 +521,33 @@ dependencies {
rnAarMatcher = "**/**/*.aar"
}
def rnAAR = fileTree("$reactNative/android").matching({ it.include rnAarMatcher }).singleFile
- def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
- extractSO(files(rnAAR, jscAAR))
+ def file = rnAAR.absoluteFile
+ def packageName = file.name.tokenize('-')[0]
+ copy {
+ from zipTree(file)
+ into "$reactNative/ReactAndroid/src/main/jni/first-party/$packageName/"
+ include "jni/**/*.so"
+ }
}
task downloadNdkBuildDependencies {
if (!boostPath) {
dependsOn(downloadBoost)
}
- dependsOn(downloadDoubleConversion)
- dependsOn(downloadFolly)
- dependsOn(downloadGlog)
+ if (!dependenciesPath) {
+ dependsOn(downloadDoubleConversion)
+ dependsOn(downloadFolly)
+ dependsOn(downloadGlog)
+ }
}
-task prepareThirdPartyNdkHeaders(dependsOn:[downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog]) {
+task prepareThirdPartyNdkHeaders(dependsOn: [downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog, unpackReactNativeAAR]) {
}
def nativeBuildDependsOn(dependsOnTask) {
def buildTasks = tasks.findAll({ task ->
- !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake")) })
+ !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake"))
+ })
buildTasks.forEach { task -> task.dependsOn(dependsOnTask) }
}
@@ -717,11 +558,30 @@ afterEvaluate {
nativeBuildDependsOn(prepareThirdPartyNdkHeaders)
nativeBuildDependsOn(extractAARHeaders)
nativeBuildDependsOn(extractSOFiles)
+
+ tasks.forEach({ task ->
+ if (task.name.contains("JniLibFolders")) {
+ task.dependsOn(packageNdkLibs)
+ }
+ })
+
+ if (JS_RUNTIME == "hermes") {
+ extractAARHeaders.dependsOn(prepareHermes)
+ extractSOFiles.dependsOn(prepareHermes)
+ } else if (JS_RUNTIME == "v8") {
+ def buildTasks = tasks.findAll({ task ->
+ !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake") || task.name.startsWith("generateJsonModel"))
+ })
+ buildTasks.forEach { task ->
+ def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
+ task.dependsOn(":react-native-v8:copy${buildType}JniLibsProjectOnly")
+ }
+ }
}
if (CLIENT_SIDE_BUILD) {
def aarDir = "${buildDir}/outputs"
- aar = file("${aarDir}/android-debug.aar")
+ def aar = file("${aarDir}/android-debug.aar")
if (aar == null) {
throw GradleScriptException("AAR build failed. No AAR found in ${aarDir}.")
}
diff --git a/node_modules/react-native-reanimated/android/src/main/cpp/NativeProxy.cpp b/node_modules/react-native-reanimated/android/src/main/cpp/NativeProxy.cpp
index 0e4014c..872c77b 100644
--- a/node_modules/react-native-reanimated/android/src/main/cpp/NativeProxy.cpp
+++ b/node_modules/react-native-reanimated/android/src/main/cpp/NativeProxy.cpp
@@ -7,8 +7,10 @@
#include <memory>
#include <string>
-#if FOR_HERMES
+#if JS_RUNTIME_HERMES
#include <hermes/hermes.h>
+#elif JS_RUNTIME_V8
+#include <v8runtime/V8RuntimeFactory.h>
#else
#include <jsi/JSCRuntime.h>
#endif
@@ -136,15 +138,22 @@ void NativeProxy::installJSIBindings() {
auto setGestureStateFunction = [this](int handlerTag, int newState) -> void {
setGestureState(handlerTag, newState);
};
-#if FOR_HERMES
+#if JS_RUNTIME_HERMES
auto config =
::hermes::vm::RuntimeConfig::Builder().withEnableSampleProfiling(false);
std::shared_ptr<jsi::Runtime> animatedRuntime =
facebook::hermes::makeHermesRuntime(config.build());
+#elif JS_RUNTIME_V8
+ auto config = std::make_unique<rnv8::V8RuntimeConfig>();
+ config->enableInspector = false;
+ config->appName = "reanimated";
+ std::shared_ptr<jsi::Runtime> animatedRuntime =
+ rnv8::createSharedV8Runtime(runtime_, std::move(config));
#else
std::shared_ptr<jsi::Runtime> animatedRuntime =
facebook::jsc::makeJSCRuntime();
#endif
+
auto workletRuntimeValue = runtime_->global()
.getProperty(*runtime_, "ArrayBuffer")
.asObject(*runtime_)

File diff suppressed because it is too large Load Diff