| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 help: 'Remove any build artifacts (if any).') | 294 help: 'Remove any build artifacts (if any).') |
| 295 ..addFlag('full', negatable: false, help: 'perform a full build') | 295 ..addFlag('full', negatable: false, help: 'perform a full build') |
| 296 ..addFlag('machine', negatable: false, | 296 ..addFlag('machine', negatable: false, |
| 297 help: 'Produce warnings in a machine parseable format.') | 297 help: 'Produce warnings in a machine parseable format.') |
| 298 ..addFlag('deploy', negatable: false, | 298 ..addFlag('deploy', negatable: false, |
| 299 help: 'Whether to force deploying.') | 299 help: 'Whether to force deploying.') |
| 300 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', | 300 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', |
| 301 defaultsTo: 'out') | 301 defaultsTo: 'out') |
| 302 ..addFlag('js', help: | 302 ..addFlag('js', help: |
| 303 'deploy replaces *.dart scripts with *.dart.js. This flag \n' | 303 'deploy replaces *.dart scripts with *.dart.js. This flag \n' |
| 304 'leaves "packages/browser/dart.js" to do the replacement at runtime.' | 304 'leaves "packages/browser/dart.js" to do the replacement at runtime.', |
| 305 defaultsTo: true) | 305 defaultsTo: true) |
| 306 ..addFlag('csp', help: | 306 ..addFlag('csp', help: |
| 307 'replaces *.dart with *.dart.precompiled.js to comply with \n' | 307 'replaces *.dart with *.dart.precompiled.js to comply with \n' |
| 308 'Content Security Policy restrictions.'); | 308 'Content Security Policy restrictions.') |
| 309 ..addFlag('help', abbr: 'h', | 309 ..addFlag('help', abbr: 'h', |
| 310 negatable: false, help: 'Displays this help and exit.'); | 310 negatable: false, help: 'Displays this help and exit.'); |
| 311 var res = parser.parse(args == null ? new Options().arguments : args); | 311 |
| 312 if (res['help']) { | 312 showUsage() { |
| 313 print('A build script that invokes the polymer linter and deploy tools.'); | |
| 314 print('Usage: dart build.dart [options]'); | 313 print('Usage: dart build.dart [options]'); |
| 315 print('\nThese are valid options expected by build.dart:'); | 314 print('\nThese are valid options expected by build.dart:'); |
| 316 print(parser.getUsage()); | 315 print(parser.getUsage()); |
| 316 } |
| 317 |
| 318 var res; |
| 319 try { |
| 320 res = parser.parse(args == null ? new Options().arguments : args); |
| 321 } on FormatException catch (e) { |
| 322 print(e.message); |
| 323 showUsage(); |
| 324 exit(1); |
| 325 } |
| 326 if (res['help']) { |
| 327 print('A build script that invokes the polymer linter and deploy tools.'); |
| 328 showUsage(); |
| 317 exit(0); | 329 exit(0); |
| 318 } | 330 } |
| 319 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], | 331 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], |
| 320 res['full'], res['machine'], res['deploy'], res['out'], res['js'], | 332 res['full'], res['machine'], res['deploy'], res['out'], res['js'], |
| 321 res['csp']); | 333 res['csp']); |
| 322 } | 334 } |
| OLD | NEW |