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

Unified Diff: lib/component_build.dart

Issue 11450020: (Fix #215) better error printing in editor & extension, adds mapping for editor (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years 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
Index: lib/component_build.dart
diff --git a/lib/component_build.dart b/lib/component_build.dart
index 9b972d37e2c891cefe69d0503449cd4d7206fec1..8eea65215532089143fa824204c50fc6344b1a84 100644
--- a/lib/component_build.dart
+++ b/lib/component_build.dart
@@ -37,6 +37,7 @@ void build(List<String> arguments, List<String> entryPoints) {
var changedFiles = args["changed"];
var removedFiles = args["removed"];
var cleanBuild = args["clean"];
+ var machineFormat = args["machine"];
var fullBuild = changedFiles.isEmpty && removedFiles.isEmpty && !cleanBuild;
for (var file in entryPoints) {
@@ -47,11 +48,21 @@ void build(List<String> arguments, List<String> entryPoints) {
_handleCleanCommand(trackDirs);
} else if (fullBuild || changedFiles.some((f) => _isInputFile(f, trackDirs))
|| removedFiles.some((f) => _isInputFile(f, trackDirs))) {
- // TODO(sigmund): allow colors if we find a way to detect reliably where
- // colors are supported (e.g. we are not running in the editor or in
- // windows)
for (var file in entryPoints) {
- dwc.run(['--no-colors', '-o', _outDir(file), file]);
+ var path = new Path(file);
+ var outDir = path.directoryPath.append('out');
+ var args = [];
+ if (machineFormat) args.add('--json_format');
+ if (Platform.operatingSystem == 'windows') args.add('--no-colors');
+ args.addAll(['-o', outDir.toString(), file]);
+ dwc.run(args);
+
+ if (machineFormat) {
+ // Print for the Dart Editor the mapping from the input entry point file
+ // and its corresponding output.
+ var out = outDir.append(path.filename);
+ print('[{"method":"mapping","params":{"from":"$file","to":"$out"}}]');
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698