Skip to content

Commit

Permalink
chore: fix aft version-bump (#5436)
Browse files Browse the repository at this point in the history
* fix: properly handle component propagation

* chore: add test for multi package update with breaking common package
  • Loading branch information
Jordan-Nelson authored Sep 12, 2024
1 parent 2c14363 commit dc18f4d
Show file tree
Hide file tree
Showing 6 changed files with 486 additions and 53 deletions.
20 changes: 7 additions & 13 deletions packages/aft/lib/src/repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ class Repo {
required VersionBumpType type,
required bool Function(PackageInfo) canBump,
required bool includeInChangelog,
bool? propagateToComponent,
}) {
logger.verbose('bumpVersion ${package.name} $commit');
final componentName = aftConfig.componentForPackage(package.name);
Expand All @@ -317,7 +316,7 @@ class Repo {
],
(version) => version,
)!;
propagateToComponent ??= component != null &&
final propagateToComponent = component != null &&
component.propagate.propagateToComponent(
currentVersion,
newVersion,
Expand Down Expand Up @@ -359,11 +358,13 @@ class Repo {
pkg.pubspecInfo.pubspec.dependencies.keys.contains(package.name) ||
pkg.pubspecInfo.pubspec.devDependencies.keys.contains(package.name),
);
if (commit.isBreakingChange) {
// Back-propagate to all dependent packages for breaking changes.
if (commit.isBreakingChange || propagateToComponent) {
// Back-propagate to all dependent packages for breaking changes or
// changes that need to propagate to a component.
//
// Since we set semantic version constraints, only a breaking change
// in a direct dependency necessitates a version bump.
// Since we set semantic version constraints, only a breaking change in
// a direct dependency or a change that requires propagation
// necessitates a version bump.
logger.verbose(
'Breaking change. Performing dfs on dependent packages...',
);
Expand All @@ -380,12 +381,6 @@ class Repo {
}
updateConstraint(package, dependent);
}
} else if (type == VersionBumpType.nonBreaking) {
// For non-breaking changes, we still need to update all constraints
// since we "pin" to minor versions.
for (final dependent in packageDependents) {
updateConstraint(package, dependent);
}
}

// Propagate to all component packages.
Expand All @@ -408,7 +403,6 @@ class Repo {
type: type,
canBump: canBump,
includeInChangelog: false,
propagateToComponent: false,
);
},
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc18f4d

Please sign in to comment.