Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: tools/gardening/bin/create_shard_groups.dart

Issue 2759533003: Fixed bug: last entry was missing from shard_data.dart (Closed)
Patch Set: Added script tag to shard2group.dart Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/gardening/bin/shard2group.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 // Outputs source code for `part` used by `shard2group.dart`. Usage: 5 // Outputs source code for `part` used by `shard2group.dart`. Usage:
6 // `dart bin/create_shard_groups.dart source.html >lib/src/shard_data.dart`. 6 // `dart bin/create_shard_groups.dart source.html >lib/src/shard_data.dart`.
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 10
(...skipping 23 matching lines...) Expand all
34 const String shardMark = '/builders/'; 34 const String shardMark = '/builders/';
35 35
36 List<List<String>> findShards(List<String> source) { 36 List<List<String>> findShards(List<String> source) {
37 List<List<String>> result = <List<String>>[]; 37 List<List<String>> result = <List<String>>[];
38 List<String> shardResult; 38 List<String> shardResult;
39 bool started = false; 39 bool started = false;
40 40
41 for (String line in source) { 41 for (String line in source) {
42 if (line.contains(shardsStartMark)) started = true; 42 if (line.contains(shardsStartMark)) started = true;
43 if (started) { 43 if (started) {
44 if (line.contains(shardsEndMark)) break; 44 if (line.contains(shardsEndMark)) {
45 if (shardResult != null) result.add(shardResult);
46 break;
47 }
45 String trimmed = line.trim(); 48 String trimmed = line.trim();
46 int buildersIndex = trimmed.indexOf(shardMark); 49 int buildersIndex = trimmed.indexOf(shardMark);
47 if (buildersIndex >= 0) { 50 if (buildersIndex >= 0) {
48 int quoteIndex = trimmed.indexOf("'", buildersIndex); 51 int quoteIndex = trimmed.indexOf("'", buildersIndex);
49 if (quoteIndex >= 0) { 52 if (quoteIndex >= 0) {
50 // Found a shard name, add it. 53 // Found a shard name, add it.
51 shardResult.add(trimmed.substring( 54 shardResult.add(trimmed.substring(
52 buildersIndex + shardMark.length, quoteIndex)); 55 buildersIndex + shardMark.length, quoteIndex));
53 } else { 56 } else {
54 // Unexpected source formatting, skip. 57 // Unexpected source formatting, skip.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 """); 93 """);
91 for (int i = 0; i < groupCount; i++) { 94 for (int i = 0; i < groupCount; i++) {
92 print(" '${groups[i]}': const <String>["); 95 print(" '${groups[i]}': const <String>[");
93 for (List<String> shard in shards[i]) { 96 for (List<String> shard in shards[i]) {
94 print(" '$shard',"); 97 print(" '$shard',");
95 } 98 }
96 print(" ],"); 99 print(" ],");
97 } 100 }
98 print('};'); 101 print('};');
99 } 102 }
OLDNEW
« no previous file with comments | « no previous file | tools/gardening/bin/shard2group.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698