mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 17:28:42 +08:00
Migrate some tool commands to NNBD (#3899)
Now that individual commands can be migrated, migrate several commands that are trivially migratable. Part of https://github.com/flutter/flutter/issues/81912
This commit is contained in:
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart=2.9
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io' as io;
|
||||
|
||||
@ -52,11 +50,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
kWeb,
|
||||
kWindows,
|
||||
];
|
||||
final Map<String, bool> platforms = <String, bool>{
|
||||
for (final String platform in platformSwitches)
|
||||
platform: getBoolArg(platform)
|
||||
};
|
||||
if (!platforms.values.any((bool enabled) => enabled)) {
|
||||
if (!platformSwitches.any((String platform) => getBoolArg(platform))) {
|
||||
print(
|
||||
'None of ${platformSwitches.map((String platform) => '--$platform').join(', ')} '
|
||||
'were specified, so not building anything.');
|
||||
@ -73,7 +67,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
final String packageName =
|
||||
p.relative(example.path, from: packagesDir.path);
|
||||
|
||||
if (platforms[kLinux]) {
|
||||
if (getBoolArg(kLinux)) {
|
||||
print('\nBUILDING Linux for $packageName');
|
||||
if (isLinuxPlugin(plugin, fileSystem)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
@ -93,7 +87,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (platforms[kMacos]) {
|
||||
if (getBoolArg(kMacos)) {
|
||||
print('\nBUILDING macOS for $packageName');
|
||||
if (isMacOsPlugin(plugin, fileSystem)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
@ -113,7 +107,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (platforms[kWeb]) {
|
||||
if (getBoolArg(kWeb)) {
|
||||
print('\nBUILDING web for $packageName');
|
||||
if (isWebPlugin(plugin, fileSystem)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
@ -133,7 +127,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (platforms[kWindows]) {
|
||||
if (getBoolArg(kWindows)) {
|
||||
print('\nBUILDING Windows for $packageName');
|
||||
if (isWindowsPlugin(plugin, fileSystem)) {
|
||||
final int buildExitCode = await processRunner.runAndStream(
|
||||
@ -153,7 +147,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (platforms[kIpa]) {
|
||||
if (getBoolArg(kIpa)) {
|
||||
print('\nBUILDING IPA for $packageName');
|
||||
if (isIosPlugin(plugin, fileSystem)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
@ -174,7 +168,7 @@ class BuildExamplesCommand extends PluginCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (platforms[kApk]) {
|
||||
if (getBoolArg(kApk)) {
|
||||
print('\nBUILDING APK for $packageName');
|
||||
if (isAndroidPlugin(plugin, fileSystem)) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
|
Reference in New Issue
Block a user