| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 final bool contentSecurityPolicy; | 230 final bool contentSecurityPolicy; |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * True to include the JS script tag directly, without the | 233 * True to include the JS script tag directly, without the |
| 234 * "packages/browser/dart.js" trampoline. | 234 * "packages/browser/dart.js" trampoline. |
| 235 */ | 235 */ |
| 236 final bool directlyIncludeJS; | 236 final bool directlyIncludeJS; |
| 237 | 237 |
| 238 /** | 238 /** |
| 239 * Run transformers in release mode. For instance, uses the minified versions | 239 * Run transformers in release mode. For instance, uses the minified versions |
| 240 * of shadow_dom and custom-elements polyfills. | 240 * of the web_components polyfill. |
| 241 */ | 241 */ |
| 242 final bool releaseMode; | 242 final bool releaseMode; |
| 243 | 243 |
| 244 CommandLineOptions(this.changedFiles, this.removedFiles, this.clean, | 244 CommandLineOptions(this.changedFiles, this.removedFiles, this.clean, |
| 245 this.full, this.machineFormat, this.forceDeploy, this.outDir, | 245 this.full, this.machineFormat, this.forceDeploy, this.outDir, |
| 246 this.directlyIncludeJS, this.contentSecurityPolicy, | 246 this.directlyIncludeJS, this.contentSecurityPolicy, |
| 247 this.releaseMode); | 247 this.releaseMode); |
| 248 } | 248 } |
| 249 | 249 |
| 250 /** | 250 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', | 294 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', |
| 295 defaultsTo: 'out') | 295 defaultsTo: 'out') |
| 296 ..addFlag('js', help: | 296 ..addFlag('js', help: |
| 297 'deploy replaces *.dart scripts with *.dart.js. This flag \n' | 297 'deploy replaces *.dart scripts with *.dart.js. This flag \n' |
| 298 'leaves "packages/browser/dart.js" to do the replacement at runtime.', | 298 'leaves "packages/browser/dart.js" to do the replacement at runtime.', |
| 299 defaultsTo: true) | 299 defaultsTo: true) |
| 300 ..addFlag('csp', help: | 300 ..addFlag('csp', help: |
| 301 'replaces *.dart with *.dart.precompiled.js to comply with \n' | 301 'replaces *.dart with *.dart.precompiled.js to comply with \n' |
| 302 'Content Security Policy restrictions.') | 302 'Content Security Policy restrictions.') |
| 303 ..addFlag('debug', help: | 303 ..addFlag('debug', help: |
| 304 'run in debug mode. For example, use the debug versions of the \n' | 304 'run in debug mode. For example, use the debug polyfill \n' |
| 305 'polyfills (shadow_dom.debug.js and custom-elements.debug.js) \n' | 305 'web_components/platform.concat.js instead of the minified one.\n', |
| 306 'instead of the minified versions.', | |
| 307 defaultsTo: false) | 306 defaultsTo: false) |
| 308 ..addFlag('help', abbr: 'h', | 307 ..addFlag('help', abbr: 'h', |
| 309 negatable: false, help: 'Displays this help and exit.'); | 308 negatable: false, help: 'Displays this help and exit.'); |
| 310 | 309 |
| 311 showUsage() { | 310 showUsage() { |
| 312 print('Usage: dart build.dart [options]'); | 311 print('Usage: dart build.dart [options]'); |
| 313 print('\nThese are valid options expected by build.dart:'); | 312 print('\nThese are valid options expected by build.dart:'); |
| 314 print(parser.getUsage()); | 313 print(parser.getUsage()); |
| 315 } | 314 } |
| 316 | 315 |
| 317 var res; | 316 var res; |
| 318 try { | 317 try { |
| 319 res = parser.parse(args); | 318 res = parser.parse(args); |
| 320 } on FormatException catch (e) { | 319 } on FormatException catch (e) { |
| 321 print(e.message); | 320 print(e.message); |
| 322 showUsage(); | 321 showUsage(); |
| 323 exit(1); | 322 exit(1); |
| 324 } | 323 } |
| 325 if (res['help']) { | 324 if (res['help']) { |
| 326 print('A build script that invokes the polymer linter and deploy tools.'); | 325 print('A build script that invokes the polymer linter and deploy tools.'); |
| 327 showUsage(); | 326 showUsage(); |
| 328 exit(0); | 327 exit(0); |
| 329 } | 328 } |
| 330 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], | 329 return new CommandLineOptions(res['changed'], res['removed'], res['clean'], |
| 331 res['full'], res['machine'], res['deploy'], res['out'], res['js'], | 330 res['full'], res['machine'], res['deploy'], res['out'], res['js'], |
| 332 res['csp'], !res['debug']); | 331 res['csp'], !res['debug']); |
| 333 } | 332 } |
| OLD | NEW |