@@ -51,6 +51,12 @@ def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
5151// Setup build type for NDK, supported values: {debug, release}
5252def nativeBuildType = System . getenv(" NATIVE_BUILD_TYPE" ) ?: " release"
5353
54+ def prebuiltHermesDir = findProperty(" expo.prebuiltHermesDir" ) ?: file(" ${ rootDir} /prebuiltHermes" )
55+ def prebuiltHermesVersion = file(" ${ prebuiltHermesDir} /.hermesversion" ). exists() ? file(" ${ prebuiltHermesDir} /.hermesversion" ). text : null
56+ def currentHermesVersion = file(" ${ project(':ReactAndroid').projectDir} /../sdks/.hermesversion" ). exists() ? file(" ${ project(':ReactAndroid').projectDir} /../sdks/.hermesversion" ). text : null
57+ def buildHermesSource = currentHermesVersion != prebuiltHermesVersion
58+ logger. info(" :ReactAndroid - buildHermesSource[${ buildHermesSource} ]" )
59+
5460// We put the publishing version from gradle.properties inside ext. so other
5561// subprojects can access it as well.
5662ext. publishing_version = VERSION_NAME
@@ -403,7 +409,12 @@ dependencies {
403409
404410 // It's up to the consumer to decide if hermes should be included or not.
405411 // Therefore hermes-engine is a compileOnly dependency.
406- compileOnly(project(" :ReactAndroid:hermes-engine" ))
412+ if (! buildHermesSource) {
413+ debugCompileOnly(files(" ${ prebuiltHermesDir} /hermes-engine-debug.aar" ))
414+ releaseCompileOnly(files(" ${ prebuiltHermesDir} /hermes-engine-release.aar" ))
415+ } else {
416+ compileOnly(project(" :ReactAndroid:hermes-engine" ))
417+ }
407418
408419 testImplementation(" junit:junit:${ JUNIT_VERSION} " )
409420 testImplementation(" org.assertj:assertj-core:${ ASSERTJ_VERSION} " )
0 commit comments