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

Side by Side Diff: tools/gardening/lib/src/buildbot_structures.dart

Issue 2912343002: Add BuildBotClient to abstract http/logdog access (Closed)
Patch Set: Created 3 years, 6 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 | « tools/gardening/lib/src/buildbot_loading.dart ('k') | tools/gardening/lib/src/cache.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 import 'util.dart'; 5 import 'util.dart';
6 6
7 /// The [Uri] of a build step stdio log split into its subparts. 7 /// The [Uri] of a build step stdio log split into its subparts.
8 class BuildUri { 8 class BuildUri {
9 final String scheme; 9 final String scheme;
10 final String host; 10 final String host;
11 final String prefix; 11 final String prefix;
12 final String botName; 12 final String botName;
13 final int buildNumber; 13 final int buildNumber;
14 final String stepName; 14 final String stepName;
15 final String suffix; 15 final String suffix;
16 16
17 factory BuildUri(Uri uri) { 17 factory BuildUri(Uri uri) {
18 List<String> parts = 18 List<String> parts = split(Uri.decodeFull(uri.path),
19 split(uri.path, ['/builders/', '/builds/', '/steps/', '/logs/']); 19 ['/builders/', '/builds/', '/steps/', '/logs/']);
20 String botName = parts[1]; 20 String botName = parts[1];
21 int buildNumber = int.parse(parts[2]); 21 int buildNumber = int.parse(parts[2]);
22 String stepName = parts[3]; 22 String stepName = parts[3];
23 return new BuildUri.fromData(botName, buildNumber, stepName); 23 return new BuildUri.fromData(botName, buildNumber, stepName);
24 } 24 }
25 25
26 factory BuildUri.fromData(String botName, int buildNumber, String stepName) { 26 factory BuildUri.fromData(String botName, int buildNumber, String stepName) {
27 return new BuildUri.internal('https', 'build.chromium.org', 27 return new BuildUri.internal('https', 'build.chromium.org',
28 '/p/client.dart', botName, buildNumber, stepName, 'stdio/text'); 28 '/p/client.dart', botName, buildNumber, stepName, 'stdio/text');
29 } 29 }
30 30
31 BuildUri.internal(this.scheme, this.host, this.prefix, this.botName, 31 BuildUri.internal(this.scheme, this.host, this.prefix, this.botName,
32 this.buildNumber, this.stepName, this.suffix); 32 this.buildNumber, this.stepName, this.suffix);
33 33
34 BuildUri withBuildNumber(int buildNumber) { 34 BuildUri withBuildNumber(int buildNumber) {
35 return new BuildUri.fromData(botName, buildNumber, stepName); 35 return new BuildUri.fromData(botName, buildNumber, stepName);
36 } 36 }
37 37
38 int get absoluteBuildNumber => buildNumber >= 0 ? buildNumber : null;
39
38 String get shortBuildName => '$botName/$stepName'; 40 String get shortBuildName => '$botName/$stepName';
39 41
40 String get buildName => 42 String get buildName =>
41 '/builders/$botName/builds/$buildNumber/steps/$stepName'; 43 '/builders/$botName/builds/$buildNumber/steps/$stepName';
42 44
43 String get path => '$prefix$buildName/logs/$suffix'; 45 String get path => '$prefix$buildName/logs/$suffix';
44 46
45 /// Returns the path used in logdog for this build uri. 47 /// Returns the path used in logdog for this build uri.
46 /// 48 ///
47 /// Since logdog only supports absolute build numbers, [buildNumber] must be 49 /// Since logdog only supports absolute build numbers, [buildNumber] must be
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 221
220 /// The result of a single test for a single test step. 222 /// The result of a single test for a single test step.
221 class TestStatus { 223 class TestStatus {
222 final TestConfiguration config; 224 final TestConfiguration config;
223 final String status; 225 final String status;
224 226
225 TestStatus(this.config, this.status); 227 TestStatus(this.config, this.status);
226 228
227 String toString() => '$config: $status'; 229 String toString() => '$config: $status';
228 } 230 }
OLDNEW
« no previous file with comments | « tools/gardening/lib/src/buildbot_loading.dart ('k') | tools/gardening/lib/src/cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698