Skip to content

Commit c496756

Browse files
LyokoneSalakar
andauthored
chore: add a BoM compatibility table to repository (#12662)
* chore: proposal for version compatibility table * json data * update * update * add sdk version to JSON * script * contributing guide * ready * comments * comments * remove trailing comma * in dart * remove sh * use script to generate * use script to generate * move files * update contributing * chore: BoM Version 1.2.0 * casing * casing * update regexp to Dart, packages key * chore: BoM Version * chore: BoM Version 0.2.0 * automatic boM * typo * chore: BoM Version 0.1.0 * chore: BoM Version 0.1.0 * chore: BoM Version 0.1.0 * chore: BoM Version 0.1.0 * chore: BoM Version 0.1.0 * using melos in more places * remove pubspec_parse * remove pacakge list * remove pacakge list * add licence * use arguments * print * Apply suggestions from code review * chore: BoM Version 0.2.0 * suggested version --------- Co-authored-by: Mike Diarmid <[email protected]>
1 parent c5bdebc commit c496756

File tree

7 files changed

+500
-5
lines changed

7 files changed

+500
-5
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,24 @@ Some things to keep in mind before publishing the release:
304304
5. Push your branch to git running `git push origin [RELEASE BRANCH NAME]`.
305305
6. Run `melos version` to automatically version packages and update Changelogs.
306306
7. Run `melos publish` to dry run and confirm all packages are publishable.
307-
8. Run `git push origin [RELEASE BRANCH NAME]` & open pull request for review on GitHub.
308-
9. After successful review and merge of the pull request, switch to `master` branch locally, & run `git pull origin master`.
309-
10. Run `melos publish --no-dry-run` to now publish to Pub.dev.
310-
11. Run `git push --tags` to push tags to repository.
311-
12. Ping @kevinthecheung to get the changelog in Firebase releases.
307+
8. Run `melos bom [optional-version]` to update the `VERSIONS.md` and `scripts/versions.json` files.
308+
9. Run `git push origin [RELEASE BRANCH NAME]` & open pull request for review on GitHub.
309+
10. After successful review and merge of the pull request, switch to `master` branch locally, & run `git pull origin master`.
310+
11. Run `melos publish --no-dry-run` to now publish to Pub.dev.
311+
12. Run `git push --tags` to push tags to repository.
312+
13. Ping @kevinthecheung to get the changelog in Firebase releases.
313+
314+
### Run a BoM release only...
315+
316+
1. Switch to `master` branch locally.
317+
2. Run `git pull origin master`.
318+
3. Run `git pull --tags` to make sure all tags are fetched.
319+
4. Create new branch with the signature "release/[year]-[month]-[day]-BoM".
320+
5. Run `melos bom [optional-version]` to update the `VERSIONS.md` and `scripts/versions.json` files.
321+
6. Push your branch to git running `git push origin [RELEASE BRANCH NAME]`.
322+
7. After successful review and merge of the pull request, switch to `master` branch locally, & run `git pull origin master`.
323+
8. Run `git push --tags` to push tags to repository.
324+
9. Ping @kevinthecheung to get the changelog in Firebase releases.
312325

313326
### Graduate packages
314327

VERSIONS.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# FlutterFire Compatible Versions
2+
3+
This document is listing all the compatible versions of the FlutterFire plugins. This document is updated whenever a new version of the FlutterFire plugins is released.
4+
5+
# Versions
6+
7+
## [Flutter BoM 0.2.0 (2024-04-23)](https://github.com/firebase/flutterfire/blob/master/CHANGELOG.md#2024-04-23)
8+
9+
<!--- When ready can be included
10+
Install this version using FlutterFire CLI
11+
12+
```bash
13+
flutterfire install 0.2.0
14+
```
15+
-->
16+
17+
### Included Native Firebase SDK Versions
18+
| Firebase SDK | Version | Link |
19+
|--------------|---------|------|
20+
| Android SDK | 32.8.0 | [Release Notes](https://firebase.google.com/support/release-notes/android) |
21+
| iOS SDK | 10.24.0 | [Release Notes](https://firebase.google.com/support/release-notes/ios) |
22+
| Web SDK | 10.11.0 | [Release Notes](https://firebase.google.com/support/release-notes/js) |
23+
| Windows SDK | 11.6.0 | [Release Notes](https://firebase.google.com/support/release-notes/cpp-relnotes) |
24+
25+
### FlutterFire Plugin Versions
26+
| Plugin | Version |
27+
|--------|---------|
28+
| [cloud_firestore](https://pub.dev/packages/cloud_firestore/versions/4.17.1) | 4.17.1 |
29+
| [cloud_functions](https://pub.dev/packages/cloud_functions/versions/4.7.3) | 4.7.3 |
30+
| [firebase_analytics](https://pub.dev/packages/firebase_analytics/versions/10.10.3) | 10.10.3 |
31+
| [firebase_app_check](https://pub.dev/packages/firebase_app_check/versions/0.2.2+3) | 0.2.2+3 |
32+
| [firebase_app_installations](https://pub.dev/packages/firebase_app_installations/versions/0.2.5+3) | 0.2.5+3 |
33+
| [firebase_auth](https://pub.dev/packages/firebase_auth/versions/4.19.3) | 4.19.3 |
34+
| [firebase_core](https://pub.dev/packages/firebase_core/versions/2.30.1) | 2.30.1 |
35+
| [firebase_crashlytics](https://pub.dev/packages/firebase_crashlytics/versions/3.5.3) | 3.5.3 |
36+
| [firebase_database](https://pub.dev/packages/firebase_database/versions/10.5.3) | 10.5.3 |
37+
| [firebase_dynamic_links](https://pub.dev/packages/firebase_dynamic_links/versions/5.5.3) | 5.5.3 |
38+
| [firebase_in_app_messaging](https://pub.dev/packages/firebase_in_app_messaging/versions/0.7.5+3) | 0.7.5+3 |
39+
| [firebase_messaging](https://pub.dev/packages/firebase_messaging/versions/14.9.0) | 14.9.0 |
40+
| [firebase_ml_model_downloader](https://pub.dev/packages/firebase_ml_model_downloader/versions/0.2.5+3) | 0.2.5+3 |
41+
| [firebase_performance](https://pub.dev/packages/firebase_performance/versions/0.9.4+3) | 0.9.4+3 |
42+
| [firebase_remote_config](https://pub.dev/packages/firebase_remote_config/versions/4.4.3) | 4.4.3 |
43+
| [firebase_storage](https://pub.dev/packages/firebase_storage/versions/11.7.3) | 11.7.3 |
44+
45+
46+
## [Flutter BoM 0.1.0 (2024-04-16)](https://github.com/firebase/flutterfire/blob/master/CHANGELOG.md#2024-04-16)
47+
48+
<!--- When ready can be included
49+
Install this version using FlutterFire CLI
50+
51+
```bash
52+
flutterfire install 0.1.0
53+
```
54+
-->
55+
56+
### Included Native Firebase SDK Versions
57+
| Firebase SDK | Version | Link |
58+
|--------------|---------|------|
59+
| Android SDK | 32.8.0 | [Release Notes](https://firebase.google.com/support/release-notes/android) |
60+
| iOS SDK | 10.24.0 | [Release Notes](https://firebase.google.com/support/release-notes/ios) |
61+
| Web SDK | 10.10.0 | [Release Notes](https://firebase.google.com/support/release-notes/js) |
62+
| Windows SDK | 11.6.0 | [Release Notes](https://firebase.google.com/support/release-notes/cpp-relnotes) |
63+
64+
### FlutterFire Plugin Versions
65+
| Plugin | Version |
66+
|--------|---------|
67+
| [cloud_firestore](https://pub.dev/packages/cloud_firestore/versions/4.17.0) | 4.17.0 |
68+
| [cloud_functions](https://pub.dev/packages/cloud_functions/versions/4.7.2) | 4.7.2 |
69+
| [firebase_analytics](https://pub.dev/packages/firebase_analytics/versions/10.10.2) | 10.10.2 |
70+
| [firebase_app_check](https://pub.dev/packages/firebase_app_check/versions/0.2.2+2) | 0.2.2+2 |
71+
| [firebase_app_installations](https://pub.dev/packages/firebase_app_installations/versions/0.2.5+2) | 0.2.5+2 |
72+
| [firebase_auth](https://pub.dev/packages/firebase_auth/versions/4.19.2) | 4.19.2 |
73+
| [firebase_core](https://pub.dev/packages/firebase_core/versions/2.30.0) | 2.30.0 |
74+
| [firebase_crashlytics](https://pub.dev/packages/firebase_crashlytics/versions/3.5.2) | 3.5.2 |
75+
| [firebase_database](https://pub.dev/packages/firebase_database/versions/10.5.2) | 10.5.2 |
76+
| [firebase_dynamic_links](https://pub.dev/packages/firebase_dynamic_links/versions/5.5.2) | 5.5.2 |
77+
| [firebase_in_app_messaging](https://pub.dev/packages/firebase_in_app_messaging/versions/0.7.5+2) | 0.7.5+2 |
78+
| [firebase_messaging](https://pub.dev/packages/firebase_messaging/versions/14.8.2) | 14.8.2 |
79+
| [firebase_ml_model_downloader](https://pub.dev/packages/firebase_ml_model_downloader/versions/0.2.5+2) | 0.2.5+2 |
80+
| [firebase_performance](https://pub.dev/packages/firebase_performance/versions/0.9.4+2) | 0.9.4+2 |
81+
| [firebase_remote_config](https://pub.dev/packages/firebase_remote_config/versions/4.4.2) | 4.4.2 |
82+
| [firebase_storage](https://pub.dev/packages/firebase_storage/versions/11.7.2) | 11.7.2 |
83+
84+

melos.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,7 @@ scripts:
317317
--ignore "**/flutter/generated_plugin_registrant.cc" \
318318
.
319319
description: Add a license header to all necessary files.
320+
321+
bom:
322+
run: dart scripts/generate_bom.dart
323+
description: Generate a Bill of Materials (BOM) file for all packages.

pubspec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ environment:
44
sdk: '>=2.18.0 <4.0.0'
55

66
dev_dependencies:
7+
cli_util: ^0.4.1
8+
glob: ^2.1.2
9+
intl: ^0.19.0
710
melos: ^5.3.0
11+
pub_semver: ^2.1.4

scripts/bom_analysis.dart

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Copyright 2024 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
// ignore_for_file: avoid_print
5+
6+
import 'dart:convert';
7+
import 'dart:io';
8+
9+
import 'package:cli_util/cli_logging.dart' as logging;
10+
import 'package:glob/glob.dart';
11+
import 'package:melos/melos.dart' as melos;
12+
import 'package:pub_semver/pub_semver.dart' as melos;
13+
14+
import 'generate_bom.dart';
15+
16+
void main(List<String> arguments) async {
17+
final newBoMVersion = await getBoMNextVersion(shouldLog: true);
18+
if (newBoMVersion == null) {
19+
print('No changes detected');
20+
} else {
21+
print('New BoM Version: $newBoMVersion');
22+
}
23+
}
24+
25+
Future<melos.MelosWorkspace> getMelosWorkspace() async {
26+
final packageFilters = melos.PackageFilters(
27+
includePrivatePackages: false,
28+
ignore: [
29+
Glob('*web*'),
30+
Glob('*platform*'),
31+
Glob('*internals*'),
32+
],
33+
);
34+
final workspace = await melos.MelosWorkspace.fromConfig(
35+
await melos.MelosWorkspaceConfig.fromWorkspaceRoot(Directory.current),
36+
logger: melos.MelosLogger(logging.Logger.standard()),
37+
packageFilters: packageFilters,
38+
);
39+
40+
return workspace;
41+
}
42+
43+
Future<String?> getBoMNextVersion({bool shouldLog = false}) async {
44+
File currentVersionsJson = File(versionsJsonFile);
45+
Map<String, dynamic> currentVersions =
46+
jsonDecode(currentVersionsJson.readAsStringSync());
47+
// We always append the latest version to the top of the file
48+
// and it's preserved during parsing
49+
final currentVersionNumber = currentVersions.keys.first;
50+
51+
final currentBoMVersion = melos.Version.parse(currentVersionNumber);
52+
final previousBoMPackageNameAndVersions =
53+
currentVersions[currentVersionNumber]['packages']
54+
as Map<String, dynamic>? ??
55+
{};
56+
57+
final currentPackageNameAndVersionsMap = await getPackagesUsingMelos();
58+
final changes = <String, int>{};
59+
final changedPackages = <String, List<String>>{};
60+
for (final entry in currentPackageNameAndVersionsMap.entries) {
61+
final previousVersion = previousBoMPackageNameAndVersions[entry.key];
62+
if (previousVersion == null) {
63+
changes['new'] = (changes['new'] ?? 0) + 1;
64+
if (shouldLog) {
65+
print('New package: ${entry.key} ${entry.value}');
66+
}
67+
} else {
68+
final previous = melos.Version.parse(previousVersion);
69+
final current = entry.value.version;
70+
if (current.major > previous.major) {
71+
changes['major'] = (changes['major'] ?? 0) + 1;
72+
changedPackages[entry.key] = [previousVersion, current.toString()];
73+
} else if (current.minor > previous.minor) {
74+
changes['minor'] = (changes['minor'] ?? 0) + 1;
75+
changedPackages[entry.key] = [previousVersion, current.toString()];
76+
} else if (current.patch > previous.patch) {
77+
changes['patch'] = (changes['patch'] ?? 0) + 1;
78+
changedPackages[entry.key] = [previousVersion, current.toString()];
79+
} else if (current.build.isNotEmpty) {
80+
final previousBuild =
81+
previous.build.isEmpty ? 0 : previous.build.first as int;
82+
final currentBuild = current.build.first as int;
83+
if (currentBuild > previousBuild) {
84+
changes['patch'] = (changes['patch'] ?? 0) + 1;
85+
changedPackages[entry.key] = [previousVersion, current.toString()];
86+
}
87+
}
88+
}
89+
}
90+
91+
if (shouldLog) {
92+
print(
93+
'Previous BoM Package Name and Versions: $previousBoMPackageNameAndVersions',
94+
);
95+
print(
96+
'Current Package Name and Versions: $currentPackageNameAndVersionsMap',
97+
);
98+
print('-' * 80);
99+
print('Changes: $changes');
100+
print('Changed Packages: $changedPackages');
101+
print('-' * 80);
102+
print('Current BoM Version: $currentBoMVersion');
103+
}
104+
105+
var newBoMVersion = currentBoMVersion;
106+
107+
if (changes.isNotEmpty) {
108+
if (changes['major'] != null) {
109+
newBoMVersion = newBoMVersion.nextMajor;
110+
} else if (changes['minor'] != null) {
111+
newBoMVersion = newBoMVersion.nextMinor;
112+
} else if (changes['patch'] != null) {
113+
newBoMVersion = newBoMVersion.nextPatch;
114+
} else if (changes['new'] != null) {
115+
newBoMVersion = newBoMVersion.nextMinor;
116+
}
117+
return newBoMVersion.toString();
118+
} else if (shouldLog) {
119+
print('No changes detected');
120+
}
121+
return null;
122+
}

0 commit comments

Comments
 (0)