feat: support module_version for add-to-app AAR releases#3674
feat: support module_version for add-to-app AAR releases#3674
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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? |
|
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? |
|
So When you want to patch, you just then run 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.
71035f8 to
61c40b9
Compare
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).
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).
|
Triage: Eric is writing a PRD for this at the moment. |
Summary
--release-versionis omitted for AAR releases, default to git commit short hash as both the server-side release version and the module version baked into the AARflutter build aarviaSHOREBIRD_MODULE_VERSIONenv var; the Flutter tool writes it asmodule_versioninto the compiledshorebird.yamlmoduleVersionfield toShorebirdYamlschema (so the CLI accepts the field)moduleVersionfield toPatchCheckRequestprotocol--release-versionis omitted (older Flutter ignores the env var)moduleVersionparameter tobuildAar()in artifact builderContext
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_versionalways stays the host app's version (for clean analytics).module_versionis a separate optional field used only for patch lookup.Companion PRs:
Test plan
assertArgsAreValidtests for Flutter version gating and git hash resolutiongetReleaseVersiontests for explicit and git-hash pathsshorebird_yaml_testformodule_versiondeserialization