diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index ab92cf0d569837..993643d3468966 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -29,6 +29,7 @@ def AAR_OUTPUT_URL = "file://${projectDir}/../android" 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 reactNativeRootDir = projectDir.parent // You need to have following folders in this directory: // - boost_1_63_0 @@ -277,7 +278,7 @@ android { externalNativeBuild { cmake { - arguments "-DREACT_COMMON_DIR=${rootProject.projectDir}/ReactCommon", + arguments "-DREACT_COMMON_DIR=${reactNativeRootDir}/ReactCommon", "-DREACT_ANDROID_DIR=$projectDir", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", diff --git a/ReactAndroid/hermes-engine/build.gradle b/ReactAndroid/hermes-engine/build.gradle index 1f29305bdfa86a..61780e38b97a2a 100644 --- a/ReactAndroid/hermes-engine/build.gradle +++ b/ReactAndroid/hermes-engine/build.gradle @@ -13,16 +13,17 @@ plugins { id("maven-publish") } +def reactNativeRootDir = project(':ReactAndroid').projectDir.parent; def customDownloadDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR") -def downloadsDir = customDownloadDir ? new File(customDownloadDir) : rootProject.file("sdks/download") +def downloadsDir = customDownloadDir ? new File(customDownloadDir) : new File(reactNativeRootDir, "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 overrideHermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") != null -def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: rootProject.file("sdks/hermes") +def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: new File(reactNativeRootDir, "sdks/hermes") def hermesVersion = "main" -def hermesVersionFile = rootProject.file("sdks/.hermesversion") +def hermesVersionFile = new File(reactNativeRootDir, "sdks/.hermesversion") if (hermesVersionFile.exists()) { hermesVersion = hermesVersionFile.text } @@ -34,7 +35,7 @@ def prefabHeadersDir = new File("$buildDir/prefab-headers") def skipPrefabPublishing = System.getenv("REACT_NATIVE_HERMES_SKIP_PREFAB") != null // We inject the JSI directory used inside the Hermes build with the -DJSI_DIR config. -def jsiDir = rootProject.file("ReactCommon/jsi") +def jsiDir = new File(reactNativeRootDir, "ReactCommon/jsi") // The .aar is placed inside the ./android folder at the top level. // There it will be placed alongside the React Android .aar