Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[tool] Rename all-plugins-app command
Renames `all-plugins-app` to `create-all-packages-app`, to make it clear
that it's not plugin-specific (in preparation for the repo merge).

See flutter/packages#2724 for context.
  • Loading branch information
stuartmorgan-g committed Oct 21, 2022
commit 163a358bb6437b1e9d022be3762594824dfef339
2 changes: 1 addition & 1 deletion .ci/scripts/build_all_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

cd all_plugins
cd all_packages
flutter build windows --debug
flutter build windows --release
2 changes: 1 addition & 1 deletion .ci/scripts/create_all_plugins_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

dart ./script/tool/bin/flutter_plugin_tools.dart all-plugins-app \
dart ./script/tool/bin/flutter_plugin_tools.dart creat-all-packages-app \
--output-dir=. --exclude script/configs/exclude_all_plugins_app.yaml
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ flutter_upgrade_template: &FLUTTER_UPGRADE_TEMPLATE

build_all_plugins_app_template: &BUILD_ALL_PLUGINS_APP_TEMPLATE
create_all_plugins_app_script:
- $PLUGIN_TOOL_COMMAND all-plugins-app --output-dir=. --exclude script/configs/exclude_all_plugins_app.yaml
- $PLUGIN_TOOL_COMMAND create-all-packages-app --output-dir=. --exclude script/configs/exclude_all_plugins_app.yaml
build_all_plugins_debug_script:
- cd all_plugins
- cd all_packages
- if [[ "$BUILD_ALL_ARGS" == "web" ]]; then
- echo "Skipping; web does not support debug builds"
- else
- flutter build $BUILD_ALL_ARGS --debug
- fi
build_all_plugins_release_script:
- cd all_plugins
- cd all_packages
- flutter build $BUILD_ALL_ARGS --release

# Light-workload Linux tasks.
Expand Down
6 changes: 6 additions & 0 deletions script/tool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.13.0

* Renames `all-plugins-app` to `create-all-packages-app` to clarify what it
actually does. Also renames the project directory it creates from
`all_plugins` to `all_packages`.

## 0.12.1

* Modifies `publish_check_command.dart` to do a `dart pub get` in all examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,38 @@ import 'common/repository_package.dart';

const String _outputDirectoryFlag = 'output-dir';

const String _projectName = 'all_packages';

