Make clean command top level (#12616)
* Make clean command top level Fixes https://github.com/flutter/flutter/issues/10783 * remove backwards
This commit is contained in:
committed by
GitHub
parent
e965b69285
commit
1eed6dff34
@@ -24,6 +24,7 @@ import 'src/cache.dart';
|
|||||||
import 'src/commands/analyze.dart';
|
import 'src/commands/analyze.dart';
|
||||||
import 'src/commands/build.dart';
|
import 'src/commands/build.dart';
|
||||||
import 'src/commands/channel.dart';
|
import 'src/commands/channel.dart';
|
||||||
|
import 'src/commands/clean.dart';
|
||||||
import 'src/commands/config.dart';
|
import 'src/commands/config.dart';
|
||||||
import 'src/commands/create.dart';
|
import 'src/commands/create.dart';
|
||||||
import 'src/commands/daemon.dart';
|
import 'src/commands/daemon.dart';
|
||||||
@@ -68,6 +69,7 @@ Future<Null> main(List<String> args) async {
|
|||||||
new AnalyzeCommand(verboseHelp: verboseHelp),
|
new AnalyzeCommand(verboseHelp: verboseHelp),
|
||||||
new BuildCommand(verboseHelp: verboseHelp),
|
new BuildCommand(verboseHelp: verboseHelp),
|
||||||
new ChannelCommand(),
|
new ChannelCommand(),
|
||||||
|
new CleanCommand(),
|
||||||
new ConfigCommand(verboseHelp: verboseHelp),
|
new ConfigCommand(verboseHelp: verboseHelp),
|
||||||
new CreateCommand(),
|
new CreateCommand(),
|
||||||
new DaemonCommand(hidden: !verboseHelp),
|
new DaemonCommand(hidden: !verboseHelp),
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import '../base/common.dart';
|
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/utils.dart';
|
import '../base/utils.dart';
|
||||||
import '../build_info.dart';
|
|
||||||
import '../globals.dart';
|
import '../globals.dart';
|
||||||
import '../runner/flutter_command.dart';
|
import '../runner/flutter_command.dart';
|
||||||
import 'build_aot.dart';
|
import 'build_aot.dart';
|
||||||
@@ -21,7 +19,6 @@ class BuildCommand extends FlutterCommand {
|
|||||||
BuildCommand({bool verboseHelp: false}) {
|
BuildCommand({bool verboseHelp: false}) {
|
||||||
addSubcommand(new BuildApkCommand());
|
addSubcommand(new BuildApkCommand());
|
||||||
addSubcommand(new BuildAotCommand());
|
addSubcommand(new BuildAotCommand());
|
||||||
addSubcommand(new BuildCleanCommand());
|
|
||||||
addSubcommand(new BuildIOSCommand());
|
addSubcommand(new BuildIOSCommand());
|
||||||
addSubcommand(new BuildFlxCommand(verboseHelp: verboseHelp));
|
addSubcommand(new BuildFlxCommand(verboseHelp: verboseHelp));
|
||||||
}
|
}
|
||||||
@@ -61,30 +58,3 @@ abstract class BuildSubCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BuildCleanCommand extends FlutterCommand {
|
|
||||||
BuildCleanCommand() {
|
|
||||||
requiresPubspecYaml();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String name = 'clean';
|
|
||||||
|
|
||||||
@override
|
|
||||||
final String description = 'Delete the build/ directory.';
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Null> runCommand() async {
|
|
||||||
final Directory buildDir = fs.directory(getBuildDirectory());
|
|
||||||
printStatus("Deleting '${buildDir.path}${fs.path.separator}'.");
|
|
||||||
|
|
||||||
if (!buildDir.existsSync())
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
buildDir.deleteSync(recursive: true);
|
|
||||||
} catch (error) {
|
|
||||||
throwToolExit(error.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
38
packages/flutter_tools/lib/src/commands/clean.dart
Normal file
38
packages/flutter_tools/lib/src/commands/clean.dart
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// 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:async';
|
||||||
|
|
||||||
|
import '../base/common.dart';
|
||||||
|
import '../base/file_system.dart';
|
||||||
|
import '../build_info.dart';
|
||||||
|
import '../globals.dart';
|
||||||
|
import '../runner/flutter_command.dart';
|
||||||
|
|
||||||
|
class CleanCommand extends FlutterCommand {
|
||||||
|
CleanCommand() {
|
||||||
|
requiresPubspecYaml();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String name = 'clean';
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String description = 'Delete the build/ directory.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<Null> runCommand() async {
|
||||||
|
final Directory buildDir = fs.directory(getBuildDirectory());
|
||||||
|
printStatus("Deleting '${buildDir.path}${fs.path.separator}'.");
|
||||||
|
|
||||||
|
if (!buildDir.existsSync())
|
||||||
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
buildDir.deleteSync(recursive: true);
|
||||||
|
} catch (error) {
|
||||||
|
throwToolExit(error.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user