| OLD | NEW |
| 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 = split(Uri.decodeFull(uri.path), | 18 List<String> parts = split(Uri.decodeFull(uri.path), |
| 19 ['/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.fromUrl(String url) { |
| 27 if (!url.endsWith('/text')) { |
| 28 // Use the text version of the stdio log. |
| 29 url += '/text'; |
| 30 } |
| 31 return new BuildUri(Uri.parse(url)); |
| 32 } |
| 33 |
| 26 factory BuildUri.fromData(String botName, int buildNumber, String stepName) { | 34 factory BuildUri.fromData(String botName, int buildNumber, String stepName) { |
| 27 return new BuildUri.internal('https', 'build.chromium.org', | 35 return new BuildUri.internal('https', 'build.chromium.org', |
| 28 '/p/client.dart', botName, buildNumber, stepName, 'stdio/text'); | 36 '/p/client.dart', botName, buildNumber, stepName, 'stdio/text'); |
| 29 } | 37 } |
| 30 | 38 |
| 31 BuildUri.internal(this.scheme, this.host, this.prefix, this.botName, | 39 BuildUri.internal(this.scheme, this.host, this.prefix, this.botName, |
| 32 this.buildNumber, this.stepName, this.suffix); | 40 this.buildNumber, this.stepName, this.suffix); |
| 33 | 41 |
| 34 BuildUri withBuildNumber(int buildNumber) { | 42 BuildUri withBuildNumber(int buildNumber) { |
| 35 return new BuildUri.fromData(botName, buildNumber, stepName); | 43 return new BuildUri.fromData(botName, buildNumber, stepName); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 229 |
| 222 /// The result of a single test for a single test step. | 230 /// The result of a single test for a single test step. |
| 223 class TestStatus { | 231 class TestStatus { |
| 224 final TestConfiguration config; | 232 final TestConfiguration config; |
| 225 final String status; | 233 final String status; |
| 226 | 234 |
| 227 TestStatus(this.config, this.status); | 235 TestStatus(this.config, this.status); |
| 228 | 236 |
| 229 String toString() => '$config: $status'; | 237 String toString() => '$config: $status'; |
| 230 } | 238 } |
| OLD | NEW |