OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'util.dart'; |
| 6 |
| 7 /// The [Uri] of a build step stdio log split into its subparts. |
| 8 class BuildUri { |
| 9 final String scheme; |
| 10 final String host; |
| 11 final String prefix; |
| 12 final String botName; |
| 13 final int buildNumber; |
| 14 final String stepName; |
| 15 final String suffix; |
| 16 |
| 17 factory BuildUri(Uri uri) { |
| 18 List<String> parts = |
| 19 split(uri.path, ['/builders/', '/builds/', '/steps/', '/logs/']); |
| 20 String botName = parts[1]; |
| 21 int buildNumber = int.parse(parts[2]); |
| 22 String stepName = parts[3]; |
| 23 return new BuildUri.fromData(botName, buildNumber, stepName); |
| 24 } |
| 25 |
| 26 factory BuildUri.fromData(String botName, int buildNumber, String stepName) { |
| 27 return new BuildUri.internal('https', 'build.chromium.org', |
| 28 '/p/client.dart', botName, buildNumber, stepName, 'stdio/text'); |
| 29 } |
| 30 |
| 31 BuildUri.internal(this.scheme, this.host, this.prefix, this.botName, |
| 32 this.buildNumber, this.stepName, this.suffix); |
| 33 |
| 34 String get shortBuildName => '$botName/$stepName'; |
| 35 |
| 36 String get buildName => |
| 37 '/builders/$botName/builds/$buildNumber/steps/$stepName'; |
| 38 |
| 39 String get path => '$prefix$buildName/logs/$suffix'; |
| 40 |
| 41 /// Creates the [Uri] for this build step stdio log. |
| 42 Uri toUri() { |
| 43 return new Uri(scheme: scheme, host: host, path: path); |
| 44 } |
| 45 |
| 46 /// Returns the [BuildUri] the previous build of this build step. |
| 47 BuildUri prev() { |
| 48 return new BuildUri.internal( |
| 49 scheme, host, prefix, botName, buildNumber - 1, stepName, suffix); |
| 50 } |
| 51 |
| 52 String toString() { |
| 53 return buildName; |
| 54 } |
| 55 } |
| 56 |
| 57 /// Id for a test on a specific configuration, for instance |
| 58 /// `dart2js-chrome release_x64 co19/Language/Metadata/before_function_t07`. |
| 59 class TestConfiguration { |
| 60 final String configName; |
| 61 final String archName; |
| 62 final String testName; |
| 63 |
| 64 TestConfiguration(this.configName, this.archName, this.testName); |
| 65 |
| 66 String toString() { |
| 67 return '$configName $archName $testName'; |
| 68 } |
| 69 |
| 70 int get hashCode => |
| 71 configName.hashCode * 13 + |
| 72 archName.hashCode * 17 + |
| 73 testName.hashCode * 19; |
| 74 |
| 75 bool operator ==(other) { |
| 76 if (identical(this, other)) return true; |
| 77 if (other is! TestConfiguration) return false; |
| 78 return configName == other.configName && |
| 79 archName == other.archName && |
| 80 testName == other.testName; |
| 81 } |
| 82 } |
OLD | NEW |