| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "dart:io"; | 5 import "dart:io"; |
| 6 import "package:args/args.dart"; | 6 import "package:args/args.dart"; |
| 7 | 7 |
| 8 bool cleanBuild; | 8 bool cleanBuild; |
| 9 bool fullBuild; | 9 bool fullBuild; |
| 10 List<String> changedFiles; | 10 List<String> changedFiles; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 parser.addFlag("help", negatable: false, help: "displays this help and exit"); | 47 parser.addFlag("help", negatable: false, help: "displays this help and exit"); |
| 48 var args = parser.parse(new Options().arguments); | 48 var args = parser.parse(new Options().arguments); |
| 49 if (args["help"]) { | 49 if (args["help"]) { |
| 50 print(parser.getUsage()); | 50 print(parser.getUsage()); |
| 51 exit(0); | 51 exit(0); |
| 52 } | 52 } |
| 53 | 53 |
| 54 changedFiles = args["changed"]; | 54 changedFiles = args["changed"]; |
| 55 removedFiles = args["removed"]; | 55 removedFiles = args["removed"]; |
| 56 cleanBuild = args["clean"]; | 56 cleanBuild = args["clean"]; |
| 57 fullBuild = changedFiles.isEmpty() && removedFiles.isEmpty() && !cleanBuild; | 57 fullBuild = changedFiles.isEmpty && removedFiles.isEmpty && !cleanBuild; |
| 58 } | 58 } |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Delete all generated files. | 61 * Delete all generated files. |
| 62 */ | 62 */ |
| 63 void handleCleanCommand() { | 63 void handleCleanCommand() { |
| 64 Directory current = new Directory.current(); | 64 Directory current = new Directory.current(); |
| 65 current.list(recursive: true).onFile = _maybeClean; | 65 current.list(recursive: true).onFile = _maybeClean; |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * If this file is a generated file (based on the extension), delete it. | 118 * If this file is a generated file (based on the extension), delete it. |
| 119 */ | 119 */ |
| 120 void _maybeClean(String file) { | 120 void _maybeClean(String file) { |
| 121 if (file.endsWith(".foobar")) { | 121 if (file.endsWith(".foobar")) { |
| 122 new File(file).delete(); | 122 new File(file).delete(); |
| 123 } | 123 } |
| 124 } | 124 } |
| OLD | NEW |