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

Side by Side Diff: pkg/polymer/lib/deploy.dart

Issue 157583007: Removing polymer-specific code from barback runner (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 * **Note**: If you already have a `build.dart` in your application, we 6 * **Note**: If you already have a `build.dart` in your application, we
7 * recommend to use the `package:polymer/builder.dart` library instead. 7 * recommend to use the `package:polymer/builder.dart` library instead.
8 8
9 * Temporary deploy command used to create a version of the app that can be 9 * Temporary deploy command used to create a version of the app that can be
10 * compiled with dart2js and deployed. Following pub layout conventions, this 10 * compiled with dart2js and deployed. Following pub layout conventions, this
11 * script will treat any HTML file under a package 'web/' and 'test/' 11 * script will treat any HTML file under a package 'web/' and 'test/'
12 * directories as entry points. 12 * directories as entry points.
13 * 13 *
14 * From an application package you can run deploy by creating a small program 14 * From an application package you can run deploy by creating a small program
15 * as follows: 15 * as follows:
16 * 16 *
17 * import "package:polymer/deploy.dart" as deploy; 17 * import "package:polymer/deploy.dart" as deploy;
18 * main() => deploy.main(); 18 * main() => deploy.main();
19 * 19 *
20 * This library should go away once `pub deploy` can be configured to run 20 * This library should go away once `pub deploy` can be configured to run
21 * barback transformers. 21 * barback transformers.
22 */ 22 */
23 library polymer.deploy; 23 library polymer.deploy;
24 24
25 import 'dart:async'; 25 import 'dart:async';
26 import 'dart:io'; 26 import 'dart:io';
27 27
28 import 'package:args/args.dart'; 28 import 'package:args/args.dart';
29 import 'package:path/path.dart' as path; 29 import 'package:path/path.dart' as path;
30 import 'src/build/common.dart' show TransformOptions; 30 import 'src/build/common.dart' show TransformOptions, polymerPhases;
31 import 'src/build/runner.dart'; 31 import 'src/build/runner.dart';
32 import 'transformer.dart'; 32 import 'transformer.dart';
33 33
34 main(List<String> arguments) { 34 main(List<String> arguments) {
35 var args = _parseArgs(arguments); 35 var args = _parseArgs(arguments);
36 if (args == null) exit(1); 36 if (args == null) exit(1);
37 37
38 var test = args['test']; 38 var test = args['test'];
39 var outDir = args['out']; 39 var outDir = args['out'];
40 40
41 var options; 41 var options;
42 if (test == null) { 42 if (test == null) {
43 var transformOps = new TransformOptions( 43 var transformOps = new TransformOptions(
44 directlyIncludeJS: args['js'], 44 directlyIncludeJS: args['js'],
45 contentSecurityPolicy: args['csp'], 45 contentSecurityPolicy: args['csp'],
46 releaseMode: !args['debug']); 46 releaseMode: !args['debug']);
47 options = new BarbackOptions(createDeployPhases(transformOps), outDir); 47 var phases = createDeployPhases(transformOps);
48 options = new BarbackOptions(phases, outDir,
49 packagePhases: {'polymer': phases});
Siggi Cherem (dart-lang) 2014/02/12 03:05:28 change this one too (phases => polymerPhases)
blois 2014/02/12 17:45:26 D'oh!
48 } else { 50 } else {
49 options = _createTestOptions( 51 options = _createTestOptions(
50 test, outDir, args['js'], args['csp'], !args['debug']); 52 test, outDir, args['js'], args['csp'], !args['debug']);
51 } 53 }
52 if (options == null) exit(1); 54 if (options == null) exit(1);
53 55
54 print('polymer/deploy.dart: creating a deploy target for ' 56 print('polymer/deploy.dart: creating a deploy target for '
55 '"${options.currentPackage}"'); 57 '"${options.currentPackage}"');
56 58
57 runBarback(options) 59 runBarback(options)
(...skipping 19 matching lines...) Expand all
77 var packageName = readCurrentPackageFromPubspec(pubspecDir); 79 var packageName = readCurrentPackageFromPubspec(pubspecDir);
78 80
79 var phases = createDeployPhases(new TransformOptions( 81 var phases = createDeployPhases(new TransformOptions(
80 entryPoints: [path.relative(testFile, from: pubspecDir)], 82 entryPoints: [path.relative(testFile, from: pubspecDir)],
81 directlyIncludeJS: directlyIncludeJS, 83 directlyIncludeJS: directlyIncludeJS,
82 contentSecurityPolicy: contentSecurityPolicy, 84 contentSecurityPolicy: contentSecurityPolicy,
83 releaseMode: releaseMode)); 85 releaseMode: releaseMode));
84 return new BarbackOptions(phases, outDir, 86 return new BarbackOptions(phases, outDir,
85 currentPackage: packageName, 87 currentPackage: packageName,
86 packageDirs: {packageName : pubspecDir}, 88 packageDirs: {packageName : pubspecDir},
89 packagePhases: {'polymer': polymerPhases},
87 transformTests: true); 90 transformTests: true);
88 } 91 }
89 92
90 String _findDirWithFile(String dir, String filename) { 93 String _findDirWithFile(String dir, String filename) {
91 while (!new File(path.join(dir, filename)).existsSync()) { 94 while (!new File(path.join(dir, filename)).existsSync()) {
92 var parentDir = path.dirname(dir); 95 var parentDir = path.dirname(dir);
93 // If we reached root and failed to find it, bail. 96 // If we reached root and failed to find it, bail.
94 if (parentDir == dir) return null; 97 if (parentDir == dir) return null;
95 dir = parentDir; 98 dir = parentDir;
96 } 99 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 _showUsage(parser); 138 _showUsage(parser);
136 return null; 139 return null;
137 } 140 }
138 } 141 }
139 142
140 _showUsage(parser) { 143 _showUsage(parser) {
141 print('Usage: dart --package-root=packages/ ' 144 print('Usage: dart --package-root=packages/ '
142 'package:polymer/deploy.dart [options]'); 145 'package:polymer/deploy.dart [options]');
143 print(parser.getUsage()); 146 print(parser.getUsage());
144 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698