Chromium Code Reviews| 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 List<Map> LINUX_COMBINATIONS = [ |
| 9 { | 9 { |
| 10 'runtimes' : ['none'], | 10 'runtimes' : ['none'], |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 Map<String, List<Map>> COMBINATIONS = { | 83 Map<String, List<Map>> 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> archs) { | 93 void ensureBuild(Iterable<String> modes, Iterable<String> archs) { |
| 94 print('Building many platforms. Please be patient.'); | 94 print('Building many platforms. Please be patient.'); |
| 95 | 95 |
| 96 var archString = '-a${archs.join(',')}'; | 96 var archString = '-a${archs.join(',')}'; |
| 97 | 97 |
| 98 var args = ['tools/build.py', '-mrelease,debug', archString, 'create_sdk', | 98 var modeString = '-m${modes.join(',')}'; |
| 99 | |
| 100 var args = [ | |
| 101 'tools/build.py', | |
| 102 modeString, | |
| 103 archString, | |
| 104 'create_sdk', | |
| 99 // We build runtime to be able to list cc tests | 105 // We build runtime to be able to list cc tests |
| 100 'runtime']; | 106 'runtime' |
| 107 ]; | |
| 101 | 108 |
| 102 print('Running: python ${args.join(" ")}'); | 109 print('Running: python ${args.join(" ")}'); |
| 103 | 110 |
| 104 var result = Process.runSync('python', args); | 111 var result = Process.runSync('python', args); |
| 105 | 112 |
| 106 if (result.exitCode != 0) { | 113 if (result.exitCode != 0) { |
| 107 print('ERROR'); | 114 print('ERROR'); |
| 108 print(result.stderr); | 115 print(result.stderr); |
| 109 throw new Exception('Error while building.'); | 116 throw new Exception('Error while building.'); |
| 110 } | 117 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 127 if (count != total) { | 134 if (count != total) { |
| 128 print('Count: $count, total: $total'); | 135 print('Count: $count, total: $total'); |
| 129 throw new Exception( | 136 throw new Exception( |
| 130 'Count and total do not align. Please validate manually.'); | 137 'Count and total do not align. Please validate manually.'); |
| 131 } | 138 } |
| 132 } | 139 } |
| 133 | 140 |
| 134 void main(List<String> args) { | 141 void main(List<String> args) { |
| 135 var combinations = getCombinations(); | 142 var combinations = getCombinations(); |
| 136 | 143 |
| 137 var arches = combinations.fold(new Set<String>(), (set, value) { | 144 var arches = new Set<String>(); |
| 138 set.addAll(value['archs']); | 145 var modes = new Set<String>(); |
| 139 return set; | |
| 140 }); | |
| 141 | 146 |
| 142 ensureBuild(arches); | 147 if (args.contains('--simple')) { |
| 148 arches = ['ia32'].toSet(); | |
| 149 modes = ['release'].toSet(); | |
| 150 } else { | |
| 151 for (var combo in combinations) { | |
| 152 arches.addAll(combo['archs']); | |
| 153 modes.addAll(combo['modes']); | |
| 154 } | |
| 155 } | |
| 156 | |
| 157 ensureBuild(modes, arches); | |
| 143 | 158 |
| 144 List<String> keys; | 159 List<String> keys; |
| 145 for (var combination in combinations) { | 160 for (var combination in combinations) { |
| 146 for (var mode in combination['modes']) { | 161 for (var mode in combination['modes']) { |
|
ricow1
2015/02/27 10:34:56
why not just iterate modes?
kevmoo
2015/02/27 12:11:23
Because each combo may have a subset of all modes.
| |
| 162 if (!modes.contains(mode)) { | |
| 163 break; | |
|
ricow1
2015/03/02 07:43:42
don't you mean continue? I assume this just works
| |
| 164 } | |
| 165 | |
| 147 for (var arch in combination['archs']) { | 166 for (var arch in combination['archs']) { |
|
ricow1
2015/02/27 10:34:56
why not just iterate arches?
kevmoo
2015/02/27 12:11:23
Ditto :-)
| |
| 167 if (!arches.contains(arch)) { | |
| 168 break; | |
| 169 } | |
| 170 | |
| 148 for (var runtime in combination['runtimes']) { | 171 for (var runtime in combination['runtimes']) { |
| 149 var compiler = combination['compiler']; | 172 var compiler = combination['compiler']; |
| 150 | 173 |
| 151 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', | 174 var args = ['tools/test.py', '-m$mode', '-c$compiler', '-r$runtime', |
| 152 '-a$arch', '--report-in-json', '--use-sdk']; | 175 '-a$arch', '--report-in-json', '--use-sdk']; |
| 153 var result = Process.runSync('python', args); | 176 var result = Process.runSync('python', args); |
| 154 if (result.exitCode != 0) { | 177 if (result.exitCode != 0) { |
| 155 print(result.stdout); | 178 print(result.stdout); |
| 156 print(result.stderr); | 179 print(result.stderr); |
| 157 throw new Exception("Error running: ${args.join(" ")}"); | 180 throw new Exception("Error running: ${args.join(" ")}"); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 188 var pct = 100*(value/total); | 211 var pct = 100*(value/total); |
| 189 values.add('${pct.toStringAsFixed(3)}%'); | 212 values.add('${pct.toStringAsFixed(3)}%'); |
| 190 } | 213 } |
| 191 | 214 |
| 192 print(values.join(',')); | 215 print(values.join(',')); |
| 193 } | 216 } |
| 194 } | 217 } |
| 195 } | 218 } |
| 196 } | 219 } |
| 197 } | 220 } |
| OLD | NEW |