mirror of
https://github.com/flutter/packages.git
synced 2025-06-05 19:17:51 +08:00
[flutter_plugin_tools] ignore flutter_plugin_tools when publishing (#4110)
This commit is contained in:
@ -290,6 +290,14 @@ Safe to ignore if the package is deleted in this commit.
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Pubspec pubspec = Pubspec.parse(pubspecFile.readAsStringSync());
|
final Pubspec pubspec = Pubspec.parse(pubspecFile.readAsStringSync());
|
||||||
|
|
||||||
|
if (pubspec.name == 'flutter_plugin_tools') {
|
||||||
|
// Ignore flutter_plugin_tools package when running publishing through flutter_plugin_tools.
|
||||||
|
// TODO(cyanglaz): Make the tool also auto publish flutter_plugin_tools package.
|
||||||
|
// https://github.com/flutter/flutter/issues/85430
|
||||||
|
return _CheckNeedsReleaseResult.noRelease;
|
||||||
|
}
|
||||||
|
|
||||||
if (pubspec.publishTo == 'none') {
|
if (pubspec.publishTo == 'none') {
|
||||||
return _CheckNeedsReleaseResult.noRelease;
|
return _CheckNeedsReleaseResult.noRelease;
|
||||||
}
|
}
|
||||||
|
@ -995,6 +995,57 @@ void main() {
|
|||||||
]));
|
]));
|
||||||
expect(processRunner.pushTagsArgs, isEmpty);
|
expect(processRunner.pushTagsArgs, isEmpty);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Do not release flutter_plugin_tools', () async {
|
||||||
|
const Map<String, dynamic> httpResponsePlugin1 = <String, dynamic>{
|
||||||
|
'name': 'flutter_plugin_tools',
|
||||||
|
'versions': <String>[],
|
||||||
|
};
|
||||||
|
|
||||||
|
final MockClient mockClient = MockClient((http.Request request) async {
|
||||||
|
if (request.url.pathSegments.last == 'flutter_plugin_tools.json') {
|
||||||
|
return http.Response(json.encode(httpResponsePlugin1), 200);
|
||||||
|
}
|
||||||
|
return http.Response('', 500);
|
||||||
|
});
|
||||||
|
final PublishPluginCommand command = PublishPluginCommand(packagesDir,
|
||||||
|
processRunner: processRunner,
|
||||||
|
print: (Object? message) => printedMessages.add(message.toString()),
|
||||||
|
stdinput: mockStdin,
|
||||||
|
httpClient: mockClient,
|
||||||
|
gitDir: gitDir);
|
||||||
|
|
||||||
|
commandRunner = CommandRunner<void>(
|
||||||
|
'publish_check_command',
|
||||||
|
'Test for publish-check command.',
|
||||||
|
);
|
||||||
|
commandRunner.addCommand(command);
|
||||||
|
|
||||||
|
final Directory flutterPluginTools =
|
||||||
|
createFakePlugin('flutter_plugin_tools', packagesDir);
|
||||||
|
await gitDir.runCommand(<String>['add', '-A']);
|
||||||
|
await gitDir.runCommand(<String>['commit', '-m', 'Add plugins']);
|
||||||
|
// Immediately return 0 when running `pub publish`.
|
||||||
|
processRunner.mockPublishCompleteCode = 0;
|
||||||
|
mockStdin.readLineOutput = 'y';
|
||||||
|
await commandRunner
|
||||||
|
.run(<String>['publish-plugin', '--all-changed', '--base-sha=HEAD~']);
|
||||||
|
expect(
|
||||||
|
printedMessages,
|
||||||
|
containsAllInOrder(<String>[
|
||||||
|
'Checking local repo...',
|
||||||
|
'Local repo is ready!',
|
||||||
|
'Done!'
|
||||||
|
]));
|
||||||
|
expect(
|
||||||
|
printedMessages.contains(
|
||||||
|
'Running `pub publish ` in ${flutterPluginTools.path}...\n',
|
||||||
|
),
|
||||||
|
isFalse);
|
||||||
|
expect(processRunner.pushTagsArgs, isEmpty);
|
||||||
|
processRunner.pushTagsArgs.clear();
|
||||||
|
printedMessages.clear();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user