|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
|
apply plugin: "com.android.application"
|
|
|
|
|
|
|
|
|
|
import com.android.build.OutputFile
|
|
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
|
|
|
|
@@ -20,7 +21,7 @@ import com.android.build.OutputFile
|
|
|
|
|
* // default. Can be overridden with ENTRY_FILE environment variable.
|
|
|
|
|
* entryFile: "index.android.js",
|
|
|
|
|
*
|
|
|
|
|
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
|
|
|
|
|
* // https://reactnative.dev/docs/performance#enable-the-ram-format
|
|
|
|
|
* bundleCommand: "ram-bundle",
|
|
|
|
|
*
|
|
|
|
|
* // whether to bundle JS and assets in debug mode
|
|
|
|
|
@@ -79,11 +80,9 @@ import com.android.build.OutputFile
|
|
|
|
|
|
|
|
|
|
project.ext.react = [
|
|
|
|
|
enableHermes: false, // clean and rebuild if changing
|
|
|
|
|
entryFile: 'index.js'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
apply from: "../../node_modules/react-native/react.gradle"
|
|
|
|
|
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set this to true to create two separate APKs instead of one:
|
|
|
|
|
@@ -116,16 +115,19 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
|
|
|
|
/**
|
|
|
|
|
* Whether to enable the Hermes VM.
|
|
|
|
|
*
|
|
|
|
|
* This should be set on project.ext.react and mirrored here. If it is not set
|
|
|
|
|
* This should be set on project.ext.react and that value will be read here. If it is not set
|
|
|
|
|
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
|
|
|
|
* and the benefits of using Hermes will therefore be sharply reduced.
|
|
|
|
|
*/
|
|
|
|
|
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 reactNativeArchitectures() {
|
|
|
|
|
def value = project.getProperties().get("reactNativeArchitectures")
|
|
|
|
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
ndkVersion rootProject.ext.ndkVersion
|
|
|
|
|
@@ -133,19 +135,92 @@ android {
|
|
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
applicationId "com.jellyfinaudioplayer"
|
|
|
|
|
applicationId "com.rndiffapp"
|
|
|
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
|
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
|
|
|
versionCode 8
|
|
|
|
|
versionName "1.2.4"
|
|
|
|
|
multiDexEnabled true
|
|
|
|
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
|
|
|
|
|
|
|
|
if (isNewArchitectureEnabled()) {
|
|
|
|
|
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
|
|
|
|
externalNativeBuild {
|
|
|
|
|
ndkBuild {
|
|
|
|
|
arguments "APP_PLATFORM=android-21",
|
|
|
|
|
"APP_STL=c++_shared",
|
|
|
|
|
"NDK_TOOLCHAIN_VERSION=clang",
|
|
|
|
|
"GENERATED_SRC_DIR=$buildDir/generated/source",
|
|
|
|
|
"PROJECT_BUILD_DIR=$buildDir",
|
|
|
|
|
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
|
|
|
|
|
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
|
|
|
|
|
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
|
|
|
|
|
cppFlags "-std=c++17"
|
|
|
|
|
// Make sure this target name is the same you specify inside the
|
|
|
|
|
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
|
|
|
|
|
targets "rndiffapp_appmodules"
|
|
|
|
|
|
|
|
|
|
// Fix for windows limit on number of character in file paths and in command lines
|
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
|
|
|
arguments "NDK_OUT=${rootProject.projectDir.getParent()}\\.cxx",
|
|
|
|
|
"NDK_APP_SHORT_COMMANDS=true"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!enableSeparateBuildPerCPUArchitecture) {
|
|
|
|
|
ndk {
|
|
|
|
|
abiFilters (*reactNativeArchitectures())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isNewArchitectureEnabled()) {
|
|
|
|
|
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
|
|
|
|
externalNativeBuild {
|
|
|
|
|
ndkBuild {
|
|
|
|
|
path "$projectDir/src/main/jni/Android.mk"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
// Due to a bug inside AGP, we have to explicitly set a dependency
|
|
|
|
|
// between configureNdkBuild* tasks and the preBuild tasks.
|
|
|
|
|
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
|
|
|
|
configureNdkBuildRelease.dependsOn(preReleaseBuild)
|
|
|
|
|
configureNdkBuildDebug.dependsOn(preDebugBuild)
|
|
|
|
|
reactNativeArchitectures().each { architecture ->
|
|
|
|
|
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
|
|
|
|
|
dependsOn("preDebugBuild")
|
|
|
|
|
}
|
|
|
|
|
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
|
|
|
|
|
dependsOn("preReleaseBuild")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
splits {
|
|
|
|
|
abi {
|
|
|
|
|
reset()
|
|
|
|
|
enable enableSeparateBuildPerCPUArchitecture
|
|
|
|
|
universalApk false // If true, also generate a universal APK
|
|
|
|
|
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
|
|
|
|
include (*reactNativeArchitectures())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
signingConfigs {
|
|
|
|
|
@@ -159,15 +234,10 @@ android {
|
|
|
|
|
buildTypes {
|
|
|
|
|
debug {
|
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
|
if (nativeArchitectures) {
|
|
|
|
|
ndk {
|
|
|
|
|
abiFilters nativeArchitectures.split(',')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
release {
|
|
|
|
|
// Caution! In production, you need to generate your own keystore file.
|
|
|
|
|
// see https://facebook.github.io/react-native/docs/signed-apk-android.
|
|
|
|
|
// see https://reactnative.dev/docs/signed-apk-android.
|
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
|
minifyEnabled enableProguardInReleaseBuilds
|
|
|
|
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
|
|
|
@@ -193,17 +263,19 @@ android {
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
|
|
|
|
|
|
|
|
//noinspection GradleDynamicVersion
|
|
|
|
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
|
|
|
|
|
|
|
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
|
|
|
|
|
|
|
|
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
|
|
|
|
exclude group:'com.facebook.fbjni'
|
|
|
|
|
exclude group:'com.facebook.fbjni'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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}") {
|
|
|
|
|
@@ -219,6 +291,18 @@ dependencies {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isNewArchitectureEnabled()) {
|
|
|
|
|
// If new architecture is enabled, we let you build RN from source
|
|
|
|
|
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
|
|
|
|
|
// This will be applied to all the imported transtitive dependency.
|
|
|
|
|
configurations.all {
|
|
|
|
|
resolutionStrategy.dependencySubstitution {
|
|
|
|
|
substitute(module("com.facebook.react:react-native"))
|
|
|
|
|
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run this once to be able to run the application with BUCK
|
|
|
|
|
// puts all compile dependencies into folder libs for BUCK to use
|
|
|
|
|
task copyDownloadableDepsToLibs(type: Copy) {
|
|
|
|
|
@@ -227,3 +311,11 @@ task copyDownloadableDepsToLibs(type: Copy) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
|
|
|
|
|
|
|
|
def isNewArchitectureEnabled() {
|
|
|
|
|
// To opt-in for the New Architecture, you can either:
|
|
|
|
|
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
|
|
|
// - Invoke gradle with `-newArchEnabled=true`
|
|
|
|
|
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
|
|
|
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
|
|
|
}
|