Skip to content

Fix Hermes compiler detection for monorepos#57086

Open
ya-nsh wants to merge 1 commit into
facebook:mainfrom
ya-nsh:fix/hermesc-monorepo-detection
Open

Fix Hermes compiler detection for monorepos#57086
ya-nsh wants to merge 1 commit into
facebook:mainfrom
ya-nsh:fix/hermesc-monorepo-detection

Conversation

@ya-nsh
Copy link
Copy Markdown
Contributor

@ya-nsh ya-nsh commented Jun 5, 2026

Summary

Fixes Hermes compiler autodetection for Android apps whose Gradle project root is nested below the workspace root, such as monorepos with hoisted node_modules.

The Gradle plugin already exposes reactNativeDir, but Hermes autodetection only looked under react.root. That means release bundling can fail even when both reactNativeDir and the hoisted hermes-compiler package are correctly installed and resolvable from the configured React Native package directory.

This change:

  • passes reactNativeDir into Hermes compiler detection
  • checks built-from-source Hermes under the configured React Native package directory
  • checks the hoisted hermes-compiler package next to the configured React Native package directory
  • preserves explicit react.hermesCommand and project-local Hermes precedence
  • replaces the stale failure message pointing at node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc with the actual checked locations

Closes #55673
Closes #54944

Test plan

./gradlew -p packages/gradle-plugin/react-native-gradle-plugin test --tests com.facebook.react.utils.PathUtilsTest
./gradlew -p packages/gradle-plugin/react-native-gradle-plugin test
./gradlew -p packages/gradle-plugin/react-native-gradle-plugin check

Changelog:

[ANDROID] [FIXED] - Fix Hermes compiler autodetection for monorepos with hoisted node_modules

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 5, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

1 participant