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

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

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 3 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 * Temporary deploy command used to create a version of the app that can be 6 * Temporary deploy command used to create a version of the app that can be
7 * compiled with dart2js and deployed. This library should go away once `pub 7 * compiled with dart2js and deployed. This library should go away once `pub
8 * deploy` can be configured to run barback transformers. 8 * deploy` can be configured to run barback transformers.
9 * 9 *
10 * From an application package you can run this program by calling dart with a 10 * From an application package you can run this program by calling dart with a
11 * 'package:' url to this file: 11 * 'package:' url to this file:
12 * 12 *
13 * dart package:polymer/deploy.dart 13 * dart package:polymer/deploy.dart
14 */ 14 */
15 library polymer.deploy; 15 library polymer.deploy;
16 16
17 import 'dart:async'; 17 import 'dart:async';
18 import 'dart:convert';
18 import 'dart:io'; 19 import 'dart:io';
19 import 'dart:json' as json;
20 20
21 import 'package:barback/barback.dart'; 21 import 'package:barback/barback.dart';
22 import 'package:path/path.dart' as path; 22 import 'package:path/path.dart' as path;
23 import 'package:polymer/src/transform.dart' show phases; 23 import 'package:polymer/src/transform.dart' show phases;
24 import 'package:stack_trace/stack_trace.dart'; 24 import 'package:stack_trace/stack_trace.dart';
25 import 'package:yaml/yaml.dart'; 25 import 'package:yaml/yaml.dart';
26 import 'package:args/args.dart'; 26 import 'package:args/args.dart';
27 27
28 main() { 28 main() {
29 var args = _parseArgs(); 29 var args = _parseArgs();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Map<String, String> _packageDirs = () { 175 Map<String, String> _packageDirs = () {
176 var pub = path.join(path.dirname(new Options().executable), 176 var pub = path.join(path.dirname(new Options().executable),
177 Platform.isWindows ? 'pub.bat' : 'pub'); 177 Platform.isWindows ? 'pub.bat' : 'pub');
178 var result = Process.runSync(pub, ['list-package-dirs']); 178 var result = Process.runSync(pub, ['list-package-dirs']);
179 if (result.exitCode != 0) { 179 if (result.exitCode != 0) {
180 print("unexpected error invoking 'pub':"); 180 print("unexpected error invoking 'pub':");
181 print(result.stdout); 181 print(result.stdout);
182 print(result.stderr); 182 print(result.stderr);
183 exit(result.exitCode); 183 exit(result.exitCode);
184 } 184 }
185 var map = json.parse(result.stdout)["packages"]; 185 var map = JSON.decode(result.stdout)["packages"];
186 map.forEach((k, v) { map[k] = path.dirname(v); }); 186 map.forEach((k, v) { map[k] = path.dirname(v); });
187 map[_currentPackage] = '.'; 187 map[_currentPackage] = '.';
188 return map; 188 return map;
189 }(); 189 }();
190 190
191 /** 191 /**
192 * Internal packages used by polymer which we can copy directly to the output 192 * Internal packages used by polymer which we can copy directly to the output
193 * folder without having to process them with barback. 193 * folder without having to process them with barback.
194 */ 194 */
195 // TODO(sigmund): consider computing this list by recursively parsing 195 // TODO(sigmund): consider computing this list by recursively parsing
(...skipping 24 matching lines...) Expand all
220 print(e.message); 220 print(e.message);
221 _showUsage(parser); 221 _showUsage(parser);
222 return null; 222 return null;
223 } 223 }
224 } 224 }
225 225
226 _showUsage(parser) { 226 _showUsage(parser) {
227 print('Usage: dart package:polymer/deploy.dart [options]'); 227 print('Usage: dart package:polymer/deploy.dart [options]');
228 print(parser.getUsage()); 228 print(parser.getUsage());
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698