| 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 /** | 5 /** |
| 6 * Common logic to make it easy to create a `build.dart` for your project. | 6 * Common logic to make it easy to create a `build.dart` for your project. |
| 7 * | 7 * |
| 8 * The `build.dart` script is invoked automatically by the Editor whenever a | 8 * The `build.dart` script is invoked automatically by the Editor whenever a |
| 9 * file in the project changes. It must be placed in the root of a project | 9 * file in the project changes. It must be placed in the root of a project |
| 10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'. | 10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 import 'dwc.dart' as dwc; | 26 import 'dwc.dart' as dwc; |
| 27 import 'src/utils.dart'; | 27 import 'src/utils.dart'; |
| 28 import 'src/compiler_options.dart'; | 28 import 'src/compiler_options.dart'; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Set up 'build.dart' to compile with the dart web components compiler every | 31 * Set up 'build.dart' to compile with the dart web components compiler every |
| 32 * [entryPoints] listed. On clean commands, the directory where [entryPoints] | 32 * [entryPoints] listed. On clean commands, the directory where [entryPoints] |
| 33 * live will be scanned for generated files to delete them. | 33 * live will be scanned for generated files to delete them. |
| 34 */ | 34 */ |
| 35 Future<List<dwc.AnalysisResult>> build(List<String> arguments, | 35 Future<List<dwc.AnalysisResults>> build(List<String> arguments, |
| 36 List<String> entryPoints, | 36 List<String> entryPoints, |
| 37 {bool printTime: true, bool shouldPrint: true}) { | 37 {bool printTime: true, bool shouldPrint: true}) { |
| 38 bool useColors = stdioType(stdout) == StdioType.TERMINAL; | 38 bool useColors = stdioType(stdout) == StdioType.TERMINAL; |
| 39 return asyncTime('Total time', () { | 39 return asyncTime('Total time', () { |
| 40 var args = _processArgs(arguments); | 40 var args = _processArgs(arguments); |
| 41 var tasks = new FutureGroup(); | 41 var tasks = new FutureGroup(); |
| 42 var lastTask = new Future.value(null); | 42 var lastTask = new Future.value(null); |
| 43 tasks.add(lastTask); | 43 tasks.add(lastTask); |
| 44 | 44 |
| 45 var changedFiles = args["changed"]; | 45 var changedFiles = args["changed"]; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if (args["help"]) { | 97 if (args["help"]) { |
| 98 print('A build script that invokes the web-ui compiler (dwc).'); | 98 print('A build script that invokes the web-ui compiler (dwc).'); |
| 99 print('Usage: dart build.dart [options] [-- [dwc-options]]'); | 99 print('Usage: dart build.dart [options] [-- [dwc-options]]'); |
| 100 print('\nThese are valid options expected by build.dart:'); | 100 print('\nThese are valid options expected by build.dart:'); |
| 101 print(parser.getUsage()); | 101 print(parser.getUsage()); |
| 102 print('\nThese are valid options expected by dwc:'); | 102 print('\nThese are valid options expected by dwc:'); |
| 103 dwc.run(['-h']).then((_) => exit(0)); | 103 dwc.run(['-h']).then((_) => exit(0)); |
| 104 } | 104 } |
| 105 return args; | 105 return args; |
| 106 } | 106 } |
| OLD | NEW |