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 Feb 1, 2023
1 parent 522d724 commit b02f31b
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 @@ -236,6 +236,12 @@ final def preparePrefab = tasks.register("preparePrefab", PreparePrefabHeadersTa
it.outputDir.set(prefabHeadersDir)
}

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

task createNativeDepsDirectories {
downloadsDir.mkdirs()
thirdPartyNdkDir.mkdirs()
Expand Down Expand Up @@ -650,7 +656,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.assertj:assertj-core:${ASSERTJ_VERSION}")
Expand Down

0 comments on commit b02f31b

Please sign in to comment.