Skip to content

Commit

Permalink
[android] Support caching prebuilt hermes-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Kudo committed Jun 23, 2022
1 parent 86c2818 commit 8bb810c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
// Setup build type for NDK, supported values: {debug, release}
def nativeBuildType = System.getenv("NATIVE_BUILD_TYPE") ?: "release"

def prebuiltHermesDir = findProperty("expo.prebuiltHermesDir") ?: file("${projectDir}/prebuiltHermes")
def prebuiltHermesVersion = file("${prebuiltHermesDir}/.hermesversion").exists() ? file("${prebuiltHermesDir}/.hermesversion").text : null
def currentHermesVersion = file("${rootDir}/sdks/.hermesversion").exists() ? file("${rootDir}/sdks/.hermesversion").text : null
def buildHermesSource = currentHermesVersion != prebuiltHermesVersion
logger.info(":ReactAndroid - buildHermesSource[${buildHermesSource}]")

// We put the publishing version from gradle.properties inside ext. so other
// subprojects can access it as well.
ext.publishing_version = VERSION_NAME
Expand Down Expand Up @@ -395,7 +401,12 @@ dependencies {

// 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"))
if (!buildHermesSource) {
debugCompileOnly(files("${prebuiltHermesDir}/hermes-engine-debug.aar"))
releaseCompileOnly(files("${prebuiltHermesDir}/hermes-engine-release.aar"))
} else {
compileOnly(project(":ReactAndroid:hermes-engine"))
}

testImplementation("junit:junit:${JUNIT_VERSION}")
testImplementation("org.powermock:powermock-api-mockito2:${POWERMOCK_VERSION}")
Expand Down

0 comments on commit 8bb810c

Please sign in to comment.