| 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 /// Common logic to make it easy to run the polymer linter and deploy tool. | 5 /// Common logic to make it easy to run the polymer linter and deploy tool. |
| 6 /// | 6 /// |
| 7 /// The functions in this library are designed to make it easier to create | 7 /// The functions in this library are designed to make it easier to create |
| 8 /// `build.dart` files. A `build.dart` file is a Dart script that can be invoked | 8 /// `build.dart` files. A `build.dart` file is a Dart script that can be invoked |
| 9 /// from the command line, but that can also invoked automatically by the Dart | 9 /// from the command line, but that can also invoked automatically by the Dart |
| 10 /// Editor whenever a file in your project changes or when selecting some menu | 10 /// Editor whenever a file in your project changes or when selecting some menu |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 /// | 249 /// |
| 250 /// * `--changed file-path`: notify of a file change. | 250 /// * `--changed file-path`: notify of a file change. |
| 251 /// * `--removed file-path`: notify that a file was removed. | 251 /// * `--removed file-path`: notify that a file was removed. |
| 252 /// * `--clean`: remove temporary artifacts (if any) | 252 /// * `--clean`: remove temporary artifacts (if any) |
| 253 /// * `--full`: build everything, similar to marking every file as changed | 253 /// * `--full`: build everything, similar to marking every file as changed |
| 254 /// * `--machine`: produce output that can be parsed by tools, such as the | 254 /// * `--machine`: produce output that can be parsed by tools, such as the |
| 255 /// Dart Editor. | 255 /// Dart Editor. |
| 256 /// * `--deploy`: force deploy. | 256 /// * `--deploy`: force deploy. |
| 257 /// * `--no-js`: deploy replaces *.dart scripts with *.dart.js. You can turn | 257 /// * `--no-js`: deploy replaces *.dart scripts with *.dart.js. You can turn |
| 258 /// this feature off with --no-js, which leaves "packages/browser/dart.js". | 258 /// this feature off with --no-js, which leaves "packages/browser/dart.js". |
| 259 /// * `--csp`: replaces *.dart with *.dart.precompiled.js to comply with | 259 /// * `--csp`: extracts inlined JavaScript code to comply with Content |
| 260 /// Content Security Policy restrictions. | 260 /// Security Policy restrictions. |
| 261 /// * `--help`: print documentation for each option and exit. | 261 /// * `--help`: print documentation for each option and exit. |
| 262 /// | 262 /// |
| 263 /// Currently not all the flags are used by [lint] or [deploy] above, but they | 263 /// Currently not all the flags are used by [lint] or [deploy] above, but they |
| 264 /// are available so they can be used from your `build.dart`. For instance, see | 264 /// are available so they can be used from your `build.dart`. For instance, see |
| 265 /// the top-level library documentation for an example that uses the | 265 /// the top-level library documentation for an example that uses the |
| 266 /// force-deploy option to conditionally call [deploy]. | 266 /// force-deploy option to conditionally call [deploy]. |
| 267 /// | 267 /// |
| 268 /// If this documentation becomes out of date, the best way to discover which | 268 /// If this documentation becomes out of date, the best way to discover which |
| 269 /// flags are supported is to invoke this function from your build.dart, and run | 269 /// flags are supported is to invoke this function from your build.dart, and run |
| 270 /// it with the `--help` command-line flag. | 270 /// it with the `--help` command-line flag. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 286 help: 'Produce warnings in a machine parseable format.') | 286 help: 'Produce warnings in a machine parseable format.') |
| 287 ..addFlag('deploy', negatable: false, | 287 ..addFlag('deploy', negatable: false, |
| 288 help: 'Whether to force deploying.') | 288 help: 'Whether to force deploying.') |
| 289 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', | 289 ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', |
| 290 defaultsTo: 'out') | 290 defaultsTo: 'out') |
| 291 ..addFlag('js', help: | 291 ..addFlag('js', help: |
| 292 'deploy replaces *.dart scripts with *.dart.js. This flag \n' | 292 'deploy replaces *.dart scripts with *.dart.js. This flag \n' |
| 293 'leaves "packages/browser/dart.js" to do the replacement at runtime.', | 293 'leaves "packages/browser/dart.js" to do the replacement at runtime.', |
| 294 defaultsTo: true) | 294 defaultsTo: true) |
| 295 ..addFlag('csp', help: | 295 ..addFlag('csp', help: |
| 296 'replaces *.dart with *.dart.precompiled.js to comply with \n' | 296 'extracts inlined JavaScript code to comply with \n' |
| 297 'Content Security Policy restrictions.') | 297 'Content Security Policy restrictions.') |
| 298 ..addFlag('debug', help: | 298 ..addFlag('debug', help: |
| 299 'run in debug mode. For example, use the debug polyfill \n' | 299 'run in debug mode. For example, use the debug polyfill \n' |
| 300 'web_components/platform.concat.js instead of the minified one.\n', | 300 'web_components/platform.concat.js instead of the minified one.\n', |
| 301 defaultsTo: false) | 301 defaultsTo: false) |
| 302 ..addFlag('help', abbr: 'h', | 302 ..addFlag('help', abbr: 'h', |
| 303 negatable: false, help: 'Displays this help and exit.'); | 303 negatable: false, help: 'Displays this help and exit.'); |
| 304 | 304 |
| 305 showUsage() { | 305 showUsage() { |
| 306 print('Usage: dart build.dart [options]'); | 306 print('Usage: dart build.dart [options]'); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 var polymer = t['polymer']; | 346 var polymer = t['polymer']; |
| 347 if (polymer == null || polymer is! Map) return; | 347 if (polymer == null || polymer is! Map) return; |
| 348 | 348 |
| 349 var parsedEntryPoints = readFileList(polymer['entry_points']); | 349 var parsedEntryPoints = readFileList(polymer['entry_points']); |
| 350 if (parsedEntryPoints == null) return; | 350 if (parsedEntryPoints == null) return; |
| 351 | 351 |
| 352 entryPoints.addAll(parsedEntryPoints); | 352 entryPoints.addAll(parsedEntryPoints); |
| 353 }); | 353 }); |
| 354 return entryPoints.isEmpty ? null : entryPoints; | 354 return entryPoints.isEmpty ? null : entryPoints; |
| 355 } | 355 } |
| OLD | NEW |