@@ -221,14 +221,17 @@ class Repo {
221
221
final Map <PackageInfo , ChangelogUpdate > changelogUpdates = {};
222
222
223
223
/// Bumps the version for all packages in the repo.
224
- void bumpAllVersions ({
224
+ void bumpAllVersions (
225
+ Map <String , PackageInfo > packages, {
225
226
required GitChanges Function (PackageInfo ) changesForPackage,
227
+ VersionBumpType ? forcedBumpType,
226
228
}) {
227
- final sortedPackages = List .of (publishablePackages ());
229
+ final sortedPackages = List .of (publishablePackages (packages ));
228
230
sortPackagesTopologically (
229
231
sortedPackages,
230
232
(PackageInfo pkg) => pkg.pubspecInfo.pubspec,
231
233
);
234
+ bool canBump (PackageInfo package) => packages.containsKey (package.name);
232
235
for (final package in sortedPackages) {
233
236
final changes = changesForPackage (package);
234
237
final commits = (changes.commitsByPackage[package]? .toList () ?? const [])
@@ -237,12 +240,13 @@ class Repo {
237
240
if (commit.type == CommitType .version) {
238
241
continue ;
239
242
}
240
- final bumpType = commit.bumpType;
243
+ final bumpType = forcedBumpType ?? commit.bumpType;
241
244
if (bumpType != null ) {
242
245
bumpVersion (
243
246
package,
244
247
commit: commit,
245
248
type: bumpType,
249
+ canBump: canBump,
246
250
includeInChangelog: commit.includeInChangelog,
247
251
);
248
252
}
@@ -272,6 +276,7 @@ class Repo {
272
276
PackageInfo package, {
273
277
required CommitMessage commit,
274
278
required VersionBumpType type,
279
+ required bool Function (PackageInfo ) canBump,
275
280
required bool includeInChangelog,
276
281
bool ? propagateToComponent,
277
282
}) {
@@ -344,11 +349,12 @@ class Repo {
344
349
.contains (package.name),
345
350
)) {
346
351
logger.verbose ('found dependent package ${dependent .name }' );
347
- if (dependent.isPublishable) {
352
+ if (dependent.isPublishable && canBump (dependent) ) {
348
353
bumpVersion (
349
354
dependent,
350
355
commit: commit,
351
356
type: VersionBumpType .patch,
357
+ canBump: canBump,
352
358
includeInChangelog: false ,
353
359
);
354
360
}
@@ -364,14 +370,17 @@ class Repo {
364
370
return MapEntry (allPackages[name]! , dependents);
365
371
}),
366
372
(componentPackage) {
367
- if (componentPackage == package) return ;
373
+ if (componentPackage == package || ! canBump (componentPackage)) {
374
+ return ;
375
+ }
368
376
logger.verbose (
369
377
'Bumping component package ${componentPackage .name }' ,
370
378
);
371
379
bumpVersion (
372
380
componentPackage,
373
381
commit: commit,
374
382
type: type,
383
+ canBump: canBump,
375
384
includeInChangelog: false ,
376
385
propagateToComponent: false ,
377
386
);
0 commit comments