Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a BoM compatibility table to repository #12662

Merged
merged 43 commits into from May 7, 2024
Merged

Conversation

Lyokone
Copy link
Contributor

@Lyokone Lyokone commented Apr 17, 2024

Description

This PR allows binding a set of Firebase plugin versions into a single parent version named a BoM (Bill of Materials) version - an overarching version that internally specifies all versions of the FlutterFire packages that work together for that BoM release (much like Android).

This PR adds a Melos script bom which updates 2 files:

  • versions.json which is a JSON file that can be consumed externally (e.g. the FlutterFire CLI) to get a match between a BoM version and all the other Flutter plugin versions and Firebase SDK versions
  • VERSIONS.md which is a readable display version of the same information

The contributing guide has been updated with instructions on how to run a BoM release. A BoM release can be run at any time. We use Melos (melos bom) to automatically suggest the next BoM version number (based on the types of package version changes between the last BoM version and now) but it can also be overridden manually (melos bom [customVersion]).

A typical BoM would look like:

guillaume@macbook $ melos bom
New BoM version number (0.2.0): 0.2.0
JSON version data has been successfully written to scripts/versions.json
Version 0.2.0 has been generated successfully!

Why do we need this?

To solve customer pain points in regards to using compatible versions of the FlutterFire set of plugins together, e.g. this tweet.

Some alternatives have been considered in the past:

  • Pub has no concept of peer dependencies, so we can't specify optional dependencies and their versions and have pub enforce that you use the right versions together, see Support peer dependencies  dart-lang/pub#1837
  • We could make all packages have the same version numbering but you'd get versions of packages getting bumped even with no changes just to keep them the same version number, getting us quickly to the max 1000 versions of a package limit pub has and also getting us to the pub rate limiting of publishing too many packages at once.
  • We could make a new package that depends on all the FlutterFire packages with the correct exact versions specified and you just use that package instead, and, while that would work there's the issue that your Dart code would get tree shaken to remove code for FlutterFire packages you don't actually use but the native parts of the FlutterFire plugins won't since they all get built and included in your app by flutter regardless of whether you use them in Dart or not because of how the plugin system in Flutter works, so you end up with every single Firebase service included in your native build.

Recently however we've been in a good position where the FlutterFire CLI has become the defacto way to do a bunch of things with FlutterFire and so we're able to explore solving problems like this with the CLI instead.

@Lyokone Lyokone marked this pull request as draft April 17, 2024 12:12
@Lyokone Lyokone added the blocked: do-not-merge PR blocked externally label Apr 17, 2024
version.md Outdated Show resolved Hide resolved
version.md Outdated Show resolved Hide resolved
version.mdx Outdated Show resolved Hide resolved
@Lyokone Lyokone removed the blocked: do-not-merge PR blocked externally label Apr 18, 2024
@Lyokone Lyokone changed the title chore: proposal for version compatibility table chore: add a compatibility table to repository Apr 18, 2024
@Lyokone Lyokone changed the title chore: add a compatibility table to repository chore: add a BoM compatibility table to repository Apr 18, 2024
@Lyokone Lyokone marked this pull request as ready for review April 18, 2024 08:56
Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just a few things from me 👍

versions.mdx Outdated Show resolved Hide resolved
@Salakar
Copy link
Member

Salakar commented Apr 18, 2024

Based on chats internally my feedback would be:

  • can we write the script in Dart, we already have a root pubspec, no extra files or setup needed other than the script file, others not familiar with bash can pick up making changes safely + code would work on any platform, e.g. Windows
  • rename versions.mdx to VERSIONS.md to match naming convention of other root MD files
  • move versions json out to a separate json file, perhaps next to the script, e.g. ./scripts/versions.json
  • detach BoM versioning away from main release process, allow us to run normal releases regularly and group a bunch of releases into a single BoM at a different schedule to regular releases, e.g. around key events such as I/O
  • BoM versions auto determined based on diff of versions of packages in last BoM vs versions of packages now to be used in new BoM, e.g. if any packages had a breaking change then BoM would be major, same with minor & patch

scripts/generate_bom.dart Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
@Lyokone Lyokone merged commit c496756 into master May 7, 2024
20 of 23 checks passed
@Lyokone Lyokone deleted the chore/proposal branch May 7, 2024 12:14
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.

None yet

7 participants