mirror of
https://github.com/flutter/packages.git
synced 2025-06-17 10:58:42 +08:00
[tool] add all
and dry-run
flags to publish-plugin command (#3776)
This commit is contained in:
script/tool
@ -49,6 +49,7 @@ Directory createFakePlugin(
|
||||
bool isWindowsPlugin = false,
|
||||
bool includeChangeLog = false,
|
||||
bool includeVersion = false,
|
||||
String version = '0.0.1',
|
||||
String parentDirectoryName = '',
|
||||
Directory packagesDirectory,
|
||||
}) {
|
||||
@ -73,6 +74,7 @@ Directory createFakePlugin(
|
||||
isMacOsPlugin: isMacOsPlugin,
|
||||
isWindowsPlugin: isWindowsPlugin,
|
||||
includeVersion: includeVersion,
|
||||
version: version
|
||||
);
|
||||
if (includeChangeLog) {
|
||||
createFakeCHANGELOG(pluginDirectory, '''
|
||||
@ -85,14 +87,14 @@ Directory createFakePlugin(
|
||||
final Directory exampleDir = pluginDirectory.childDirectory('example')
|
||||
..createSync();
|
||||
createFakePubspec(exampleDir,
|
||||
name: '${name}_example', isFlutter: isFlutter);
|
||||
name: '${name}_example', isFlutter: isFlutter, includeVersion: false, publishTo: 'none');
|
||||
} else if (withExamples.isNotEmpty) {
|
||||
final Directory exampleDir = pluginDirectory.childDirectory('example')
|
||||
..createSync();
|
||||
for (final String example in withExamples) {
|
||||
final Directory currentExample = exampleDir.childDirectory(example)
|
||||
..createSync();
|
||||
createFakePubspec(currentExample, name: example, isFlutter: isFlutter);
|
||||
createFakePubspec(currentExample, name: example, isFlutter: isFlutter, includeVersion: false, publishTo: 'none');
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,6 +125,7 @@ void createFakePubspec(
|
||||
bool isLinuxPlugin = false,
|
||||
bool isMacOsPlugin = false,
|
||||
bool isWindowsPlugin = false,
|
||||
String publishTo = 'http://no_pub_server.com',
|
||||
String version = '0.0.1',
|
||||
}) {
|
||||
parent.childFile('pubspec.yaml').createSync();
|
||||
@ -180,7 +183,11 @@ dependencies:
|
||||
if (includeVersion) {
|
||||
yaml += '''
|
||||
version: $version
|
||||
publish_to: http://no_pub_server.com # Hardcoded safeguard to prevent this from somehow being published by a broken test.
|
||||
''';
|
||||
}
|
||||
if (publishTo.isNotEmpty) {
|
||||
yaml += '''
|
||||
publish_to: $publishTo # Hardcoded safeguard to prevent this from somehow being published by a broken test.
|
||||
''';
|
||||
}
|
||||
parent.childFile('pubspec.yaml').writeAsStringSync(yaml);
|
||||
|
Reference in New Issue
Block a user