Skip to content
Draft
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
1 change: 0 additions & 1 deletion packages/google_fonts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@
- `Wix Madefor Display`
- `Wix Madefor Text`
- `Ysabeau`

- Removed fonts:
- `Arima Madurai`
- `Fredoka One`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ GoogleMapController is now uniformly driven by implementing `DefaultLifecycleObs
## 0.5.19

* Adds support for toggling Indoor View on or off.

* Allow BitmapDescriptor scaling override

## 0.5.18
Expand Down
1 change: 0 additions & 1 deletion packages/google_sign_in/google_sign_in/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ For every platform other than `web`, this version should be identical to `5.4.4`
## 5.1.0

* Add reAuthenticate option to signInSilently to allow re-authentication to be requested

* Updated Android lint settings.

## 5.0.7
Expand Down
1 change: 0 additions & 1 deletion packages/image_picker/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
## 0.8.6+2

* Updates `NSPhotoLibraryUsageDescription` description in README.

* Updates minimum Flutter version to 3.0.

## 0.8.6+1
Expand Down
2 changes: 0 additions & 2 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,12 @@ DefaultHttpDataSourceFactory by default.
## 0.10.0+8

* iOS: Fix an issue where the player sends initialization message incorrectly.

* Fix a few other IDE warnings.


## 0.10.0+7

* Android: Fix issue where buffering status in percentage instead of milliseconds

* Android: Update buffering status everytime we notify for position change

## 0.10.0+6
Expand Down
1 change: 0 additions & 1 deletion packages/video_player/video_player_android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
## 2.7.2

* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.

* Re-adds Impeller support.

## 2.7.1
Expand Down
35 changes: 34 additions & 1 deletion script/tool/lib/src/version_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ class VersionCheckCommand extends PackageLoopingCommand {
hide: true);
}

static final RegExp _blankLineInListRegex = RegExp(
r'(^[ \t]*[*+-]\s.*$\n)((^[ \t]*$\n)+)(^[ \t]*[*+-]\s.*$)',
multiLine: true);

static const String _againstPubFlag = 'against-pub';
static const String _prLabelsArg = 'pr-labels';
static const String _checkForMissingChanges = 'check-for-missing-changes';
Expand Down Expand Up @@ -377,7 +381,8 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}

// get first version from CHANGELOG
final File changelog = package.changelogFile;
final List<String> lines = changelog.readAsLinesSync();
final String changelogContent = changelog.readAsStringSync();
final List<String> lines = changelogContent.split('\n');
String? firstLineWithText;
final Iterator<String> iterator = lines.iterator;
while (iterator.moveNext()) {
Expand Down Expand Up @@ -455,9 +460,37 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog.
}
}

// Check for blank lines between list items in the version section.
final Match? blankLineMatch = _findBlankLineInList(changelogContent);
if (blankLineMatch != null) {
final String offendingLines = blankLineMatch
.group(0)!
.split('\n')
.map((String line) => '$indentation $line') // Add extra indentation
.join('\n');

printError(
'${indentation}Blank lines found between list items in CHANGELOG.\n'
'${indentation}This creates multiple separate lists on pub.dev.\n'
'${indentation}Remove blank lines to keep all items in a single list.\n'
'${indentation}The problematic section found is:\n'
'$offendingLines');
return false;
}

return true;
}

/// Validates that there are no blank lines between list items within
/// the changelog using a regex.
///
/// Returns the first invalid match found, or null if validation passes.
Match? _findBlankLineInList(String changelogContent) {
// If the regex finds a match, it means there is an error (a blank line
// between list items).
return _blankLineInListRegex.firstMatch(changelogContent);
}

Pubspec? _tryParsePubspec(RepositoryPackage package) {
try {
final Pubspec pubspec = package.parsePubspec();
Expand Down
2 changes: 1 addition & 1 deletion script/tool/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_plugin_tools
description: Productivity and CI utils for flutter/packages
repository: https://github.com/flutter/packages/tree/main/script/tool
version: 1.0.0
version: 1.0.1
publish_to: none

dependencies:
Expand Down
77 changes: 77 additions & 0 deletions script/tool/test/version_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,83 @@ void main() {
);
});

test('Fail if CHANGELOG list items have a blank line', () async {
const String version = '1.0.1';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, version: version);

// Blank line breaks the list items.
const String changelog = '''
## $version
* First item.

* Second item.
* Third item.
''';
plugin.changelogFile.writeAsStringSync(changelog);
gitProcessRunner.mockProcessesForExecutable['git-show'] =
<FakeProcessInfo>[
FakeProcessInfo(MockProcess(stdout: 'version: 1.0.0')),
];
Error? commandError;
final List<String> output = await runCapturingPrint(
runner, <String>['version-check', '--base-sha=main'],
errorHandler: (Error e) {
commandError = e;
});

expect(commandError, isA<ToolExit>());
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running for plugin'),
contains('1.0.0 -> 1.0.1'),
contains('Blank lines found between list items in CHANGELOG.'),
contains('CHANGELOG.md failed validation.'),
]),
);
});

test('Fail if CHANGELOG list items have a blank line with nested items',
() async {
const String version = '1.0.1';
final RepositoryPackage plugin =
createFakePlugin('plugin', packagesDir, version: version);

// Blank line in nested list items.
const String changelog = '''
## $version
* Top level item.
* Nested item A.

* Nested item B.
* Another top level item.
''';
plugin.changelogFile.writeAsStringSync(changelog);
gitProcessRunner.mockProcessesForExecutable['git-show'] =
<FakeProcessInfo>[
FakeProcessInfo(MockProcess(stdout: 'version: 1.0.0')),
];
Error? commandError;
final List<String> output = await runCapturingPrint(
runner, <String>['version-check', '--base-sha=main'],
errorHandler: (Error e) {
commandError = e;
});

expect(commandError, isA<ToolExit>());
expect(
output,
containsAllInOrder(<Matcher>[
contains('Running for plugin'),
contains('1.0.0 -> 1.0.1'),
contains('Blank lines found between list items in CHANGELOG.'),
contains('CHANGELOG.md failed validation.'),
]),
);
});
// END OF NEW TESTS

test(
'Fail if pubspec version only matches an older version listed in CHANGELOG',
() async {
Expand Down