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'. |
11 * | 11 * |
12 * A common `build.dart` would look as follows: | 12 * A common `build.dart` would look as follows: |
13 * | 13 * |
14 * import 'dart:io'; | 14 * import 'dart:io'; |
15 * import 'package:web_components/component_build.dart'; | 15 * import 'package:web_ui/component_build.dart'; |
16 * | 16 * |
17 * main() => build(new Options().arguments, ['web/main.html']); | 17 * main() => build(new Options().arguments, ['web/main.html']); |
18 * | 18 * |
19 * | 19 * |
20 */ | 20 */ |
21 library build_utils; | 21 library build_utils; |
22 | 22 |
23 import 'dart:io'; | 23 import 'dart:io'; |
24 import 'package:args/args.dart'; | 24 import 'package:args/args.dart'; |
25 import 'package:web_components/dwc.dart' as dwc; | 25 import 'package:web_ui/dwc.dart' as dwc; |
26 | 26 |
27 /** | 27 /** |
28 * Set up 'build.dart' to compile with the dart web components compiler every | 28 * Set up 'build.dart' to compile with the dart web components compiler every |
29 * [entryPoints] listed. On clean commands, the directory where [entryPoints] | 29 * [entryPoints] listed. On clean commands, the directory where [entryPoints] |
30 * live will be scanned for generated files to delete them. | 30 * live will be scanned for generated files to delete them. |
31 */ | 31 */ |
32 // TODO(jmesserly): we need a better way to automatically detect input files | 32 // TODO(jmesserly): we need a better way to automatically detect input files |
33 void build(List<String> arguments, List<String> entryPoints) { | 33 void build(List<String> arguments, List<String> entryPoints) { |
34 var args = _processArgs(arguments); | 34 var args = _processArgs(arguments); |
35 | 35 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ..addFlag("machine", negatable: false, | 112 ..addFlag("machine", negatable: false, |
113 help: "produce warnings in a machine parseable format") | 113 help: "produce warnings in a machine parseable format") |
114 ..addFlag("help", negatable: false, help: "displays this help and exit"); | 114 ..addFlag("help", negatable: false, help: "displays this help and exit"); |
115 var args = parser.parse(arguments); | 115 var args = parser.parse(arguments); |
116 if (args["help"]) { | 116 if (args["help"]) { |
117 print(parser.getUsage()); | 117 print(parser.getUsage()); |
118 exit(0); | 118 exit(0); |
119 } | 119 } |
120 return args; | 120 return args; |
121 } | 121 } |
OLD | NEW |