Repository navigation
Fix Hermes configuration after the source directory changes - #59514
shamilovtim wants to merge 1 commit into
Conversation
|
Thanks for submitting the fix. But can I ask why do you compile hermes from source instead of consuming the precompiled binary we ship? |
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D127786953. |
|
@cipolleschi The default Expo + React Native build setup couples RN source builds to Hermes source builds. I had some custom RN functionality that required compiling RN from source (including the Reanimated experimental perf feature flags) and the Hermes source build came in that way it. It looks like this can be bypassed with patches and codemods, so it's something I might clean up on my end. But to my knowledge the thing to be aware of is that anyone using the Reanimated feature flags with React Native build from source + Expo is going to have this same setup. |
Author's note
Hello maintainers, I have to run this patch on
react-native@0.88.0, otherwise Android source builds won't compile. Please consider a patch release addressing this issue so other users can benefit.Summary
Fixes #59513
Building Hermes from source fails when its CMake build directory contains a cache from a previous source location. CMake rejects the old path before compilation starts.
Clear
CMakeCache.txtandCMakeFilesbefore either Hermes configure task executes. Gradle still skips the task when nothing changes. Use file cleanup so theCMAKE_VERSION=3.22.1override continues to work. That CMake version does not support--fresh.The reported failure came from a pnpm 12.3.4 monorepo with ccache 4.14.2 enabled for native compilation. The source-only reproducer runs in an upstream checkout.
Changelog
[ANDROID] [FIXED] - Fix Hermes source builds failing after the source directory changes.
Test plan
UP-TO-DATE../gradlew -p packages/gradle-plugin build -PenableWarningsAsErrors=true. All 285 tests passed. SetJAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/private/tmp/react-native-hermes-gradle-teststo avoid an existing macOS/varversus/private/varpath assertion failure.yarn format-check-kotlinandgit diff --check.configureBuildForHermesandconfigureBuildForHermesWithDebuggerwithCMAKE_VERSION=3.22.1andCMAKE_VERSION=3.30.5. Both variants passed, and repeated calls stayedUP-TO-DATE.:packages:react-native:ReactAndroid:hermes-engine:buildHermesCand compiled a JavaScript file to bytecode with the resulting compiler.:packages:react-native:ReactAndroid:hermes-engine:assembleReleasefor arm64. The release AAR built successfully. Repeated host configuration and compiler tasks stayedUP-TO-DATE.buildHermesC. All 239 existing Hermes object files kept their modification times.Native commands used
-Preact.internal.useHermesNightly=false -PreactNativeArchitectures=arm64-v8a. Validation ran on macOS arm64 with JDK 17.0.20. Windows and Linux builds were not run.