chore: Upgrade to RN 71 (#1465)
* chore: Upgrade Example to RN 0.71 * chore: Upgrade all libs * fix: Fix CameraRoll installation * Update Gradle Tools * fix: Fix buildscripts * Clean out build.gradle * fix: Fix Kotlin setup * fix: Move kotlin-android dependency to lib * Move `_setGlobalConsole` * Update gradle-wrapper.properties * Rebuild lockfiles * chore: Update build:gradle * Update StatusBarBlurBackground.tsx * Use Java 11 in Workflows * Update MediaPage.tsx * Add `google` repository to build.gradle * Double Java Heap size * Increase heap size * Alternative args * Update build.gradle
This commit is contained in:
@@ -1,156 +1,96 @@
|
||||
import groovy.json.JsonSlurper
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import java.nio.file.Paths
|
||||
|
||||
static def findNodeModules(baseDir) {
|
||||
def basePath = baseDir.toPath().normalize()
|
||||
// Node's module resolution algorithm searches up to the root directory,
|
||||
// after which the base path will be null
|
||||
while (basePath) {
|
||||
def nodeModulesPath = Paths.get(basePath.toString(), "node_modules")
|
||||
def reactNativePath = Paths.get(nodeModulesPath.toString(), "react-native")
|
||||
if (nodeModulesPath.toFile().exists() && reactNativePath.toFile().exists()) {
|
||||
return nodeModulesPath.toString()
|
||||
}
|
||||
basePath = basePath.getParent()
|
||||
}
|
||||
throw new GradleException("VisionCamera: Failed to find node_modules/ path!")
|
||||
}
|
||||
static def findNodeModulePath(baseDir, packageName) {
|
||||
def basePath = baseDir.toPath().normalize()
|
||||
// Node's module resolution algorithm searches up to the root directory,
|
||||
// after which the base path will be null
|
||||
while (basePath) {
|
||||
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
||||
if (candidatePath.toFile().exists()) {
|
||||
return candidatePath.toString()
|
||||
}
|
||||
basePath = basePath.getParent()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
def nodeModules = findNodeModules(projectDir)
|
||||
logger.warn("VisionCamera: node_modules/ found at: ${nodeModules}")
|
||||
def reactNative = new File("$nodeModules/react-native")
|
||||
def CMAKE_NODE_MODULES_DIR = project.getProjectDir().getParentFile().getParent()
|
||||
def reactProperties = new Properties()
|
||||
file("$nodeModules/react-native/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
||||
def REACT_NATIVE_FULL_VERSION = reactProperties.getProperty("VERSION_NAME")
|
||||
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger()
|
||||
|
||||
def FOR_HERMES = System.getenv("FOR_HERMES") == "True"
|
||||
rootProject.getSubprojects().forEach({project ->
|
||||
if (project.plugins.hasPlugin("com.android.application")) {
|
||||
FOR_HERMES = project.hermesEnabled || project.ext.react.enableHermes
|
||||
}
|
||||
})
|
||||
def jsRuntimeDir = {
|
||||
if (FOR_HERMES) {
|
||||
return Paths.get(CMAKE_NODE_MODULES_DIR, "react-native", "sdks", "hermes")
|
||||
} else {
|
||||
return Paths.get(CMAKE_NODE_MODULES_DIR, "react-native", "ReactCommon", "jsi")
|
||||
}
|
||||
}.call()
|
||||
logger.warn("VisionCamera: Building with ${FOR_HERMES ? "Hermes" : "JSC"}...")
|
||||
|
||||
buildscript {
|
||||
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
||||
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['VisionCamera_kotlinVersion']
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath 'de.undercouch:gradle-download-task:4.1.2'
|
||||
// noinspection DifferentKotlinGradleVersion
|
||||
classpath "com.android.tools.build:gradle:7.3.1"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
def getExtOrDefault(name) {
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['VisionCamera_' + name]
|
||||
}
|
||||
|
||||
def getExtOrIntegerDefault(name) {
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['VisionCamera_' + name]).toInteger()
|
||||
}
|
||||
def ENABLE_FRAME_PROCESSORS = false // TODO: fix
|
||||
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['VisionCamera_kotlinVersion']
|
||||
|
||||
def resolveBuildType() {
|
||||
def buildType = "debug"
|
||||
tasks.all({ task ->
|
||||
if (task.name == "buildCMakeRelease") {
|
||||
buildType = "release"
|
||||
}
|
||||
})
|
||||
return buildType
|
||||
Gradle gradle = getGradle()
|
||||
String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()
|
||||
|
||||
return tskReqStr.contains('Release') ? 'release' : 'debug'
|
||||
}
|
||||
|
||||
// plugin.js file only exists since REA v2.
|
||||
def hasReanimated2 = file("${nodeModules}/react-native-reanimated/plugin.js").exists()
|
||||
def disableFrameProcessors = rootProject.ext.has("disableFrameProcessors") ? rootProject.ext.get("disableFrameProcessors").asBoolean() : false
|
||||
def ENABLE_FRAME_PROCESSORS = hasReanimated2 && !disableFrameProcessors
|
||||
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"
|
||||
}
|
||||
|
||||
if (ENABLE_FRAME_PROCESSORS) {
|
||||
logger.warn("VisionCamera: Frame Processors are enabled! Building C++ part...")
|
||||
} else {
|
||||
if (disableFrameProcessors) {
|
||||
logger.warn("VisionCamera: Frame Processors are disabled because the user explicitly disabled it ('disableFrameProcessors=${disableFrameProcessors}'). C++ part will not be built.")
|
||||
} else if (!hasReanimated2) {
|
||||
logger.warn("VisionCamera: Frame Processors are disabled because REA v2 does not exist. C++ part will not be built.")
|
||||
}
|
||||
if (isNewArchitectureEnabled()) {
|
||||
apply plugin: 'com.facebook.react'
|
||||
}
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
def safeExtGet(prop, fallback) {
|
||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
||||
}
|
||||
|
||||
def reactNativeArchitectures() {
|
||||
def value = project.getProperties().get("reactNativeArchitectures")
|
||||
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
||||
buildToolsVersion getExtOrDefault('buildToolsVersion')
|
||||
ndkVersion getExtOrDefault('ndkVersion')
|
||||
compileSdkVersion safeExtGet("compileSdkVersion", 28)
|
||||
|
||||
// Used to override the NDK path/version on internal CI or by allowing
|
||||
// users to customize the NDK path/version from their root project (e.g. for M1 support)
|
||||
if (rootProject.hasProperty("ndkPath")) {
|
||||
ndkPath rootProject.ext.ndkPath
|
||||
}
|
||||
if (rootProject.hasProperty("ndkVersion")) {
|
||||
ndkVersion rootProject.ext.ndkVersion
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
prefab true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
||||
minSdkVersion safeExtGet('minSdkVersion', 21)
|
||||
targetSdkVersion safeExtGet('targetSdkVersion', 33)
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||
|
||||
if (ENABLE_FRAME_PROCESSORS) {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-fexceptions", "-frtti", "-std=c++1y", "-DONANDROID"
|
||||
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
||||
arguments '-DANDROID_STL=c++_shared',
|
||||
"-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION}",
|
||||
"-DNODE_MODULES_DIR=${nodeModules}",
|
||||
"-DFOR_HERMES=${FOR_HERMES}",
|
||||
"-DJS_RUNTIME_DIR=${jsRuntimeDir}"
|
||||
cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all"
|
||||
arguments "-DANDROID_STL=c++_shared"
|
||||
abiFilters (*reactNativeArchitectures())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
javaMaxHeapSize "4g"
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
if (ENABLE_FRAME_PROCESSORS) {
|
||||
@@ -160,128 +100,21 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
// Exclude all Libraries that are already present in the user's app (through React Native or by him installing REA)
|
||||
excludes = ["**/libc++_shared.so",
|
||||
"**/libfbjni.so",
|
||||
"**/libjsi.so",
|
||||
"**/libreactnativejni.so",
|
||||
"**/libfolly_json.so",
|
||||
"**/libreanimated.so",
|
||||
"**/libjscexecutor.so",
|
||||
"**/libhermes.so",
|
||||
"**/libfolly_runtime.so",
|
||||
"**/libglog.so",
|
||||
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
||||
excludes = [
|
||||
"META-INF",
|
||||
"META-INF/**",
|
||||
"**/libjsi.so",
|
||||
]
|
||||
// META-INF is duplicate by CameraX.
|
||||
exclude "META-INF/**"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'GradleCompatible'
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
configurations {
|
||||
extractHeaders
|
||||
extractJNI
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
|
||||
def found = false
|
||||
def defaultDir = null
|
||||
def androidSourcesName = 'React Native sources'
|
||||
|
||||
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
||||
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
||||
} else {
|
||||
defaultDir = new File(
|
||||
projectDir,
|
||||
'/../../../node_modules/react-native/android'
|
||||
)
|
||||
}
|
||||
|
||||
if (defaultDir.exists()) {
|
||||
maven {
|
||||
url defaultDir.toString()
|
||||
name androidSourcesName
|
||||
}
|
||||
|
||||
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
||||
found = true
|
||||
} else {
|
||||
def parentDir = rootProject.projectDir
|
||||
|
||||
1.upto(5, {
|
||||
if (found) return true
|
||||
parentDir = parentDir.parentFile
|
||||
|
||||
def androidSourcesDir = new File(
|
||||
parentDir,
|
||||
'node_modules/react-native'
|
||||
)
|
||||
|
||||
def androidPrebuiltBinaryDir = new File(
|
||||
parentDir,
|
||||
'node_modules/react-native/android'
|
||||
)
|
||||
|
||||
if (androidPrebuiltBinaryDir.exists()) {
|
||||
maven {
|
||||
url androidPrebuiltBinaryDir.toString()
|
||||
name androidSourcesName
|
||||
}
|
||||
|
||||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
||||
found = true
|
||||
} else if (androidSourcesDir.exists()) {
|
||||
maven {
|
||||
url androidSourcesDir.toString()
|
||||
name androidSourcesName
|
||||
}
|
||||
|
||||
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
||||
found = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
throw new GradleException(
|
||||
"${project.name}: unable to locate React Native android sources. " +
|
||||
"Ensure you have you installed React Native as a dependency in your project and try again."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
def kotlin_version = getExtOrDefault('kotlinVersion')
|
||||
|
||||
dependencies {
|
||||
implementation "com.facebook.react:react-android:"
|
||||
implementation "com.facebook.react:hermes-android:"
|
||||
|
||||
if (ENABLE_FRAME_PROCESSORS) {
|
||||
implementation project(':react-native-reanimated')
|
||||
|
||||
def jsEngine = FOR_HERMES ? "hermes" : "jsc"
|
||||
def reaAAR = "${nodeModules}/react-native-reanimated/android/react-native-reanimated-${REACT_NATIVE_VERSION}-${jsEngine}.aar"
|
||||
extractJNI(files(reaAAR))
|
||||
}
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation 'com.facebook.react:react-android:+'
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.5.2"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
||||
@@ -297,283 +130,17 @@ dependencies {
|
||||
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
||||
}
|
||||
|
||||
|
||||
if (ENABLE_FRAME_PROCESSORS) {
|
||||
// third-party-ndk deps headers
|
||||
// mostly a copy of https://github.com/software-mansion/react-native-reanimated/blob/master/android/build.gradle#L115
|
||||
def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
|
||||
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
|
||||
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
||||
def thirdPartyVersionsFile = new File("${nodeModules}/react-native/ReactAndroid/gradle.properties")
|
||||
def thirdPartyVersions = new Properties()
|
||||
thirdPartyVersions.load(new FileInputStream(thirdPartyVersionsFile))
|
||||
|
||||
def BOOST_VERSION = thirdPartyVersions["BOOST_VERSION"]
|
||||
def boost_file = new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz")
|
||||
def DOUBLE_CONVERSION_VERSION = thirdPartyVersions["DOUBLE_CONVERSION_VERSION"]
|
||||
def double_conversion_file = new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
||||
def FOLLY_VERSION = thirdPartyVersions["FOLLY_VERSION"]
|
||||
def folly_file = new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz")
|
||||
def GLOG_VERSION = thirdPartyVersions["GLOG_VERSION"]
|
||||
def glog_file = new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz")
|
||||
|
||||
task createNativeDepsDirectories {
|
||||
doLast {
|
||||
downloadsDir.mkdirs()
|
||||
thirdPartyNdkDir.mkdirs()
|
||||
// Resolves "LOCAL_SRC_FILES points to a missing file, Check that libfb.so exists or that its path is correct".
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (task.name.contains("configureCMakeDebug")) {
|
||||
rootProject.getTasksByName("packageReactNdkDebugLibs", true).forEach {
|
||||
task.dependsOn(it)
|
||||
}
|
||||
}
|
||||
|
||||
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
def transformedVersion = BOOST_VERSION.replace("_", ".")
|
||||
src("https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz")
|
||||
onlyIfNewer(true)
|
||||
overwrite(false)
|
||||
dest(boost_file)
|
||||
}
|
||||
|
||||
task prepareBoost(dependsOn: downloadBoost, type: Copy) {
|
||||
from(tarTree(resources.gzip(downloadBoost.dest)))
|
||||
from("src/main/jni/third-party/boost/Android.mk")
|
||||
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
||||
includeEmptyDirs = false
|
||||
into("$thirdPartyNdkDir") // /boost_X_XX_X
|
||||
doLast {
|
||||
file("$thirdPartyNdkDir/boost_${BOOST_VERSION}").renameTo("$thirdPartyNdkDir/boost")
|
||||
}
|
||||
}
|
||||
|
||||
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
||||
onlyIfNewer(true)
|
||||
overwrite(false)
|
||||
dest(double_conversion_file)
|
||||
}
|
||||
|
||||
task prepareDoubleConversion(dependsOn: downloadDoubleConversion, type: Copy) {
|
||||
from(tarTree(downloadDoubleConversion.dest))
|
||||
from("src/main/jni/third-party/double-conversion/Android.mk")
|
||||
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
|
||||
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
|
||||
includeEmptyDirs = false
|
||||
into("$thirdPartyNdkDir/double-conversion")
|
||||
}
|
||||
|
||||
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
||||
onlyIfNewer(true)
|
||||
overwrite(false)
|
||||
dest(folly_file)
|
||||
}
|
||||
|
||||
task prepareFolly(dependsOn: downloadFolly, type: Copy) {
|
||||
from(tarTree(downloadFolly.dest))
|
||||
from("src/main/jni/third-party/folly/Android.mk")
|
||||
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
|
||||
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
|
||||
includeEmptyDirs = false
|
||||
into("$thirdPartyNdkDir/folly")
|
||||
}
|
||||
|
||||
task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
||||
onlyIfNewer(true)
|
||||
overwrite(false)
|
||||
dest(glog_file)
|
||||
}
|
||||
|
||||
task prepareGlog(dependsOn: downloadGlog, type: Copy) {
|
||||
from(tarTree(downloadGlog.dest))
|
||||
from("src/main/jni/third-party/glog/")
|
||||
include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h")
|
||||
includeEmptyDirs = false
|
||||
filesMatching("**/*.h.in") {
|
||||
filter(ReplaceTokens, tokens: [
|
||||
ac_cv_have_unistd_h : "1",
|
||||
ac_cv_have_stdint_h : "1",
|
||||
ac_cv_have_systypes_h : "1",
|
||||
ac_cv_have_inttypes_h : "1",
|
||||
ac_cv_have_libgflags : "0",
|
||||
ac_google_start_namespace : "namespace google {",
|
||||
ac_cv_have_uint16_t : "1",
|
||||
ac_cv_have_u_int16_t : "1",
|
||||
ac_cv_have___uint16 : "0",
|
||||
ac_google_end_namespace : "}",
|
||||
ac_cv_have___builtin_expect : "1",
|
||||
ac_google_namespace : "google",
|
||||
ac_cv___attribute___noinline : "__attribute__ ((noinline))",
|
||||
ac_cv___attribute___noreturn : "__attribute__ ((noreturn))",
|
||||
ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))"
|
||||
])
|
||||
it.path = (it.name - ".in")
|
||||
}
|
||||
into("$thirdPartyNdkDir/glog")
|
||||
|
||||
doLast {
|
||||
copy {
|
||||
from(fileTree(dir: "$thirdPartyNdkDir/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files)
|
||||
includeEmptyDirs = false
|
||||
into("$thirdPartyNdkDir/glog/exported/glog")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task prepareThirdPartyNdkHeaders {
|
||||
if (!boost_file.exists()) {
|
||||
dependsOn(prepareBoost)
|
||||
}
|
||||
if (!double_conversion_file.exists()) {
|
||||
dependsOn(prepareDoubleConversion)
|
||||
}
|
||||
if (!folly_file.exists()) {
|
||||
dependsOn(prepareFolly)
|
||||
}
|
||||
if (!glog_file.exists()) {
|
||||
dependsOn(prepareGlog)
|
||||
}
|
||||
}
|
||||
|
||||
prepareThirdPartyNdkHeaders.mustRunAfter createNativeDepsDirectories
|
||||
|
||||
/*
|
||||
COPY-PASTE from react-native-reanimated.
|
||||
Vision Camera includes "hermes/hermes.h" header file in `NativeProxy.cpp`.
|
||||
Previously, we used header files from `hermes-engine` package in `node_modules`.
|
||||
Starting from React Native 0.69, Hermes is no longer distributed as package on NPM.
|
||||
On the new architecture, Hermes is downloaded from GitHub and then compiled from sources.
|
||||
However, on the old architecture, we need to download Hermes header files on our own
|
||||
as well as unzip Hermes AAR in order to obtain `libhermes.so` shared library.
|
||||
For more details, see https://reactnative.dev/architecture/bundled-hermes
|
||||
or https://github.com/reactwg/react-native-new-architecture/discussions/4
|
||||
*/
|
||||
if (!isNewArchitectureEnabled()) {
|
||||
// copied from `react-native/ReactAndroid/hermes-engine/build.gradle`
|
||||
|
||||
def customDownloadDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
|
||||
def downloadDir = customDownloadDir ? new File(customDownloadDir) : new File(reactNative, "sdks/download")
|
||||
|
||||
// By default we are going to download and unzip hermes inside the /sdks/hermes folder
|
||||
// but you can provide an override for where the hermes source code is located.
|
||||
def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: new File(reactNative, "sdks/hermes")
|
||||
|
||||
def hermesVersion = "main"
|
||||
def hermesVersionFile = new File(reactNative, "sdks/.hermesversion")
|
||||
if (hermesVersionFile.exists()) {
|
||||
hermesVersion = hermesVersionFile.text
|
||||
}
|
||||
|
||||
task downloadHermes(type: Download) {
|
||||
src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
|
||||
onlyIfNewer(true)
|
||||
overwrite(false)
|
||||
dest(new File(downloadDir, "hermes.tar.gz"))
|
||||
}
|
||||
|
||||
task unzipHermes(dependsOn: downloadHermes, type: Copy) {
|
||||
from(tarTree(downloadHermes.dest)) {
|
||||
eachFile { file ->
|
||||
// We flatten the unzip as the tarball contains a `facebook-hermes-<SHA>`
|
||||
// folder at the top level.
|
||||
if (file.relativePath.segments.size() > 1) {
|
||||
file.relativePath = new org.gradle.api.file.RelativePath(!file.isDirectory(), file.relativePath.segments.drop(1))
|
||||
}
|
||||
}
|
||||
}
|
||||
into(hermesDir)
|
||||
}
|
||||
}
|
||||
|
||||
task prepareHermes() {
|
||||
if (!isNewArchitectureEnabled()) {
|
||||
dependsOn(unzipHermes)
|
||||
}
|
||||
|
||||
doLast {
|
||||
def hermesAAR = file("$reactNative/android/com/facebook/react/hermes-engine/$REACT_NATIVE_FULL_VERSION/hermes-engine-$REACT_NATIVE_FULL_VERSION-${resolveBuildType()}.aar") // e.g. hermes-engine-0.70.0-rc.1-debug.aar
|
||||
if (!hermesAAR.exists()) {
|
||||
throw new GradleScriptException("Could not find hermes-engine AAR", null)
|
||||
}
|
||||
|
||||
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
||||
|
||||
copy {
|
||||
from soFiles
|
||||
from "$reactNative/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
||||
into "$thirdPartyNdkDir/hermes"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prepareHermes.mustRunAfter prepareThirdPartyNdkHeaders
|
||||
|
||||
task prepareJSC {
|
||||
doLast {
|
||||
def jscPackagePath = file("${nodeModules}/jsc-android")
|
||||
if (!jscPackagePath.exists()) {
|
||||
throw new GradleScriptException("Could not find the jsc-android npm package", null)
|
||||
}
|
||||
|
||||
def jscDist = file("$jscPackagePath/dist")
|
||||
if (!jscDist.exists()) {
|
||||
throw new GradleScriptException("The jsc-android npm package is missing its \"dist\" directory", null)
|
||||
}
|
||||
|
||||
def jscAAR = fileTree(jscDist).matching({ it.include "**/android-jsc/**/*.aar" }).singleFile
|
||||
def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" })
|
||||
|
||||
def headerFiles = fileTree(jscDist).matching({ it.include "**/include/*.h" })
|
||||
|
||||
copy {
|
||||
from(soFiles)
|
||||
from(headerFiles)
|
||||
from("$reactNative/ReactAndroid/src/main/jni/third-party/jsc/Android.mk")
|
||||
|
||||
filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" })
|
||||
|
||||
includeEmptyDirs(false)
|
||||
into("$thirdPartyNdkDir/jsc")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prepareJSC.mustRunAfter prepareHermes
|
||||
|
||||
task extractAARHeaders {
|
||||
doLast {
|
||||
configurations.extractHeaders.files.each {
|
||||
def file = it.absoluteFile
|
||||
copy {
|
||||
from zipTree(file)
|
||||
into "$buildDir/$file.name"
|
||||
include "**/*.h"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extractAARHeaders.mustRunAfter prepareJSC
|
||||
|
||||
task extractJNIFiles {
|
||||
doLast {
|
||||
configurations.extractJNI.files.each {
|
||||
def file = it.absoluteFile
|
||||
|
||||
copy {
|
||||
from zipTree(file)
|
||||
into "$buildDir/$file.name"
|
||||
include "jni/**/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extractJNIFiles.mustRunAfter extractAARHeaders
|
||||
|
||||
// pre-native build pipeline
|
||||
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (!task.name.contains('Clean') && (task.name.contains('externalNative') || task.name.contains('CMake'))) {
|
||||
task.dependsOn(extractJNIFiles)
|
||||
// We want to add a dependency for both configureCMakeRelease and configureCMakeRelWithDebInfo
|
||||
if (task.name.contains("configureCMakeRel")) {
|
||||
rootProject.getTasksByName("packageReactNdkReleaseLibs", true).forEach {
|
||||
task.dependsOn(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,10 @@
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g"
|
||||
org.gradle.parallel=true
|
||||
org.gradle.daemon=true
|
||||
org.gradle.configureondemand=true
|
||||
#
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
@@ -13,7 +16,7 @@
|
||||
#Fri Feb 19 20:46:14 CET 2021
|
||||
VisionCamera_buildToolsVersion=30.0.0
|
||||
VisionCamera_compileSdkVersion=31
|
||||
VisionCamera_kotlinVersion=1.5.30
|
||||
VisionCamera_kotlinVersion=1.7.20
|
||||
VisionCamera_targetSdkVersion=31
|
||||
VisionCamera_ndkVersion=21.4.7075529
|
||||
android.enableJetifier=true
|
||||
|
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
269
android/gradlew
vendored
269
android/gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,78 +17,113 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -105,79 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mrousavy.camera">
|
||||
package="com.mrousavy.camera.example">
|
||||
|
||||
</manifest>
|
||||
|
Reference in New Issue
Block a user