@@ -46,6 +46,12 @@ def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
4646// Setup build type for NDK, supported values: {debug, release}
4747def nativeBuildType = System . getenv(" NATIVE_BUILD_TYPE" ) ?: " release"
4848
49+ def prebuiltHermesDir = findProperty(" expo.prebuiltHermesDir" ) ?: file(" ${ projectDir} /prebuiltHermes" )
50+ def prebuiltHermesVersion = file(" ${ prebuiltHermesDir} /.hermesversion" ). exists() ? file(" ${ prebuiltHermesDir} /.hermesversion" ). text : null
51+ def currentHermesVersion = file(" ${ rootDir} /sdks/.hermesversion" ). exists() ? file(" ${ rootDir} /sdks/.hermesversion" ). text : null
52+ def buildHermesSource = currentHermesVersion != prebuiltHermesVersion
53+ logger. info(" :ReactAndroid - buildHermesSource[${ buildHermesSource} ]" )
54+
4955// We put the publishing version from gradle.properties inside ext. so other
5056// subprojects can access it as well.
5157ext. publishing_version = VERSION_NAME
@@ -395,7 +401,12 @@ dependencies {
395401
396402 // It's up to the consumer to decide if hermes should be included or not.
397403 // Therefore hermes-engine is a compileOnly dependency.
398- compileOnly(project(" :ReactAndroid:hermes-engine" ))
404+ if (! buildHermesSource) {
405+ debugCompileOnly(files(" ${ prebuiltHermesDir} /hermes-engine-debug.aar" ))
406+ releaseCompileOnly(files(" ${ prebuiltHermesDir} /hermes-engine-release.aar" ))
407+ } else {
408+ compileOnly(project(" :ReactAndroid:hermes-engine" ))
409+ }
399410
400411 testImplementation(" junit:junit:${ JUNIT_VERSION} " )
401412 testImplementation(" org.powermock:powermock-api-mockito2:${ POWERMOCK_VERSION} " )
0 commit comments