mirror of
https://github.com/flutter/packages.git
synced 2025-06-23 00:25:38 +08:00
Move plugin tools code (#3544)
This commit is contained in:
63
script/tool/lib/src/main.dart
Normal file
63
script/tool/lib/src/main.dart
Normal file
@ -0,0 +1,63 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
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/publish_plugin_command.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import 'analyze_command.dart';
|
||||
import 'build_examples_command.dart';
|
||||
import 'common.dart';
|
||||
import 'create_all_plugins_app_command.dart';
|
||||
import 'drive_examples_command.dart';
|
||||
import 'firebase_test_lab_command.dart';
|
||||
import 'format_command.dart';
|
||||
import 'java_test_command.dart';
|
||||
import 'lint_podspecs_command.dart';
|
||||
import 'list_command.dart';
|
||||
import 'test_command.dart';
|
||||
import 'version_check_command.dart';
|
||||
import 'xctest_command.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
final FileSystem fileSystem = const LocalFileSystem();
|
||||
|
||||
Directory packagesDir = fileSystem
|
||||
.directory(p.join(fileSystem.currentDirectory.path, 'packages'));
|
||||
|
||||
if (!packagesDir.existsSync()) {
|
||||
if (p.basename(fileSystem.currentDirectory.path) == 'packages') {
|
||||
packagesDir = fileSystem.currentDirectory;
|
||||
} else {
|
||||
print('Error: Cannot find a "packages" sub-directory');
|
||||
io.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
final CommandRunner<Null> commandRunner = CommandRunner<Null>(
|
||||
'pub global run flutter_plugin_tools',
|
||||
'Productivity utils for hosting multiple plugins within one repository.')
|
||||
..addCommand(AnalyzeCommand(packagesDir, fileSystem))
|
||||
..addCommand(BuildExamplesCommand(packagesDir, fileSystem))
|
||||
..addCommand(CreateAllPluginsAppCommand(packagesDir, fileSystem))
|
||||
..addCommand(DriveExamplesCommand(packagesDir, fileSystem))
|
||||
..addCommand(FirebaseTestLabCommand(packagesDir, fileSystem))
|
||||
..addCommand(FormatCommand(packagesDir, fileSystem))
|
||||
..addCommand(JavaTestCommand(packagesDir, fileSystem))
|
||||
..addCommand(LintPodspecsCommand(packagesDir, fileSystem))
|
||||
..addCommand(ListCommand(packagesDir, fileSystem))
|
||||
..addCommand(PublishPluginCommand(packagesDir, fileSystem))
|
||||
..addCommand(TestCommand(packagesDir, fileSystem))
|
||||
..addCommand(VersionCheckCommand(packagesDir, fileSystem))
|
||||
..addCommand(XCTestCommand(packagesDir, fileSystem));
|
||||
|
||||
commandRunner.run(args).catchError((Object e) {
|
||||
final ToolExit toolExit = e;
|
||||
io.exit(toolExit.exitCode);
|
||||
}, test: (Object e) => e is ToolExit);
|
||||
}
|
Reference in New Issue
Block a user