mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 17:28:42 +08:00
[flutter_plugin_tools] Simplify filesystem usage (#4014)
- Replaces most explicit use of `fileSystem` with path construction using the `child*` utility methods - Removes explicit passing of a filesystem to the commands; we're already passing a `Directory` for the root where the tool operates, and we should never be using a different filesystem than that directory's filesystem, so passing it was both redundant, and a potential source of test bugs.
This commit is contained in:
@ -15,10 +15,9 @@ import 'common.dart';
|
||||
class BuildExamplesCommand extends PluginCommand {
|
||||
/// Creates an instance of the build command.
|
||||
BuildExamplesCommand(
|
||||
Directory packagesDir,
|
||||
FileSystem fileSystem, {
|
||||
Directory packagesDir, {
|
||||
ProcessRunner processRunner = const ProcessRunner(),
|
||||
}) : super(packagesDir, fileSystem, processRunner: processRunner) {
|
||||
}) : super(packagesDir, processRunner: processRunner) {
|
||||
argParser.addFlag(kLinux, defaultsTo: false);
|
||||
argParser.addFlag(kMacos, defaultsTo: false);
|
||||
argParser.addFlag(kWeb, defaultsTo: false);
|
||||
@ -69,7 +68,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kLinux)) {
|
||||
print('\nBUILDING Linux for $packageName');
|
||||
if (isLinuxPlugin(plugin, fileSystem)) {
|
||||
if (isLinuxPlugin(plugin)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -89,7 +88,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kMacos)) {
|
||||
print('\nBUILDING macOS for $packageName');
|
||||
if (isMacOsPlugin(plugin, fileSystem)) {
|
||||
if (isMacOsPlugin(plugin)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -109,7 +108,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kWeb)) {
|
||||
print('\nBUILDING web for $packageName');
|
||||
if (isWebPlugin(plugin, fileSystem)) {
|
||||
if (isWebPlugin(plugin)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -129,7 +128,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kWindows)) {
|
||||
print('\nBUILDING Windows for $packageName');
|
||||
if (isWindowsPlugin(plugin, fileSystem)) {
|
||||
if (isWindowsPlugin(plugin)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -149,7 +148,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kIpa)) {
|
||||
print('\nBUILDING IPA for $packageName');
|
||||
if (isIosPlugin(plugin, fileSystem)) {
|
||||
if (isIosPlugin(plugin)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -170,7 +169,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
|
||||
if (getBoolArg(kApk)) {
|
||||
print('\nBUILDING APK for $packageName');
|
||||
if (isAndroidPlugin(plugin, fileSystem)) {
|
||||
if (isAndroidPlugin(plugin)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
|
Reference in New Issue
Block a user