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: `bin/find_shard.dart precomp-linux-debug-x64-be` | 9 // Example: `bin/find_shard.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 import 'dart:async'; |
12 import 'dart:io'; | 13 import 'dart:io'; |
13 import 'package:args/args.dart'; | 14 import 'package:args/args.dart'; |
14 import 'package:gardening/src/shard_data.dart'; | 15 import 'package:gardening/src/shard_data.dart'; |
15 | 16 |
16 ArgParser createArgParser() { | 17 ArgParser createArgParser() { |
17 ArgParser argParser = new ArgParser(allowTrailingOptions: true); | 18 ArgParser argParser = new ArgParser(allowTrailingOptions: true); |
18 argParser.addFlag('help', help: "Help"); | 19 argParser.addFlag('help', help: "Help"); |
19 return argParser; | 20 return argParser; |
20 } | 21 } |
21 | 22 |
(...skipping 25 matching lines...) Expand all Loading... |
47 print(argParser.usage); | 48 print(argParser.usage); |
48 } | 49 } |
49 | 50 |
50 bool shard_enabled(String shard) { | 51 bool shard_enabled(String shard) { |
51 if (shard.endsWith('-dev')) return INCLUDE_DEV; | 52 if (shard.endsWith('-dev')) return INCLUDE_DEV; |
52 if (shard.endsWith('-stable')) return INCLUDE_STABLE; | 53 if (shard.endsWith('-stable')) return INCLUDE_STABLE; |
53 if (shard.endsWith('-integration')) return INCLUDE_INTEGRATION; | 54 if (shard.endsWith('-integration')) return INCLUDE_INTEGRATION; |
54 return true; | 55 return true; |
55 } | 56 } |
56 | 57 |
57 main(List<String> args) async { | 58 Future main(List<String> args) async { |
58 ArgParser argParser = createArgParser(); | 59 ArgParser argParser = createArgParser(); |
59 argParser.addFlag("include-dev", | 60 argParser.addFlag("include-dev", |
60 abbr: "d", | 61 abbr: "d", |
61 defaultsTo: false, | 62 defaultsTo: false, |
62 negatable: false, | 63 negatable: false, |
63 help: "Include shards named *-dev"); | 64 help: "Include shards named *-dev"); |
64 argParser.addFlag("include-stable", | 65 argParser.addFlag("include-stable", |
65 abbr: "s", | 66 abbr: "s", |
66 defaultsTo: false, | 67 defaultsTo: false, |
67 negatable: false, | 68 negatable: false, |
(...skipping 21 matching lines...) Expand all Loading... |
89 for (String group in shardGroups.keys) { | 90 for (String group in shardGroups.keys) { |
90 List<String> shardGroup = shardGroups[group]; | 91 List<String> shardGroup = shardGroups[group]; |
91 for (int i = 0; i < shardGroup.length; i++) { | 92 for (int i = 0; i < shardGroup.length; i++) { |
92 String shard = shardGroup[i]; | 93 String shard = shardGroup[i]; |
93 if (shard_enabled(shard) && shard.contains(arg)) { | 94 if (shard_enabled(shard) && shard.contains(arg)) { |
94 print("$group(${i+1}): $shard"); | 95 print("$group(${i+1}): $shard"); |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 } | 99 } |
OLD | NEW |