Skip to content

[build-tools] Make configure-version gradle script compatible with AGP 9 - #4155

Open
gabrieldonadel wants to merge 4 commits into
mainfrom
@gabrieldonadel/agp-9
Open

[build-tools] Make configure-version gradle script compatible with AGP 9#4155
gabrieldonadel wants to merge 4 commits into
mainfrom
@gabrieldonadel/agp-9

Conversation

@gabrieldonadel

Copy link
Copy Markdown
Member

Why

EAS injects an eas-build.gradle script into Android projects to set versionCode and versionName from the build job. That script sets per-output overrides through applicationVariants.all. AGP 9 removes the applicationVariants API from the new DSL, so the injected script breaks the Gradle configuration for project using react-native 0.87

How

The defaultConfig assignments stay unchanged. The per-output override block moves out of the android {} block and now picks an API at runtime:

  • If the android extension still exposes applicationVariants (AGP 8 and older), the script keeps the existing versionCodeOverride / versionNameOverride path.
  • Otherwise it uses the androidComponents.onVariants variant API and sets the versionCode / versionName properties on each output.

Test Plan

CI should be green

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.47%. Comparing base (d98d26d) to head (27dd2b4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4155   +/-   ##
=======================================
  Coverage   62.47%   62.47%           
=======================================
  Files        1008     1008           
  Lines       45772    45772           
  Branches     9631     9631           
=======================================
  Hits        28590    28590           
  Misses      15721    15721           
  Partials     1461     1461           

☔ View full report in Codecov by Harness.
📢 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.

@gabrieldonadel
gabrieldonadel force-pushed the @gabrieldonadel/agp-9 branch from 7d28abf to 853c234 Compare August 5, 2026 22:02
@brentvatne brentvatne added the ai-review Commits pushed to PRs with this label be automatically reviewed. label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

🤖 AI code review

Decision: Approve

Overall PR risk: High. The change modifies existing behavior: the generated eas-build-configure-version.gradle script, which runs on every EAS Android build. It moves the per-output version override out of the android {} block and picks an API at runtime based on whether applicationVariants exists. No reviewer found a concrete defect, but the blast radius is broad because the script applies to all Android builds that set versionCode or versionName. The most plausible failure is at build time in customer projects, not in unit tests: if the android extension lookup fails, or if the AGP 9 onVariants branch runs too late or the output properties are not writable, builds could fail or silently publish the wrong version. Rollback is simple (a template revert and redeploy), but detection would lag because CI does not exercise the generated script against real AGP 9 projects.

No findings.


This review is advisory — it never blocks a merge and never auto-approves.

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

Labels

ai-review Commits pushed to PRs with this label be automatically reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants