[expo-updates] Add ability to override build-time fingerprint #27597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Generic projects (including those that do continuous native generation, CNG) are having some issues with fingerprint when built on EAS build. This is because EAS build does mutations of the native files just before build, thus generating a different logical runtime from the fingerprint perspective. (https://github.com/expo/eas-build/blob/main/packages/build-tools/src/android/expoUpdates.ts#L55 for example). #27576 was one possible solution, but this PR (in combination with a eas-build PR: expo/eas-build#361) is the better solution.
How
The way to fix this is to calculate the fingerprint ahead of native file mutation in EAS build, and then force the build step to use that fingerprint.
This PR adds this fingerprint override mechanism so that the caller who has previously calculated a fingerprint may force the build step to use their calculated one instead of calculating it at build time. This should be used cautiously since if it is used incorrectly it may end up causing runtime incompatibility.
Test Plan
eas-build
locally to set this environment variable during a build step before project modification.eas-build
local instructions. (note: need to yarn link this package in a post-install script)[RUN_GRADLEW] Using fingerprint from EXPO_UPDATES_FINGERPRINT_OVERRIDE: a8715b7f12f5736af20ed1f66daa693d37c43585
, indicating the the override is respected and usedChecklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).