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 final _combinations = { | 8 final LINUX_COMBINATIONS = [ |
9 'linux': [ | 9 { |
10 { | 10 'runtimes': ['none'], |
11 'runtimes': ['none'], | 11 'modes': ['release'], |
12 'modes': ['release'], | 12 'archs': ['x64'], |
13 'archs': ['x64'], | 13 'compiler': 'dart2analyzer' |
14 'compiler': 'dart2analyzer' | 14 }, |
15 }, | 15 { |
16 { | 16 'runtimes': ['vm'], |
17 'runtimes': ['vm'], | 17 'modes': ['debug', 'release'], |
18 'modes': ['debug', 'release'], | 18 'archs': ['ia32', 'x64', 'simarm', 'simmips'], |
19 'archs': ['ia32', 'x64', 'simarm', 'simmips'], | 19 'compiler': 'none' |
20 'compiler': 'none' | 20 }, |
21 }, | 21 { |
22 { | 22 'runtimes': ['d8', 'jsshell', 'chrome', 'ff'], |
23 'runtimes': ['d8', 'jsshell', 'chrome', 'ff'], | 23 'modes': ['release'], |
24 'modes': ['release'], | 24 'archs': ['ia32'], |
25 'archs': ['ia32'], | 25 'compiler': 'dart2js' |
26 'compiler': 'dart2js' | 26 }, |
27 }, | 27 { |
28 { | 28 'runtimes': ['dartium'], |
29 'runtimes': ['dartium'], | 29 'modes': ['release', 'debug'], |
30 'modes': ['release', 'debug'], | 30 'archs': ['ia32'], |
31 'archs': ['ia32'], | 31 'compiler': 'none' |
32 'compiler': 'none' | 32 }, |
33 }, | 33 { |
34 { | 34 'runtimes': ['flutter_engine'], |
35 'runtimes': ['flutter_engine'], | 35 'modes': ['debug', 'release'], |
36 'modes': ['debug', 'release'], | 36 'archs': ['x64'], |
37 'archs': ['x64'], | 37 'compiler': 'none' |
38 'compiler': 'none' | 38 }, |
39 }, | 39 ]; |
40 ], | 40 |
41 'windows': [ | 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': ['chrome', 'ff', 'ie11', 'ie10'], | 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 'macos': [ | 61 |
62 { | 62 final WINDOWS_COMBINATIONS = [ |
63 'runtimes': ['vm'], | 63 { |
64 'modes': ['debug', 'release'], | 64 'runtimes': ['vm'], |
65 'archs': ['ia32', 'x64'], | 65 'modes': ['debug', 'release'], |
66 'compiler': 'none' | 66 'archs': ['ia32', 'x64'], |
67 }, | 67 'compiler': 'none' |
68 { | 68 }, |
69 'runtimes': ['safari', 'safarimobilesim'], | 69 { |
70 'modes': ['release'], | 70 'runtimes': ['chrome', 'ff', 'ie11', 'ie10'], |
71 'archs': ['ia32'], | 71 'modes': ['release'], |
72 'compiler': 'dart2js' | 72 'archs': ['ia32'], |
73 }, | 73 'compiler': 'dart2js' |
74 { | 74 }, |
75 'runtimes': ['dartium'], | 75 { |
76 'modes': ['release', 'debug'], | 76 'runtimes': ['dartium'], |
77 'archs': ['ia32'], | 77 'modes': ['release', 'debug'], |
78 'compiler': 'none' | 78 'archs': ['ia32'], |
79 }, | 79 'compiler': 'none' |
80 ] | 80 }, |
| 81 ]; |
| 82 |
| 83 final COMBINATIONS = { |
| 84 'linux': LINUX_COMBINATIONS, |
| 85 'windows': WINDOWS_COMBINATIONS, |
| 86 'macos': MACOS_COMBINATIONS |
81 }; | 87 }; |
82 | 88 |
| 89 List<Map> getCombinations() { |
| 90 return COMBINATIONS[Platform.operatingSystem]; |
| 91 } |
| 92 |
83 void ensureBuild(Iterable<String> modes, Iterable<String> archs) { | 93 void ensureBuild(Iterable<String> modes, Iterable<String> archs) { |
84 print('Building many platforms. Please be patient.'); | 94 print('Building many platforms. Please be patient.'); |
85 | 95 |
86 var archString = '-a${archs.join(',')}'; | 96 var archString = '-a${archs.join(',')}'; |
| 97 |
87 var modeString = '-m${modes.join(',')}'; | 98 var modeString = '-m${modes.join(',')}'; |
88 | 99 |
89 var args = [ | 100 var args = [ |
90 'tools/build.py', | 101 'tools/build.py', |
91 modeString, | 102 modeString, |
92 archString, | 103 archString, |
93 'create_sdk', | 104 'create_sdk', |
94 // We build runtime to be able to list cc tests. | 105 // We build runtime to be able to list cc tests |
95 'runtime' | 106 'runtime' |
96 ]; | 107 ]; |
97 | 108 |
98 print('Running: python ${args.join(" ")}'); | 109 print('Running: python ${args.join(" ")}'); |
99 | 110 |
100 var result = Process.runSync('python', args); | 111 var result = Process.runSync('python', args); |
101 | 112 |
102 if (result.exitCode != 0) { | 113 if (result.exitCode != 0) { |
103 print('ERROR'); | 114 print('ERROR'); |
104 print(result.stderr); | 115 print(result.stderr); |
105 throw new Exception('Error while building.'); | 116 throw new Exception('Error while building.'); |
106 } | 117 } |
107 print('Done building.'); | 118 print('Done building.'); |
108 } | 119 } |
109 | 120 |
110 void sanityCheck(String output) { | 121 void sanityCheck(String output) { |
111 var splitter = new LineSplitter(); | 122 LineSplitter splitter = new LineSplitter(); |
112 var lines = splitter.convert(output); | 123 var lines = splitter.convert(output); |
113 // Looks like this: | 124 // Looks like this: |
114 // Total: 15556 tests | 125 // Total: 15556 tests |
115 var total = int.parse(lines[0].split(' ')[1].trim()); | 126 var total = int.parse(lines[0].split(' ')[1].trim()); |
116 var count = 0; | 127 var count = 0; |
117 for (var i = 1; i < lines.length; i++) { | 128 for (var i = 1; i < lines.length; i++) { |
118 if (lines[i] == '') continue; | 129 if (lines[i] == '') continue; |
119 // Looks like this: | 130 // Looks like this: |
120 // * 3218 tests will be skipped (3047 skipped by design) | 131 // * 3218 tests will be skipped (3047 skipped by design) |
121 count += int.parse(lines[i].split(' ')[2].trim()); | 132 count += int.parse(lines[i].split(' ')[2].trim()); |
122 } | 133 } |
123 if (count != total) { | 134 if (count != total) { |
124 print('Count: $count, total: $total'); | 135 print('Count: $count, total: $total'); |
125 throw new Exception( | 136 throw new Exception( |
126 'Count and total do not align. Please validate manually.'); | 137 'Count and total do not align. Please validate manually.'); |
127 } | 138 } |
128 } | 139 } |
129 | 140 |
130 void main(List<String> args) { | 141 void main(List<String> args) { |
131 var combinations = _combinations[Platform.operatingSystem]; | 142 var combinations = getCombinations(); |
132 | 143 |
133 var arches = new Set<String>(); | 144 var arches = new Set<String>(); |
134 var modes = new Set<String>(); | 145 var modes = new Set<String>(); |
135 | 146 |
136 if (args.contains('--simple')) { | 147 if (args.contains('--simple')) { |
137 arches = ['ia32'].toSet(); | 148 arches = ['ia32'].toSet(); |
138 modes = ['release'].toSet(); | 149 modes = ['release'].toSet(); |
139 } else { | 150 } else { |
140 for (var combination in combinations) { | 151 for (var combo in combinations) { |
141 arches.addAll(combination['archs'] as List<String>); | 152 arches.addAll(combo['archs'] as List<String>); |
142 modes.addAll(combination['modes'] as List<String>); | 153 modes.addAll(combo['modes'] as List<String>); |
143 } | 154 } |
144 } | 155 } |
145 | 156 |
146 ensureBuild(modes, arches); | 157 ensureBuild(modes, arches); |
147 | 158 |
148 List<String> keys; | 159 List<String> keys; |
149 for (var combination in combinations) { | 160 for (var combination in combinations) { |
150 for (var mode in combination['modes']) { | 161 for (var mode in combination['modes']) { |
151 if (!modes.contains(mode)) { | 162 if (!modes.contains(mode)) { |
152 continue; | 163 continue; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 var pct = 100 * (value / total); | 218 var pct = 100 * (value / total); |
208 values.add('${pct.toStringAsFixed(3)}%'); | 219 values.add('${pct.toStringAsFixed(3)}%'); |
209 } | 220 } |
210 | 221 |
211 print(values.join(',')); | 222 print(values.join(',')); |
212 } | 223 } |
213 } | 224 } |
214 } | 225 } |
215 } | 226 } |
216 } | 227 } |
OLD | NEW |