Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: pkg/polymer/lib/builder.dart

Issue 29823005: fixes to polymer, gets tests back to a stable state (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer/lib/deploy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/builder.dart
diff --git a/pkg/polymer/lib/builder.dart b/pkg/polymer/lib/builder.dart
index d4bacbb0be571761b60593981a1e6de07cb604d9..32ad168b6c19fe0d5f0bd856d9610a54c5101d40 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, without the
+ * "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. You can turn
+ * this feature off with --no-js, which leaves "packages/browser/dart.js".
+ * * `--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)
+ ..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']);
}
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer/lib/deploy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698