Skip to content

[build] - preflight check for stale autolinked Android native modules#3701

Open
AbbanMustafa wants to merge 1 commit into
mainfrom
mus/and-native-modules
Open

[build] - preflight check for stale autolinked Android native modules#3701
AbbanMustafa wants to merge 1 commit into
mainfrom
mus/and-native-modules

Conversation

@AbbanMustafa
Copy link
Copy Markdown
Contributor

@AbbanMustafa AbbanMustafa commented May 8, 2026

Why

~250+ Android builds fail per day with "No variants exist" because the user has android/ committed to git, which triggers the GENERIC workflow and skips prebuild.

The native project is stale (new native dependencies were added or the SDK was upgraded without re-running prebuild) so Gradle fails at config time when useReactNativeModules() tries to include modules that can't resolve against the stale native project.

https://app.datadoghq.com/logs?query=%22No%20variants%20exist%22&agg_m=count&agg_m_source=base&agg_t=count&cols=host%2Cservice&messageDisplay=inline&refresh_mode=sliding&storage=hot&stream_sort=desc&viz=stream&from_ts=1778019603930&to_ts=1778278803930&live=true

How

Added a checkAutolinkedNativeModulesAsync() preflight check in validate.ts that runs for GENERIC workflow Android builds, wired up in createAndroidContextAsync() alongside the existing checks.

The check:

  1. Gates on Workflow.GENERIC (managed workflow runs prebuild automatically)
  2. Reads android/settings.gradle(.kts) to confirm autolinking is configured
  3. Runs npx react-native config to discover expected autolinked Android dependencies
  4. Verifies each dependency's sourceDir and build.gradle(.kts) exist on disk
  5. Warns with actionable guidance if issues are found (run npx expo prebuild --clean or switch to managed workflow)

Fails silently if react-native config errors — this is a best-effort check that avoids blocking users when the RN CLI isn't available.

Test Plan

  • Verify existing builds still work (no false positives on healthy GENERIC projects)
  • Test with a stale GENERIC project: commit android/, add a new native dependency without rerunning prebuild, confirm warning appears
  • Test managed workflow project: confirm check is skipped
  • Test project without autolinking in settings.gradle: confirm check is skipped

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Subscribed to pull request

File Patterns Mentions
**/* @douglowder
packages/eas-cli/src/build/** @sjchmiela

Generated by CodeMention

@AbbanMustafa AbbanMustafa added the no changelog PR that doesn't require a changelog entry label May 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 4.00000% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.52%. Comparing base (4eb0753) to head (b507ba9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/eas-cli/src/build/validate.ts 4.09% 47 Missing ⚠️
packages/eas-cli/src/build/android/build.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3701      +/-   ##
==========================================
- Coverage   56.56%   56.52%   -0.04%     
==========================================
  Files         888      888              
  Lines       38468    38540      +72     
  Branches     8022     8039      +17     
==========================================
+ Hits        21756    21780      +24     
- Misses      16614    16662      +48     
  Partials       98       98              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant