Skip to content

feat: support module_version for add-to-app AAR releases#3674

Open
eseidel wants to merge 1 commit intomainfrom
feat/aar-release-version
Open

feat: support module_version for add-to-app AAR releases#3674
eseidel wants to merge 1 commit intomainfrom
feat/aar-release-version

Conversation

@eseidel
Copy link
Copy Markdown
Contributor

@eseidel eseidel commented Apr 2, 2026

Summary

  • When --release-version is omitted for AAR releases, default to git commit short hash as both the server-side release version and the module version baked into the AAR
  • Pass module version to flutter build aar via SHOREBIRD_MODULE_VERSION env var; the Flutter tool writes it as module_version into the compiled shorebird.yaml
  • Add moduleVersion field to ShorebirdYaml schema (so the CLI accepts the field)
  • Add moduleVersion field to PatchCheckRequest protocol
  • Require Flutter >= 3.41.4 when --release-version is omitted (older Flutter ignores the env var)
  • Add moduleVersion parameter to buildAar() in artifact builder

Context

Addresses #793 — enables add-to-app (AAR) use cases where the same Flutter module is embedded in multiple host apps with different version numbers.

release_version always stays the host app's version (for clean analytics). module_version is a separate optional field used only for patch lookup.

Companion PRs:

Test plan

  • assertArgsAreValid tests for Flutter version gating and git hash resolution
  • getReleaseVersion tests for explicit and git-hash paths
  • shorebird_yaml_test for module_version deserialization
  • Verify non-AAR releases are unaffected

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...orebird_cli/lib/src/commands/release/releaser.dart 91.42% 3 Missing ⚠️
...cli/lib/src/artifact_builder/artifact_builder.dart 71.42% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
@eseidel eseidel marked this pull request as ready for review April 2, 2026 22:25
@eseidel eseidel requested a review from bdero April 2, 2026 22:25
@eseidel eseidel changed the title feat: decouple AAR release version from host app version feat: support module_version for add-to-app AAR releases Apr 2, 2026
Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
Comment thread packages/shorebird_cli/lib/src/commands/release/aar_releaser.dart Outdated
@bdero
Copy link
Copy Markdown
Member

bdero commented Apr 3, 2026

release_version always stays the host app's version (for clean analytics). module_version is a separate optional field used only for patch lookup.

Can you describe the full workflow you're intending a customer to follow so I can wrap my mind around how this solution fully addresses the problem?

If customer CoolCustomer has two apps NeatApp and AwesomeApp which both embed a shorebird-enabled AAR Flutter module SocialModule, and CoolCustomer wants to release a bugfix in SocialModule across their two apps at the same time... how do they set up the releases ahead of time and what does patch creation look like?

Is the intent to have the user generate separate Shorebird releases for NeatApp and AwesomeApp, but with a shared module version for SocialModule & hopefully identical code (for the purposes of making stuff like MAU maximally useful), thereby allowing the user to create one patch that will distribute to all releases attributed to the SocialModule module version?

@eseidel
Copy link
Copy Markdown
Contributor Author

eseidel commented Apr 3, 2026

My expectation would be that if customer has apps A and B and module M, they would build module M once, and then embed it into A and B as though it were a 3p dependency (already comes prebuilt). Thus M would end up with the same module_version in our system, and when they send a patch to M, it would appear in both A and B?

@eseidel
Copy link
Copy Markdown
Contributor Author

eseidel commented Apr 3, 2026

So shorebird release aar --module-version=git take the output, and put it wherever it goes for your other two apps to consume and then they just get each built with gradel (or XCode) as before.

When you want to patch, you just then run shorebird patch aar --module-version=latest (I think I have to add that component).

I think I need to get a full setup working locally (although I'm not entirely sure I can do that before landing at least the server bits) to verify.

Adds --module-version (and aligned --release-version) to the AAR and
iOS framework release flows for add-to-app integrations:

- shorebird_cli: shared resolveModuleReleaseVersionArgs / moduleReleaseVersion
  helpers on Releaser, used by aar_releaser and ios_framework_releaser.
  --module-version=git resolves to the project's git HEAD; the resolved
  module version is passed to flutter build via SHOREBIRD_MODULE_VERSION.
- shorebird_code_push_protocol: PatchCheckRequest.moduleVersion field, so
  the server can look up patches by the module-version baked into the AAR.
- shorebird_yaml: optional module_version field for embedding a default.
@eseidel eseidel force-pushed the feat/aar-release-version branch from 71035f8 to 61c40b9 Compare May 1, 2026 17:44
eseidel added a commit to shorebirdtech/flutter that referenced this pull request May 1, 2026
Adds SHOREBIRD_MODULE_VERSION env var support to compileShorebirdYaml.
When set, the value is written into the compiled shorebird.yaml as
module_version, which the updater then sends to the server (alongside
release_version) for add-to-app patch lookup.

The shorebird CLI passes this env var through when running
`flutter build aar` or `flutter build ios-framework` for module
releases (see shorebirdtech/shorebird#3674).
eseidel added a commit to shorebirdtech/flutter that referenced this pull request May 1, 2026
Adds SHOREBIRD_MODULE_VERSION env var support to compileShorebirdYaml.
When set, the value is written into the compiled shorebird.yaml as
module_version, which the updater then sends to the server (alongside
release_version) for add-to-app patch lookup.

The shorebird CLI passes this env var through when running
`flutter build aar` or `flutter build ios-framework` for module
releases (see shorebirdtech/shorebird#3674).
@bdero
Copy link
Copy Markdown
Member

bdero commented May 4, 2026

Triage: Eric is writing a PRD for this at the moment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants