OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 List<Map> LINUX_COMBINATIONS = [ | 8 final LINUX_COMBINATIONS = [ |
9 { | 9 { |
10 'runtimes': ['none'], | 10 'runtimes': ['none'], |
11 'modes': ['release'], | 11 'modes': ['release'], |
12 'archs': ['x64'], | 12 'archs': ['x64'], |
13 'compiler': 'dart2analyzer' | 13 'compiler': 'dart2analyzer' |
14 }, | 14 }, |
15 { | 15 { |
16 'runtimes': ['vm'], | 16 'runtimes': ['vm'], |
17 'modes': ['debug', 'release'], | 17 'modes': ['debug', 'release'], |
18 'archs': ['ia32', 'x64', 'simarm', 'simmips'], | 18 'archs': ['ia32', 'x64', 'simarm', 'simmips'], |
(...skipping 12 matching lines...) Expand all Loading... |
31 'compiler': 'none' | 31 'compiler': 'none' |
32 }, | 32 }, |
33 { | 33 { |
34 'runtimes': ['flutter_engine'], | 34 'runtimes': ['flutter_engine'], |
35 'modes': ['debug', 'release'], | 35 'modes': ['debug', 'release'], |
36 'archs': ['x64'], | 36 'archs': ['x64'], |
37 'compiler': 'none' | 37 'compiler': 'none' |
38 }, | 38 }, |
39 ]; | 39 ]; |
40 | 40 |
41 List<Map> MACOS_COMBINATIONS = [ | 41 final MACOS_COMBINATIONS = [ |
42 { | 42 { |
43 'runtimes': ['vm'], | 43 'runtimes': ['vm'], |
44 'modes': ['debug', 'release'], | 44 'modes': ['debug', 'release'], |
45 'archs': ['ia32', 'x64'], | 45 'archs': ['ia32', 'x64'], |
46 'compiler': 'none' | 46 'compiler': 'none' |
47 }, | 47 }, |
48 { | 48 { |
49 'runtimes': ['safari', 'safarimobilesim'], | 49 'runtimes': ['safari', 'safarimobilesim'], |
50 'modes': ['release'], | 50 'modes': ['release'], |
51 'archs': ['ia32'], | 51 'archs': ['ia32'], |
52 'compiler': 'dart2js' | 52 'compiler': 'dart2js' |
53 }, | 53 }, |
54 { | 54 { |
55 'runtimes': ['dartium'], | 55 'runtimes': ['dartium'], |
56 'modes': ['release', 'debug'], | 56 'modes': ['release', 'debug'], |
57 'archs': ['ia32'], | 57 'archs': ['ia32'], |
58 'compiler': 'none' | 58 'compiler': 'none' |
59 }, | 59 }, |
60 ]; | 60 ]; |
61 | 61 |
62 List<Map> WINDOWS_COMBINATIONS = [ | 62 final WINDOWS_COMBINATIONS = [ |
63 { | 63 { |
64 'runtimes': ['vm'], | 64 'runtimes': ['vm'], |
65 'modes': ['debug', 'release'], | 65 'modes': ['debug', 'release'], |
66 'archs': ['ia32', 'x64'], | 66 'archs': ['ia32', 'x64'], |
67 'compiler': 'none' | 67 'compiler': 'none' |
68 }, | 68 }, |
69 { | 69 { |
70 'runtimes': ['chrome', 'ff', 'ie11', 'ie10'], | 70 'runtimes': ['chrome', 'ff', 'ie11', 'ie10'], |
71 'modes': ['release'], | 71 'modes': ['release'], |
72 'archs': ['ia32'], | 72 'archs': ['ia32'], |
73 'compiler': 'dart2js' | 73 'compiler': 'dart2js' |
74 }, | 74 }, |
75 { | 75 { |
76 'runtimes': ['dartium'], | 76 'runtimes': ['dartium'], |
77 'modes': ['release', 'debug'], | 77 'modes': ['release', 'debug'], |
78 'archs': ['ia32'], | 78 'archs': ['ia32'], |
79 'compiler': 'none' | 79 'compiler': 'none' |
80 }, | 80 }, |
81 ]; | 81 ]; |
82 | 82 |
83 Map<String, List<Map>> COMBINATIONS = { | 83 final COMBINATIONS = { |
84 'linux': LINUX_COMBINATIONS, | 84 'linux': LINUX_COMBINATIONS, |
85 'windows': WINDOWS_COMBINATIONS, | 85 'windows': WINDOWS_COMBINATIONS, |
86 'macos': MACOS_COMBINATIONS | 86 'macos': MACOS_COMBINATIONS |
87 }; | 87 }; |
88 | 88 |
89 List<Map> getCombinations() { | 89 List<Map> getCombinations() { |
90 return COMBINATIONS[Platform.operatingSystem]; | 90 return COMBINATIONS[Platform.operatingSystem]; |
91 } | 91 } |
92 | 92 |
93 void ensureBuild(Iterable<String> modes, Iterable<String> archs) { | 93 void ensureBuild(Iterable<String> modes, Iterable<String> archs) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 print(result.stderr); | 186 print(result.stderr); |
187 throw new Exception("Error running: ${args.join(" ")}"); | 187 throw new Exception("Error running: ${args.join(" ")}"); |
188 } | 188 } |
189 | 189 |
190 // Find "JSON:" | 190 // Find "JSON:" |
191 // Everything after will the JSON-formatted output | 191 // Everything after will the JSON-formatted output |
192 // per --report-in-json flag above | 192 // per --report-in-json flag above |
193 var totalIndex = result.stdout.indexOf('JSON:'); | 193 var totalIndex = result.stdout.indexOf('JSON:'); |
194 var report = result.stdout.substring(totalIndex + 5); | 194 var report = result.stdout.substring(totalIndex + 5); |
195 | 195 |
196 var map = JSON.decode(report) as Map; | 196 var map = JSON.decode(report) as Map<String, int>; |
197 | 197 |
198 if (keys == null) { | 198 if (keys == null) { |
199 keys = map.keys.toList(); | 199 keys = map.keys.toList(); |
200 var firstKey = keys.removeAt(0); | 200 var firstKey = keys.removeAt(0); |
201 if (firstKey != 'total') { | 201 if (firstKey != 'total') { |
202 throw '"total" should be the first key'; | 202 throw '"total" should be the first key'; |
203 } | 203 } |
204 | 204 |
205 var headers = ['compiler', 'runtime', 'arch', 'mode', 'total']; | 205 var headers = ['compiler', 'runtime', 'arch', 'mode', 'total']; |
206 for (var k in keys) { | 206 for (var k in keys) { |
(...skipping 11 matching lines...) Expand all Loading... |
218 var pct = 100 * (value / total); | 218 var pct = 100 * (value / total); |
219 values.add('${pct.toStringAsFixed(3)}%'); | 219 values.add('${pct.toStringAsFixed(3)}%'); |
220 } | 220 } |
221 | 221 |
222 print(values.join(',')); | 222 print(values.join(',')); |
223 } | 223 } |
224 } | 224 } |
225 } | 225 } |
226 } | 226 } |
227 } | 227 } |
OLD | NEW |