From e486f03679d522631c58096bd417dcb5a1ee62be Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 3 Oct 2022 03:44:14 -0700 Subject: [PATCH 1/2] Consume fbjni via Prefab Summary: Historically we had to download an unzip the fbjni Android Archive to use it. Here I'm updating the way how we consume to use prefab so we can remove a lot of unnecessary configuration, also from the app template. Changelog: [Internal] [Changed] - Consume fbjni via Prefab Differential Revision: D39964574 fbshipit-source-id: ef1e8f07e57856fba2a518435ca73a2104ecefd9 --- ReactAndroid/build.gradle | 18 +---- .../cmake-utils/Android-prebuilt.cmake | 64 ----------------- .../cmake-utils/ReactNative-application.cmake | 13 ++-- ReactAndroid/src/main/jni/CMakeLists.txt | 3 +- .../src/main/jni/first-party/fbjni/.gitignore | 2 - .../src/main/jni/first-party/fbjni/Android.mk | 14 ---- .../main/jni/first-party/fbjni/CMakeLists.txt | 15 ---- .../internal/ExtractJniAndHeadersTask.kt | 49 ------------- .../internal/ExtractJniAndHeadersTaskTest.kt | 72 ------------------- packages/rn-tester/android/app/build.gradle | 19 ++--- template/android/app/build.gradle | 19 ++--- 11 files changed, 25 insertions(+), 263 deletions(-) delete mode 100644 ReactAndroid/cmake-utils/Android-prebuilt.cmake delete mode 100644 ReactAndroid/src/main/jni/first-party/fbjni/.gitignore delete mode 100644 ReactAndroid/src/main/jni/first-party/fbjni/Android.mk delete mode 100644 ReactAndroid/src/main/jni/first-party/fbjni/CMakeLists.txt delete mode 100644 packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt delete mode 100644 packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index ad0bef17c6d67f..f28b3af5df2a19 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -360,12 +360,6 @@ tasks.register("packageReactNdkReleaseLibsForBuck", Copy) { into("src/main/jni/prebuilt/lib") } -final def extractNativeDependencies = tasks.register('extractNativeDependencies', ExtractJniAndHeadersTask) { - it.extractHeadersConfiguration.setFrom(configurations.extractHeaders) - it.extractJniConfiguration.setFrom(configurations.extractJNI) - it.baseOutputDir = project.file("src/main/jni/first-party/") -} - task installArchives { dependsOn("publishAllPublicationsToNpmRepository") } @@ -464,7 +458,7 @@ android { } } - preBuild.dependsOn(prepareJSC, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent, extractNativeDependencies) + preBuild.dependsOn(prepareJSC, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent) preBuild.dependsOn("generateCodegenArtifactsFromSchema") preBuild.dependsOn(preparePrefab) @@ -492,11 +486,6 @@ android { exclude("**/libjsc.so") } - configurations { - extractHeaders - extractJNI - } - buildFeatures { prefab true prefabPublishing !skipPrefabPublishing @@ -571,7 +560,7 @@ dependencies { api("androidx.swiperefreshlayout:swiperefreshlayout:${SWIPEREFRESH_LAYOUT_VERSION}") api("androidx.tracing:tracing:${ANDROIDX_TRACING_VERSION}") - api("com.facebook.fbjni:fbjni-java-only:${FBJNI_VERSION}") + api("com.facebook.fbjni:fbjni:${FBJNI_VERSION}") api("com.facebook.fresco:fresco:${FRESCO_VERSION}") api("com.facebook.fresco:imagepipeline-okhttp3:${FRESCO_VERSION}") api("com.facebook.fresco:ui-common:${FRESCO_VERSION}") @@ -585,9 +574,6 @@ dependencies { api("com.squareup.okio:okio:${OKIO_VERSION}") api("javax.inject:javax.inject:${JAVAX_INJECT_VERSION}") - extractHeaders("com.facebook.fbjni:fbjni:${FBJNI_VERSION}:headers") - extractJNI("com.facebook.fbjni:fbjni:${FBJNI_VERSION}") - // It's up to the consumer to decide if hermes should be included or not. // Therefore hermes-engine is a compileOnly dependency. compileOnly(project(":ReactAndroid:hermes-engine")) diff --git a/ReactAndroid/cmake-utils/Android-prebuilt.cmake b/ReactAndroid/cmake-utils/Android-prebuilt.cmake deleted file mode 100644 index 8b101dc196cc77..00000000000000 --- a/ReactAndroid/cmake-utils/Android-prebuilt.cmake +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# This configuration provides access to most common React Native prebuilt .so files -# to avoid recompiling each of the libraries outside of ReactAndroid NDK compilation. -# Hosting app's/library's CMakeLists.txt can include this Android-prebuilt.cmake file to -# get access to those libraries to depend on. -# NOTES: -# * Currently, it assumes building React Native from source. -# * Not every .so is listed here (yet). -# * Static libs are not covered here (yet). - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_VERBOSE_MAKEFILE on) - -# FIRST_PARTY_NDK_DIR contains vendored source code from other FB frameworks -# like Yoga, FBJNI, etc. -set(FIRST_PARTY_NDK_DIR ${REACT_ANDROID_DIR}/src/main/jni/first-party) -# THIRD_PARTY_NDK_DIR is where we're downloading third-party native -# frameworks such as libevent, boost, etc. -set(THIRD_PARTY_NDK_DIR ${REACT_ANDROID_BUILD_DIR}/third-party-ndk) -# REACT_ANDROID_SRC_DIR is the root of ReactAndroid source code (Java & JNI) -set(REACT_ANDROID_SRC_DIR ${REACT_ANDROID_DIR}/src/main) -# REACT_COMMON_DIR is the root of ReactCommon source code (C++ only) -set(REACT_COMMON_DIR ${REACT_ANDROID_DIR}/../ReactCommon) -# REACT_GENERATED_SRC_DIR is the folder where the codegen for rncore will output -set(REACT_GENERATED_SRC_DIR ${REACT_ANDROID_BUILD_DIR}/generated/source) -# REACT_NDK_EXPORT_DIR is the folder where the .so will be copied for being inported -# in the local project by the packageReactDebugNdkLibs/packageReactReleaseNdkLibs -set(REACT_NDK_EXPORT_DIR ${PROJECT_BUILD_DIR}/react-ndk/exported) - -## fb -add_library(fb SHARED IMPORTED GLOBAL) -set_target_properties(fb - PROPERTIES - IMPORTED_LOCATION - ${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libfb.so) -target_include_directories(fb - INTERFACE - ${FIRST_PARTY_NDK_DIR}/fb/include) - -## react_render_imagemanager -add_library(react_render_imagemanager SHARED IMPORTED GLOBAL) -set_target_properties(react_render_imagemanager - PROPERTIES - IMPORTED_LOCATION - ${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libreact_render_imagemanager.so) -target_include_directories(react_render_imagemanager - INTERFACE - ${REACT_COMMON_DIR}/react/renderer/imagemanager - ${REACT_COMMON_DIR}/react/renderer/imagemanager/platform/cxx) - -## react_render_mounting -add_library(react_render_mounting SHARED IMPORTED GLOBAL) -set_target_properties(react_render_mounting - PROPERTIES - IMPORTED_LOCATION - ${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libreact_render_mounting.so) -target_include_directories(react_render_mounting INTERFACE ${REACT_COMMON_DIR}/react/renderer/mounting) - -## fbjni -add_subdirectory(${FIRST_PARTY_NDK_DIR}/fbjni fbjni_build) diff --git a/ReactAndroid/cmake-utils/ReactNative-application.cmake b/ReactAndroid/cmake-utils/ReactNative-application.cmake index 5c8c5bedb0d2b3..34453bad46d62a 100644 --- a/ReactAndroid/cmake-utils/ReactNative-application.cmake +++ b/ReactAndroid/cmake-utils/ReactNative-application.cmake @@ -19,6 +19,10 @@ set(CMAKE_VERBOSE_MAKEFILE on) include(${CMAKE_CURRENT_LIST_DIR}/folly-flags.cmake) +# We configured the REACT_COMMON_DIR variable as it's commonly used to reference +# shared C++ code in other targets. +set(REACT_COMMON_DIR ${REACT_ANDROID_DIR}/../ReactCommon) + # If you have ccache installed, we're going to honor it. find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) @@ -26,8 +30,6 @@ if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) -include(${REACT_ANDROID_DIR}/cmake-utils/Android-prebuilt.cmake) - file(GLOB input_SRC CONFIGURE_DEPENDS *.cpp ${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/*.cpp) @@ -41,7 +43,7 @@ target_include_directories(${CMAKE_PROJECT_NAME} target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Werror -fexceptions -frtti -std=c++17 -DWITH_INSPECTOR=1 -DLOG_TAG=\"ReactNative\") -# Prefab packages +# Prefab packages from React Native find_package(ReactAndroid REQUIRED CONFIG) add_library(react_render_debug ALIAS ReactAndroid::react_render_debug) add_library(turbomodulejsijni ALIAS ReactAndroid::turbomodulejsijni) @@ -60,10 +62,13 @@ add_library(react_render_mapbuffer ALIAS ReactAndroid::react_render_mapbuffer) add_library(yoga ALIAS ReactAndroid::yoga) add_library(folly_runtime ALIAS ReactAndroid::folly_runtime) add_library(react_nativemodule_core ALIAS ReactAndroid::react_nativemodule_core) +# 3rd party prefab packages +find_package(fbjni REQUIRED CONFIG) +add_library(fbjni ALIAS fbjni::fbjni) target_link_libraries(${CMAKE_PROJECT_NAME} fabricjni # prefab ready - fbjni + fbjni # via 3rd party prefab folly_runtime # prefab ready glog # prefab ready jsi # prefab ready diff --git a/ReactAndroid/src/main/jni/CMakeLists.txt b/ReactAndroid/src/main/jni/CMakeLists.txt index ce8896e15e91ab..420794146092e8 100644 --- a/ReactAndroid/src/main/jni/CMakeLists.txt +++ b/ReactAndroid/src/main/jni/CMakeLists.txt @@ -37,6 +37,8 @@ endfunction() # Third-party prefabs find_package(hermes-engine REQUIRED CONFIG) +find_package(fbjni REQUIRED CONFIG) +add_library(fbjni ALIAS fbjni::fbjni) # Third-party downloaded targets add_react_third_party_ndk_subdir(glog) @@ -96,7 +98,6 @@ add_react_common_subdir(react/nativemodule/core) # ReactAndroid JNI targets add_react_build_subdir(generated/source/codegen/jni) -add_react_android_subdir(src/main/jni/first-party/fbjni) add_react_android_subdir(src/main/jni/first-party/fb) add_react_android_subdir(src/main/jni/first-party/fbgloginit) add_react_android_subdir(src/main/jni/first-party/yogajni) diff --git a/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore b/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore deleted file mode 100644 index cdcdafaf0651b8..00000000000000 --- a/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/headers/ -/jni/ diff --git a/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk b/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk deleted file mode 100644 index bc61e176b9466f..00000000000000 --- a/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(LOCAL_PATH)/jni/$(TARGET_ARCH_ABI)/libfbjni.so - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/headers -LOCAL_MODULE := libfbjni - -include $(PREBUILT_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/jni/first-party/fbjni/CMakeLists.txt b/ReactAndroid/src/main/jni/first-party/fbjni/CMakeLists.txt deleted file mode 100644 index f8fa27c5a97ad8..00000000000000 --- a/ReactAndroid/src/main/jni/first-party/fbjni/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_VERBOSE_MAKEFILE on) - -add_library(fbjni SHARED IMPORTED GLOBAL) -set_target_properties(fbjni - PROPERTIES - IMPORTED_LOCATION - ${CMAKE_CURRENT_SOURCE_DIR}/jni/${ANDROID_ABI}/libfbjni.so) - -target_include_directories(fbjni INTERFACE headers) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt deleted file mode 100644 index fd0769b9023802..00000000000000 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.tasks.internal - -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.tasks.* - -/** - * A task that takes care of extracting JNIs and Headers from a custom Gradle configuration into an - * output folder. Users are most likely not going to use this task but it will be used when building - * the React Native project. - */ -abstract class ExtractJniAndHeadersTask : DefaultTask() { - - @get:InputFiles abstract val extractHeadersConfiguration: ConfigurableFileCollection - - @get:InputFiles abstract val extractJniConfiguration: ConfigurableFileCollection - - @get:OutputDirectory abstract val baseOutputDir: DirectoryProperty - - @TaskAction - fun taskAction() { - extractJniConfiguration.files.forEach { - val file = it.absoluteFile - val packageName = file.name.split("-", ".").first() - project.copy { copySpec -> - copySpec.from(project.zipTree(file)) - copySpec.into(baseOutputDir.dir(packageName)) - copySpec.include("jni/**/*") - } - } - extractHeadersConfiguration.files.forEach { - val file = it.absoluteFile - val packageName = file.name.split("-", ".").first() - project.copy { copySpec -> - copySpec.from(project.zipTree(file)) - copySpec.into(baseOutputDir.get().dir("$packageName/headers")) - copySpec.include("**/*.h") - } - } - } -} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt deleted file mode 100644 index 38394e3bf43177..00000000000000 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.tasks.internal - -import com.facebook.react.tests.createProject -import com.facebook.react.tests.createTestTask -import com.facebook.react.tests.zipFiles -import java.io.* -import java.util.zip.ZipEntry -import java.util.zip.ZipOutputStream -import org.junit.Assert.assertTrue -import org.junit.Rule -import org.junit.Test -import org.junit.rules.TemporaryFolder - -class ExtractJniAndHeadersTaskTest { - - @get:Rule val tempFolder = TemporaryFolder() - - @Test - fun extractJniAndHeadersTask_extractsHeadersCorrectly() { - val project = createProject() - val aarFile = File(project.projectDir, "libheader.aar") - val headerFile = tempFolder.newFile("justaheader.h") - val output = tempFolder.newFolder("output") - zipFiles(aarFile, listOf(headerFile)) - - val task = - createTestTask(project = project) { - it.extractHeadersConfiguration.setFrom(aarFile) - it.baseOutputDir.set(output) - } - - task.taskAction() - - assertTrue(File(output, "libheader/headers/justaheader.h").exists()) - } - - @Test - fun extractJniAndHeadersTask_extractsJniCorrectly() { - val project = createProject() - val aarFile = File(project.projectDir, "something.aar") - File(tempFolder.root, "jni/libsomething.so").apply { - parentFile.mkdirs() - createNewFile() - } - val output = tempFolder.newFolder("output") - ZipOutputStream(BufferedOutputStream(FileOutputStream(aarFile.absolutePath))).use { out -> - FileInputStream(aarFile).use { fi -> - BufferedInputStream(fi).use { origin -> - out.putNextEntry(ZipEntry("jni/")) - out.putNextEntry(ZipEntry("jni/libsomething.so")) - origin.copyTo(out, 1024) - } - } - } - val task = - createTestTask(project = project) { - it.extractJniConfiguration.setFrom(aarFile) - it.baseOutputDir.set(output) - } - - task.taskAction() - - assertTrue(File(output, "something/jni/libsomething.so").exists()) - } -} diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index 73e4adb3c1da08..383740d382369a 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -197,6 +197,7 @@ android { packagingOptions { pickFirst '**/libhermes.so' pickFirst '**/libjsc.so' + pickFirst '**/libc++_shared.so' } } @@ -205,23 +206,13 @@ dependencies { implementation project(':ReactAndroid') // Consume Hermes as built from source only for the Hermes variant. - hermesImplementation(project(":ReactAndroid:hermes-engine")) { - exclude group:'com.facebook.fbjni' - } + hermesImplementation(project(":ReactAndroid:hermes-engine")) implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' - } - - debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' - } - - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' - } + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") + debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") + debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") if (useIntlJsc) { jscImplementation 'org.webkit:android-jsc-intl:+' diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index 717150ebff34fb..9042d07256dbb2 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -189,6 +189,10 @@ android { preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) } } + packagingOptions { + pickFirst '**/libc++_shared.so' + pickFirst '**/libfbjni.so' + } splits { abi { @@ -244,24 +248,15 @@ dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' - } - + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' - } - + debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") if (enableHermes) { //noinspection GradleDynamicVersion - implementation("com.facebook.react:hermes-engine:+") { // From node_modules - exclude group:'com.facebook.fbjni' - } + implementation("com.facebook.react:hermes-engine:+") // From node_modules } else { implementation jscFlavor } From 49727b108f4e5658701c87020ac15c965374393b Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 3 Oct 2022 03:44:37 -0700 Subject: [PATCH 2/2] Cleanup the template after prefab support Summary: We can now remove a lot of unnecessary code to copy .so files around as they're consumed via prefab from :ReactAndroid Changelog: [Android] [Changed] - Cleanup the Android template after prefab support Reviewed By: cipolleschi Differential Revision: D40014642 fbshipit-source-id: 5092f6204af3ff2a8b36da074030b8c69293875a --- ReactAndroid/build.gradle | 13 ------------- packages/rn-tester/android/app/build.gradle | 20 -------------------- template/android/app/build.gradle | 18 ------------------ 3 files changed, 51 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index f28b3af5df2a19..3e58f829b87fc4 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -339,10 +339,6 @@ def reactNativeArchitectures() { } tasks.register("packageReactNdkLibsForBuck") { - dependsOn("packageReactNdkDebugLibsForBuck") -} - -tasks.register("packageReactNdkDebugLibsForBuck", Copy) { dependsOn("mergeDebugNativeLibs") // Shared libraries (.so) are copied from the merged_native_libs folder instead from("$buildDir/intermediates/merged_native_libs/debug/out/lib/") @@ -351,15 +347,6 @@ tasks.register("packageReactNdkDebugLibsForBuck", Copy) { into("src/main/jni/prebuilt/lib") } -tasks.register("packageReactNdkReleaseLibsForBuck", Copy) { - dependsOn("mergeReleaseNativeLibs") - // Shared libraries (.so) are copied from the merged_native_libs folder instead - from("$buildDir/intermediates/merged_native_libs/release/out/lib/") - exclude("**/libjsc.so") - exclude("**/libhermes.so") - into("src/main/jni/prebuilt/lib") -} - task installArchives { dependsOn("publishAllPublicationsToNpmRepository") } diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index 383740d382369a..865e9898ac9521 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -246,27 +246,7 @@ android { } } -def packageReactDebugNdkLibs = tasks.register("packageReactDebugNdkLibs", Copy) { - // TODO: handle extracting .so from prebuilt :ReactAndroid. - dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") - dependsOn("generateCodegenArtifactsFromSchema") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") -} -def packageReactReleaseNdkLibs = tasks.register("packageReactReleaseNdkLibs", Copy) { - // TODO: handle extracting .so from prebuilt :ReactAndroid. - dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") - dependsOn("generateCodegenArtifactsFromSchema") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") -} - afterEvaluate { - preHermesReleaseBuild.dependsOn(packageReactReleaseNdkLibs) - preJscReleaseBuild.dependsOn(packageReactReleaseNdkLibs) - preHermesDebugBuild.dependsOn(packageReactDebugNdkLibs) - preJscDebugBuild.dependsOn(packageReactDebugNdkLibs) - // As we're consuming Hermes from source, we want to make sure // `hermesc` is built before we actually invoke the `emit*HermesResource` task emitHermesDebugHermesResources.dependsOn(":ReactAndroid:hermes-engine:buildHermes") diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index 9042d07256dbb2..ea7ea35382b61e 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -170,24 +170,6 @@ android { buildFeatures { prefab true } - def reactAndroidProjectDir = project(':ReactAndroid').projectDir - def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { - dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") - } - def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { - dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") - into("$buildDir/react-ndk/exported") - } - afterEvaluate { - // If you wish to add a custom TurboModule or component locally, - // you should uncomment this line. - // preBuild.dependsOn("generateCodegenArtifactsFromSchema") - preDebugBuild.dependsOn(packageReactNdkDebugLibs) - preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) - } } packagingOptions { pickFirst '**/libc++_shared.so'