discussions-and-proposals
discussions-and-proposals copied to clipboard
How can I throw error when build without js engine?
Introduction
gradle build succeeds regardless of whether the JS engine is included or not. However, since react native app requires JS engine, I want to be able to check whether it is included in the build process.
Details
// android/app/build.gradle
dependencies {
...
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
...
}
According to this implementation, if I select custom build type(e.g. staging, releaseE2E) and enableHermes is true, we can get react native app without js engine.
This app cannot run due to the absence of the JS engine, but does not generate any errors during build process.
I solved this error by adding implementation for custom build type, like releaseE2EImplementation files(hermesPath + "hermes-release.aar"). But, because I have no idea about gradle, it took me too long to realize it.
So, I want the app to know during the build if it builds with a JS engine. If not, throw error about it.
Discussion points
Same as title of Issue. How can I throw error when build without js engine?