Chromium Code Reviews| Index: pkg/polymer/lib/builder.dart |
| diff --git a/pkg/polymer/lib/builder.dart b/pkg/polymer/lib/builder.dart |
| index d4bacbb0be571761b60593981a1e6de07cb604d9..798b3081ad9ca9a35cc6de0020601465ee51dcb3 100644 |
| --- a/pkg/polymer/lib/builder.dart |
| +++ b/pkg/polymer/lib/builder.dart |
| @@ -144,7 +144,7 @@ Future lint({List<String> entryPoints, CommandLineOptions options, |
| String currentPackage, Map<String, String> packageDirs}) { |
| if (options == null) options = _options; |
| if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec(); |
| - var linterOptions = new TransformOptions(entryPoints); |
| + var linterOptions = new TransformOptions(entryPoints: entryPoints); |
| var formatter = options.machineFormat ? jsonFormatter : consoleFormatter; |
| var linter = new Linter(linterOptions, formatter); |
| return runBarback(new BarbackOptions([[linter]], null, |
| @@ -200,8 +200,14 @@ Future deploy({List<String> entryPoints, CommandLineOptions options, |
| String currentPackage, Map<String, String> packageDirs}) { |
| if (options == null) options = _options; |
| if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec(); |
| + |
| + var transformOptions = new TransformOptions( |
| + entryPoints: entryPoints, |
| + directlyIncludeJS: options.directlyIncludeJS, |
| + contentSecurityPolicy: options.contentSecurityPolicy); |
| + |
| var barbackOptions = new BarbackOptions( |
| - (new PolymerTransformerGroup(new TransformOptions(entryPoints))).phases, |
| + new PolymerTransformerGroup(transformOptions).phases, |
| options.outDir, currentPackage: currentPackage, |
| packageDirs: packageDirs); |
| return runBarback(barbackOptions) |
| @@ -235,8 +241,18 @@ class CommandLineOptions { |
| /** Location where to generate output files. */ |
| final String outDir; |
| + /** True to use the CSP-compliant JS file. */ |
| + final bool contentSecurityPolicy; |
| + |
| + /** |
| + * True to include the JS script tag directly, with the |
|
Siggi Cherem (dart-lang)
2013/10/21 21:07:42
with -> without?
Jennifer Messerly
2013/10/21 21:42:56
Done.
|
| + * "packages/browser/dart.js" trampoline. |
| + */ |
| + final bool directlyIncludeJS; |
| + |
| CommandLineOptions(this.changedFiles, this.removedFiles, this.clean, |
| - this.full, this.machineFormat, this.forceDeploy, this.outDir); |
| + this.full, this.machineFormat, this.forceDeploy, this.outDir, |
| + this.directlyIncludeJS, this.contentSecurityPolicy); |
| } |
| /** Options parsed directly from the command line arguments. */ |
| @@ -253,6 +269,10 @@ CommandLineOptions _options = parseOptions(); |
| * * `--machine`: produce output that can be parsed by tools, such as the Dart |
| * Editor. |
| * * `--deploy`: force deploy. |
| + * * `--no-js`: deploy replaces *.dart scripts with *.dart.js. This |
|
Siggi Cherem (dart-lang)
2013/10/21 21:07:42
remove 'no-'
blois
2013/10/21 21:08:12
comment is out of sync with code (--no-js vs --js)
Siggi Cherem (dart-lang)
2013/10/21 21:32:24
OK - after re-reading I understand this better. Fe
Jennifer Messerly
2013/10/21 21:42:56
the "--no-" prefix is from args.dart. it's how you
|
| + * flag leaves "packages/browser/dart.js" to do the replacement at runtime. |
| + * * `--csp`: replaces *.dart with *.dart.precompiled.js to comply with |
| + * Content Security Policy restrictions. |
| * * `--help`: print documentation for each option and exit. |
| * |
| * Currently not all the flags are used by [lint] or [deploy] above, but they |
| @@ -279,6 +299,13 @@ CommandLineOptions parseOptions([List<String> args]) { |
| help: 'Whether to force deploying.') |
| ..addOption('out', abbr: 'o', help: 'Directory to generate files into.', |
| defaultsTo: 'out') |
| + ..addFlag('js', help: |
| + 'deploy replaces *.dart scripts with *.dart.js. This flag \n' |
| + 'leaves "packages/browser/dart.js" to do the replacement at runtime.' |
| + defaultsTo: true) |
|
Siggi Cherem (dart-lang)
2013/10/21 21:07:42
eventually I agree that should be the default. I w
Jennifer Messerly
2013/10/21 21:42:56
it should. browser/dart.js needs to go away for 1.
|
| + ..addFlag('csp', help: |
| + 'replaces *.dart with *.dart.precompiled.js to comply with \n' |
| + 'Content Security Policy restrictions.'); |
| ..addFlag('help', abbr: 'h', |
| negatable: false, help: 'Displays this help and exit.'); |
| var res = parser.parse(args == null ? new Options().arguments : args); |
| @@ -290,5 +317,6 @@ CommandLineOptions parseOptions([List<String> args]) { |
| exit(0); |
| } |
| return new CommandLineOptions(res['changed'], res['removed'], res['clean'], |
| - res['full'], res['machine'], res['deploy'], res['out']); |
| + res['full'], res['machine'], res['deploy'], res['out'], res['js'], |
| + res['csp']); |
| } |