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

Side by Side Diff: pkg/polymer/lib/src/build/runner.dart

Issue 489423002: Fix build.dart: sourceUrl used to be a String before the change to source_span (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// Definitions used to run the polymer linter and deploy tools without using 5 /// Definitions used to run the polymer linter and deploy tools without using
6 /// pub serve or pub deploy. 6 /// pub serve or pub deploy.
7 library polymer.src.build.runner; 7 library polymer.src.build.runner;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 /// Formatter that generates messages using a format that can be parsed 340 /// Formatter that generates messages using a format that can be parsed
341 /// by tools, such as the Dart Editor, for reporting error messages. 341 /// by tools, such as the Dart Editor, for reporting error messages.
342 String _jsonFormatter(LogEntry entry) { 342 String _jsonFormatter(LogEntry entry) {
343 var kind = _kindFromEntry(entry); 343 var kind = _kindFromEntry(entry);
344 var span = entry.span; 344 var span = entry.span;
345 return JSON.encode((span == null) 345 return JSON.encode((span == null)
346 ? [{'method': kind, 'params': {'message': entry.message}}] 346 ? [{'method': kind, 'params': {'message': entry.message}}]
347 : [{'method': kind, 347 : [{'method': kind,
348 'params': { 348 'params': {
349 'file': span.sourceUrl, 349 'file': span.sourceUrl.toString(),
350 'message': entry.message, 350 'message': entry.message,
351 'line': span.start.line + 1, 351 'line': span.start.line + 1,
352 'charStart': span.start.offset, 352 'charStart': span.start.offset,
353 'charEnd': span.end.offset, 353 'charEnd': span.end.offset,
354 }}]); 354 }}]);
355 } 355 }
356 356
357 /// Formatter that generates messages that are easy to read on the console (used 357 /// Formatter that generates messages that are easy to read on the console (used
358 /// by default). 358 /// by default).
359 String _consoleFormatter(LogEntry entry) { 359 String _consoleFormatter(LogEntry entry) {
360 var kind = _kindFromEntry(entry); 360 var kind = _kindFromEntry(entry);
361 var useColors = stdioType(stdout) == StdioType.TERMINAL; 361 var useColors = stdioType(stdout) == StdioType.TERMINAL;
362 var levelColor = (kind == 'error') ? _RED_COLOR : _MAGENTA_COLOR; 362 var levelColor = (kind == 'error') ? _RED_COLOR : _MAGENTA_COLOR;
363 var output = new StringBuffer(); 363 var output = new StringBuffer();
364 if (useColors) output.write(levelColor); 364 if (useColors) output.write(levelColor);
365 output..write(kind)..write(' '); 365 output..write(kind)..write(' ');
366 if (useColors) output.write(_NO_COLOR); 366 if (useColors) output.write(_NO_COLOR);
367 if (entry.span == null) { 367 if (entry.span == null) {
368 output.write(entry.message); 368 output.write(entry.message);
369 } else { 369 } else {
370 output.write(entry.span.message(entry.message, 370 output.write(entry.span.message(entry.message,
371 color: useColors ? levelColor : null)); 371 color: useColors ? levelColor : null));
372 } 372 }
373 return output.toString(); 373 return output.toString();
374 } 374 }
375 375
376 const String _RED_COLOR = '\u001b[31m'; 376 const String _RED_COLOR = '\u001b[31m';
377 const String _MAGENTA_COLOR = '\u001b[35m'; 377 const String _MAGENTA_COLOR = '\u001b[35m';
378 const String _NO_COLOR = '\u001b[0m'; 378 const String _NO_COLOR = '\u001b[0m';
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698