Skip to content

[tool] Exempt federated impl examples from CHANGELOG #6018

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions script/tool/lib/src/common/package_state_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,29 @@ Future<PackageChangeState> checkPackageChangeState(
continue;
}

// Some other changes don't need version changes, but might benefit from
// changelog changes.
final bool isUnpublishedExampleChange =
_isUnpublishedExampleChange(components, package);

// Since examples of federated plugin implementations are only intended
// for testing purposes, any unpublished example change in one of them is
// effectively a developer-only change.
if (package.isFederated &&
package.isPlatformImplementation &&
isUnpublishedExampleChange) {
continue;
}

// Anything that is not developer-only might benefit from changelog
// changes. This errs on the side of flagging, so that someone checks to
// see if it should be mentioned there or not.
needsChangelogChange = true;

// Most changes that aren't developer-only need version changes.
if (
// One of a few special files example will be shown on pub.dev, but
// for anything else in the example publishing has no purpose.
!_isUnpublishedExampleChange(components, package)) {
// for anything else in the example, publishing isn't necessary (even
// if it is relevant to mention in the CHANGELOG for the future).
!isUnpublishedExampleChange) {
needsVersionChange = true;
}
}
Expand Down
21 changes: 21 additions & 0 deletions script/tool/test/common/package_state_utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,27 @@ void main() {
expect(state.needsChangelogChange, true);
});

test(
'requires neither a changelog nor version change for README.md when '
'code example is present in a federated plugin implementation',
() async {
final RepositoryPackage package = createFakePlugin(
'a_plugin_android', packagesDir.childDirectory('a_plugin'),
extraFiles: <String>['example/lib/main.dart']);

const List<String> changedFiles = <String>[
'packages/a_plugin/a_plugin_android/example/README.md',
];

final PackageChangeState state = await checkPackageChangeState(package,
changedPaths: changedFiles,
relativePackagePath: 'packages/a_plugin/a_plugin_android');

expect(state.hasChanges, true);
expect(state.needsVersionChange, false);
expect(state.needsChangelogChange, false);
});

test(
'does not requires changelog or version change for build.gradle '
'test-dependency-only changes', () async {
Expand Down