Commit 1eed6dff authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Make clean command top level (#12616)

* Make clean command top level

Fixes https://github.com/flutter/flutter/issues/10783

* remove backwards
parent e965b692
......@@ -24,6 +24,7 @@ import 'src/cache.dart';
import 'src/commands/analyze.dart';
import 'src/commands/build.dart';
import 'src/commands/channel.dart';
import 'src/commands/clean.dart';
import 'src/commands/config.dart';
import 'src/commands/create.dart';
import 'src/commands/daemon.dart';
......@@ -68,6 +69,7 @@ Future<Null> main(List<String> args) async {
new AnalyzeCommand(verboseHelp: verboseHelp),
new BuildCommand(verboseHelp: verboseHelp),
new ChannelCommand(),
new CleanCommand(),
new ConfigCommand(verboseHelp: verboseHelp),
new CreateCommand(),
new DaemonCommand(hidden: !verboseHelp),
......
......@@ -6,10 +6,8 @@ import 'dart:async';
import 'package:meta/meta.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/utils.dart';
import '../build_info.dart';
import '../globals.dart';
import '../runner/flutter_command.dart';
import 'build_aot.dart';
......@@ -21,7 +19,6 @@ class BuildCommand extends FlutterCommand {
BuildCommand({bool verboseHelp: false}) {
addSubcommand(new BuildApkCommand());
addSubcommand(new BuildAotCommand());
addSubcommand(new BuildCleanCommand());
addSubcommand(new BuildIOSCommand());
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());
}
}
}
// 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());
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment