OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2017, 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 // Translates a buildbot shard name to the corresponding column group name | 6 // Translates a buildbot shard name to the corresponding column group name |
7 // on the buildbot site, such that it's easier to find the right column. | 7 // on the buildbot site, such that it's easier to find the right column. |
8 // | 8 // |
9 // Example: `dart bin/shard2group.dart precomp-linux-debug-x64-be` | 9 // Example: `dart bin/shard2group.dart precomp-linux-debug-x64-be` |
10 // prints `vm-precomp(5): precomp-linux-debug-x64-be`. | 10 // prints `vm-precomp(5): precomp-linux-debug-x64-be`. |
11 | 11 |
12 library gardening.shard2group; | 12 library gardening.shard2group; |
| 13 |
13 import 'dart:io'; | 14 import 'dart:io'; |
14 part 'package:gardening/src/shard_data.dart'; | 15 part 'package:gardening/src/shard_data.dart'; |
15 | 16 |
16 main(List<String> args) async { | 17 main(List<String> args) async { |
17 if (args.length == 0) { | 18 if (args.length == 0) { |
18 print('Usage: dart shard2group.dart <shard-name1> [<shard-name2> ...]'); | 19 print('Usage: dart shard2group.dart <shard-name1> [<shard-name2> ...]'); |
19 print('Run bin/create_shard_groups.dart to refresh shard data'); | 20 print('Run bin/create_shard_groups.dart to refresh shard data'); |
20 exit(1); | 21 exit(1); |
21 } | 22 } |
22 | 23 |
23 for (String arg in args) { | 24 for (String arg in args) { |
24 for (String group in shardGroups.keys) { | 25 for (String group in shardGroups.keys) { |
25 List<String> shardGroup = shardGroups[group]; | 26 List<String> shardGroup = shardGroups[group]; |
26 for (int i = 0; i < shardGroup.length; i++) { | 27 for (int i = 0; i < shardGroup.length; i++) { |
27 String shard = shardGroup[i]; | 28 String shard = shardGroup[i]; |
28 if (shard.contains(arg)) { | 29 if (shard.contains(arg)) { |
29 print("$group(${i+1}): $shard"); | 30 print("$group(${i+1}): $shard"); |
30 } | 31 } |
31 } | 32 } |
32 } | 33 } |
33 } | 34 } |
34 } | 35 } |
OLD | NEW |