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

Side by Side Diff: example/explainer/build_examples.dart

Issue 11092092: Support compiling templates in the browser. Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « bin/dwc_browser.dart ('k') | extension/background.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 /** 6 /**
7 * Script to compile each dart web component examples and copy the 7 * Script to compile each dart web component examples and copy the
8 * generated code to an output directory. 8 * generated code to an output directory.
9 */ 9 */
10 library build_examples; 10 library build_examples;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var processes = inputs.map((input) => buildSingle(input, output)); 50 var processes = inputs.map((input) => buildSingle(input, output));
51 Futures.wait(processes) 51 Futures.wait(processes)
52 .then((_) { 52 .then((_) {
53 print('----- time summary -----'); 53 print('----- time summary -----');
54 totalTime.forEach((s) => print(s)); 54 totalTime.forEach((s) => print(s));
55 }); 55 });
56 } 56 }
57 57
58 Future buildSingle(String input, String output) { 58 Future buildSingle(String input, String output) {
59 var timer = startTime(); 59 var timer = startTime();
60 dwc.run([input, output]); 60 return dwc.run([input, output]).chain((_) {
61 stopTime(timer, 'dwc - compile $input'); 61 stopTime(timer, 'dwc - compile $input');
62 62
63 timer = startTime(); 63 timer = startTime();
64 var dartFile ='$output/${input}_bootstrap.dart'; 64 var dartFile ='$output/_${input}_bootstrap.dart';
65 var res = Process.run('dart2js', ['-ppackages/', dartFile, '-o$dartFile.js']); 65 var res = Process.run('dart2js', ['-ppackages/', dartFile, '-o$dartFile.js'] );
66 return res.transform((r) { 66 return res.transform((r) {
67 if (r.exitCode != 0) { 67 if (r.exitCode != 0) {
68 print(r.stdout); 68 print(r.stdout);
69 print(r.stderr); 69 print(r.stderr);
70 } 70 }
71 stopTime(timer, 'dart2js - compile ${input}_boostrap.dart'); 71 stopTime(timer, 'dart2js - compile ${input}_boostrap.dart');
72 });
72 }); 73 });
73 } 74 }
74 75
75 76
76 final String GREEN_COLOR = '\u001b[32m'; 77 final String GREEN_COLOR = '\u001b[32m';
77 final String NO_COLOR = '\u001b[0m'; 78 final String NO_COLOR = '\u001b[0m';
78 79
79 Stopwatch startTime() => new Stopwatch()..start(); 80 Stopwatch startTime() => new Stopwatch()..start();
80 81
81 void stopTime(Stopwatch watch, String message) { 82 void stopTime(Stopwatch watch, String message) {
82 watch.stop(); 83 watch.stop();
83 var duration = watch.elapsedInMs(); 84 var duration = watch.elapsedInMs();
84 print('$message: $GREEN_COLOR$duration ms$NO_COLOR'); 85 print('$message: $GREEN_COLOR$duration ms$NO_COLOR');
85 totalTime.add('$message: $GREEN_COLOR$duration ms$NO_COLOR'); 86 totalTime.add('$message: $GREEN_COLOR$duration ms$NO_COLOR');
86 } 87 }
OLDNEW
« no previous file with comments | « bin/dwc_browser.dart ('k') | extension/background.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698