| 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 run the polymer linter and deploy tool. | 6 * Common logic to make it easy to run the polymer linter and deploy tool. |
| 7 * | 7 * |
| 8 * The functions in this library are designed to make it easier to create | 8 * The functions in this library are designed to make it easier to create |
| 9 * `build.dart` files. A `build.dart` file is a Dart script that can be invoked | 9 * `build.dart` files. A `build.dart` file is a Dart script that can be invoked |
| 10 * from the command line, but that can also invoked automatically by the Dart | 10 * from the command line, but that can also invoked automatically by the Dart |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 * lint().then((_) => deploy()); | 42 * lint().then((_) => deploy()); |
| 43 * } | 43 * } |
| 44 * | 44 * |
| 45 * **Example 3**: Runs the linter, but conditionally does the deploy step. See | 45 * **Example 3**: Runs the linter, but conditionally does the deploy step. See |
| 46 * [parseOptions] for a description of options parsed automatically by this | 46 * [parseOptions] for a description of options parsed automatically by this |
| 47 * helper library. | 47 * helper library. |
| 48 * | 48 * |
| 49 * import 'dart:io'; | 49 * import 'dart:io'; |
| 50 * import 'package:polymer/builder.dart'; | 50 * import 'package:polymer/builder.dart'; |
| 51 * | 51 * |
| 52 * main() { | 52 * main(args) { |
| 53 * var options = parseOptions(); | 53 * var options = parseOptions(args); |
| 54 * lint().then((_) { | 54 * lint().then((_) { |
| 55 * if (options.forceDeploy) deploy(); | 55 * if (options.forceDeploy) deploy(); |
| 56 * }); | 56 * }); |
| 57 * } | 57 * } |
| 58 * | 58 * |
| 59 * **Example 4**: Same as above, but uses [build] (which internally calls [lint] | 59 * **Example 4**: Same as above, but uses [build] (which internally calls [lint] |
| 60 * and optionally calls [deploy]). | 60 * and optionally calls [deploy]). |
| 61 * | 61 * |
| 62 * import 'dart:io'; | 62 * import 'dart:io'; |
| 63 * import 'package:polymer/builder.dart'; | 63 * import 'package:polymer/builder.dart'; |
| 64 * | 64 * |
| 65 * main() { | 65 * main(args) { |
| 66 * build(); | 66 * build(options: parseOptions(args)); |
| 67 * } | 67 * } |
| 68 * | 68 * |
| 69 * **Example 5**: Like the previous example, but indicates to the linter and | 69 * **Example 5**: Like the previous example, but indicates to the linter and |
| 70 * deploy tool which files are actually used as entry point files. See the | 70 * deploy tool which files are actually used as entry point files. See the |
| 71 * documentation of [build] below for more details. | 71 * documentation of [build] below for more details. |
| 72 * | 72 * |
| 73 * import 'dart:io'; | 73 * import 'dart:io'; |
| 74 * import 'package:polymer/builder.dart'; | 74 * import 'package:polymer/builder.dart'; |
| 75 * | 75 * |
| 76 * main() { | 76 * main(args) { |
| 77 * build(entryPoints: ['web/index.html']); | 77 * build(entryPoints: ['web/index.html'], options: parseOptions(args)); |
| 78 * } | 78 * } |
| 79 */ | 79 */ |
| 80 library polymer.builder; | 80 library polymer.builder; |
| 81 | 81 |
| 82 import 'dart:async'; | 82 import 'dart:async'; |
| 83 import 'dart:io'; | 83 import 'dart:io'; |
| 84 | 84 |
| 85 import 'package:args/args.dart'; | 85 import 'package:args/args.dart'; |
| 86 | 86 |
| 87 import 'src/build/linter.dart'; | 87 import 'src/build/linter.dart'; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 339 } |
| 340 if (res['help']) { | 340 if (res['help']) { |
| 341 print('A build script that invokes the polymer linter and deploy tools.'); | 341 print('A build script that invokes the polymer linter and deploy tools.'); |
| 342 showUsage(); | 342 showUsage(); |
| 343 exit(0); | 343 exit(0); |
| 344 } | 344 } |
| 345 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], | 345 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], |
| 346 res['full'], res['machine'], res['deploy'], res['out'], res['js'], | 346 res['full'], res['machine'], res['deploy'], res['out'], res['js'], |
| 347 res['csp']); | 347 res['csp']); |
| 348 } | 348 } |
| OLD | NEW |