mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Allow specifying an architecture in RNTester and release builds
Summary: Setting `reactNativeDebugArchitectures` currently does not seem to work for RNTester, since it sets `abiFilters` which conflicts with the `splits` option we're already setting. Gradle then complains: ``` neildhar@neildhar-mbp ~/f/x/j/react-native-github (default) > ./gradlew -PreactNativeDebugArchitectures=x86_64 :packages:rn-tester:android:app:installJscDebug > Configure project :ReactAndroid Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated. FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':packages:rn-tester:android:app'. > com.android.builder.errors.EvalIssueException: Conflicting configuration : 'x86_64' in ndk abiFilters cannot be present when splits abi filters are set : x86_64,x86,armeabi-v7a,arm64-v8a ``` Consolidate everything with the `splits` option. In addition, it's convenient to also be able to control the native architecture for release builds. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D31834075 fbshipit-source-id: c6375d2a1e242981d0017f6e0a9d428b074a3fbd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
86491749ee
commit
43c38cdc8e
@@ -224,11 +224,8 @@ def reactNativeInspectorProxyPort() {
|
||||
}
|
||||
|
||||
def reactNativeArchitectures() {
|
||||
def isDebug = gradle.startParameter.taskRequests.any {
|
||||
it.args.any { it.endsWith("Debug") }
|
||||
}
|
||||
def value = project.getProperties().get("reactNativeDebugArchitectures")
|
||||
return value != null && isDebug ? value : "all"
|
||||
def value = project.getProperties().get("reactNativeArchitectures")
|
||||
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
}
|
||||
|
||||
def ndkBuildJobs() {
|
||||
@@ -290,8 +287,7 @@ android {
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "APP_ABI=${reactNativeArchitectures()}",
|
||||
"NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
|
||||
arguments "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
|
||||
"THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir",
|
||||
"REACT_COMMON_DIR=$projectDir/../ReactCommon",
|
||||
"REACT_GENERATED_SRC_DIR=$buildDir/generated/source",
|
||||
@@ -304,6 +300,9 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
abiFilters (*reactNativeArchitectures())
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
|
||||
@@ -133,9 +133,11 @@ def enableFabric = project.ext.react.enableFabric
|
||||
def useIntlJsc = false
|
||||
|
||||
/**
|
||||
* Architectures to build native code for in debug.
|
||||
* Architectures to build native code for.
|
||||
*/
|
||||
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
|
||||
def nativeArchitectures = project.getProperties().get("reactNativeArchitectures") ?
|
||||
project.getProperties().get("reactNativeArchitectures").split(",")
|
||||
: ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
@@ -183,18 +185,13 @@ android {
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false
|
||||
reset()
|
||||
include "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
|
||||
include (*nativeArchitectures)
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
debuggable true
|
||||
signingConfig signingConfigs.release
|
||||
if (nativeArchitectures) {
|
||||
ndk {
|
||||
abiFilters nativeArchitectures.split(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
release {
|
||||
debuggable false
|
||||
|
||||
@@ -121,10 +121,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||
|
||||
/**
|
||||
* Architectures to build native code for in debug.
|
||||
* Architectures to build native code for.
|
||||
*/
|
||||
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
|
||||
|
||||
def nativeArchitectures = project.getProperties().get("reactNativeArchitectures") ?
|
||||
project.getProperties().get("reactNativeArchitectures").split(",")
|
||||
: ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
android {
|
||||
ndkVersion rootProject.ext.ndkVersion
|
||||
|
||||
@@ -142,7 +143,7 @@ android {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||
include (*nativeArchitectures)
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
@@ -156,11 +157,6 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
if (nativeArchitectures) {
|
||||
ndk {
|
||||
abiFilters nativeArchitectures.split(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
release {
|
||||
// Caution! In production, you need to generate your own keystore file.
|
||||
|
||||
Reference in New Issue
Block a user