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