/// A command to create an application that builds all in a single application.
class CreateAllPluginsAppCommand extends PackageCommand {
class CreateAllPackagesAppCommand extends PackageCommand {
/// Creates an instance of the builder command.
CreateAllPluginsAppCommand(
CreateAllPackagesAppCommand(
Directory packagesDir, {
Directory? pluginsRoot,
}) : super(packagesDir) {
final Directory defaultDir =
pluginsRoot ?? packagesDir.fileSystem.currentDirectory;
argParser.addOption(_outputDirectoryFlag,
defaultsTo: defaultDir.path,
help: 'The path the directory to create the "all_plugins" project in.\n'
help:
'The path the directory to create the "$_projectName" project in.\n'
'Defaults to the repository root.');
}

/// The location to create the synthesized app project.
Directory get _appDirectory => packagesDir.fileSystem
.directory(getStringArg(_outputDirectoryFlag))
.childDirectory('all_plugins');
.childDirectory(_projectName);

/// The synthesized app project.
RepositoryPackage get app => RepositoryPackage(_appDirectory);

@override
String get description =>
'Generate Flutter app that includes all plugins in packages.';
'Generate Flutter app that includes all target packagas.';

@override
String get name => 'all-plugins-app';
String get name => 'create-all-packages-app';

@override
Future<void> run() async {
Expand Down Expand Up @@ -74,7 +77,7 @@ class CreateAllPluginsAppCommand extends PackageCommand {
<String>[
'create',
'--template=app',
'--project-name=all_plugins',
'--project-name=$_projectName',
'--android-language=java',
_appDirectory.path,
],
Expand Down Expand Up @@ -134,9 +137,9 @@ class CreateAllPluginsAppCommand extends PackageCommand {

final StringBuffer newManifest = StringBuffer();
for (final String line in manifestFile.readAsLinesSync()) {
if (line.contains('package="com.example.all_plugins"')) {
if (line.contains('package="com.example.$_projectName"')) {
newManifest
..writeln('package="com.example.all_plugins"')
..writeln('package="com.example.$_projectName"')
..writeln('xmlns:tools="http://schemas.android.com/tools">')
..writeln()
..writeln(
Expand Down Expand Up @@ -165,7 +168,7 @@ class CreateAllPluginsAppCommand extends PackageCommand {
final Map<String, PathDependency> pluginDeps =
await _getValidPathDependencies();
final Pubspec pubspec = Pubspec(
'all_plugins',
_projectName,
description: 'Flutter app containing all 1st party plugins.',
version: Version.parse('1.0.0+1'),
environment: <String, VersionConstraint>{
Expand Down
4 changes: 2 additions & 2 deletions script/tool/lib/src/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:file/local.dart';
import 'analyze_command.dart';
import 'build_examples_command.dart';
import 'common/core.dart';
import 'create_all_plugins_app_command.dart';
import 'create_all_packages_app_command.dart';
import 'custom_test_command.dart';
import 'dependabot_check_command.dart';
import 'drive_examples_command.dart';
Expand Down Expand Up @@ -56,7 +56,7 @@ void main(List<String> args) {
'Productivity utils for hosting multiple plugins within one repository.')
..addCommand(AnalyzeCommand(packagesDir))
..addCommand(BuildExamplesCommand(packagesDir))
..addCommand(CreateAllPluginsAppCommand(packagesDir))
..addCommand(CreateAllPackagesAppCommand(packagesDir))
..addCommand(CustomTestCommand(packagesDir))
..addCommand(DependabotCheckCommand(packagesDir))
..addCommand(DriveExamplesCommand(packagesDir))
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 utils for flutter/plugins and flutter/packages
repository: https://github.com/flutter/plugins/tree/main/script/tool
version: 0.12.1
version: 0.13.0

dependencies:
args: ^2.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import 'dart:io' as io;
import 'package:args/command_runner.dart';
import 'package:file/file.dart';
import 'package:file/local.dart';
import 'package:flutter_plugin_tools/src/create_all_plugins_app_command.dart';
import 'package:flutter_plugin_tools/src/create_all_packages_app_command.dart';
import 'package:platform/platform.dart';
import 'package:test/test.dart';

import 'util.dart';

void main() {
group('$CreateAllPluginsAppCommand', () {
group('$CreateAllPackagesAppCommand', () {
late CommandRunner<void> runner;
late CreateAllPluginsAppCommand command;
late CreateAllPackagesAppCommand command;
late FileSystem fileSystem;
late Directory testRoot;
late Directory packagesDir;
Expand All @@ -29,12 +29,12 @@ void main() {
testRoot = fileSystem.systemTempDirectory.createTempSync();
packagesDir = testRoot.childDirectory('packages');

command = CreateAllPluginsAppCommand(
command = CreateAllPackagesAppCommand(
packagesDir,
pluginsRoot: testRoot,
);
runner = CommandRunner<void>(
'create_all_test', 'Test for $CreateAllPluginsAppCommand');
'create_all_test', 'Test for $CreateAllPackagesAppCommand');
runner.addCommand(command);
});

Expand All @@ -47,7 +47,7 @@ void main() {
createFakePlugin('pluginb', packagesDir);
createFakePlugin('pluginc', packagesDir);

await runCapturingPrint(runner, <String>['all-plugins-app']);
await runCapturingPrint(runner, <String>['create-all-packages-app']);
final List<String> pubspec = command.app.pubspecFile.readAsLinesSync();

expect(
Expand All @@ -64,7 +64,7 @@ void main() {
createFakePlugin('pluginb', packagesDir);
createFakePlugin('pluginc', packagesDir);

await runCapturingPrint(runner, <String>['all-plugins-app']);
await runCapturingPrint(runner, <String>['create-all-packages-app']);
final List<String> pubspec = command.app.pubspecFile.readAsLinesSync();

expect(
Expand Down Expand Up @@ -95,7 +95,7 @@ void main() {

createFakePlugin('plugina', packagesDir);

await runCapturingPrint(runner, <String>['all-plugins-app']);
await runCapturingPrint(runner, <String>['create-all-packages-app']);
final Pubspec generatedPubspec = command.app.parsePubspec();

const String dartSdkKey = 'sdk';
Expand All @@ -108,20 +108,22 @@ void main() {

final Directory customOutputDir =
fileSystem.systemTempDirectory.createTempSync();
await runCapturingPrint(runner,
<String>['all-plugins-app', '--output-dir=${customOutputDir.path}']);
await runCapturingPrint(runner, <String>[
'create-all-packages-app',
'--output-dir=${customOutputDir.path}'
]);

expect(
command.app.path, customOutputDir.childDirectory('all_plugins').path);
expect(command.app.path,
customOutputDir.childDirectory('all_packages').path);
});

test('logs exclusions', () async {
createFakePlugin('plugina', packagesDir);
createFakePlugin('pluginb', packagesDir);
createFakePlugin('pluginc', packagesDir);

final List<String> output = await runCapturingPrint(
runner, <String>['all-plugins-app', '--exclude=pluginb,pluginc']);
final List<String> output = await runCapturingPrint(runner,
<String>['create-all-packages-app', '--exclude=pluginb,pluginc']);

expect(
output,
Expand Down