Skip to content

Commit 70db766

Browse files
authored
Merge pull request #33680 from peppy/make-release-streams-work-in-version
Add support for reading and displaying the release stream suffix
2 parents d934e57 + 62ec0a1 commit 70db766

File tree

8 files changed

+28
-18
lines changed

8 files changed

+28
-18
lines changed

osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void ShowWithBuild(bool isSupporter)
107107
{
108108
Version = "2018.712.0",
109109
DisplayVersion = "2018.712.0",
110-
UpdateStream = streams[OsuGameBase.CLIENT_STREAM_NAME],
110+
UpdateStream = streams["lazer"],
111111
CreatedAt = new DateTime(2018, 7, 12),
112112
ChangelogEntries = new List<APIChangelogEntry>
113113
{

osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public class APIUpdateStream : IEquatable<APIUpdateStream>
3939
["stable"] = new Color4(34, 153, 187, 255),
4040
["beta40"] = new Color4(255, 221, 85, 255),
4141
["cuttingedge"] = new Color4(238, 170, 0, 255),
42-
[OsuGameBase.CLIENT_STREAM_NAME] = new Color4(237, 18, 33, 255),
42+
["lazer"] = new Color4(237, 18, 33, 255),
43+
["tachyon"] = new Color4(206, 0, 255, 255),
4344
["web"] = new Color4(136, 102, 238, 255)
4445
};
4546

osu.Game/OsuGame.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public void HandleLink(LinkDetails link) => Schedule(() =>
519519
else
520520
{
521521
string[] changelogArgs = argString.Split("/");
522-
ShowChangelogBuild(changelogArgs[0], changelogArgs[1]);
522+
ShowChangelogBuild($"{changelogArgs[1]}-{changelogArgs[0]}");
523523
}
524524

525525
break;
@@ -600,9 +600,8 @@ public void ShowChannel(string channel) => waitForReady(() => channelManager, _
600600
/// <summary>
601601
/// Show changelog's build as an overlay
602602
/// </summary>
603-
/// <param name="updateStream">The update stream name</param>
604-
/// <param name="version">The build version of the update stream</param>
605-
public void ShowChangelogBuild(string updateStream, string version) => waitForReady(() => changelogOverlay, _ => changelogOverlay.ShowBuild(updateStream, version));
603+
/// <param name="version">The build version, including stream suffix.</param>
604+
public void ShowChangelogBuild(string version) => waitForReady(() => changelogOverlay, _ => changelogOverlay.ShowBuild(version));
606605

607606
/// <summary>
608607
/// Joins a multiplayer or playlists room with the given <paramref name="id"/>.
@@ -1025,6 +1024,10 @@ protected override void LoadComplete()
10251024
if (RuntimeInfo.EntryAssembly.GetCustomAttribute<OfficialBuildAttribute>() == null)
10261025
Logger.Log(NotificationsStrings.NotOfficialBuild.ToString());
10271026

1027+
// Make sure the release stream setting matches the build which was just run.
1028+
if (Enum.TryParse<ReleaseStream>(Version.Split('-').Last(), true, out var releaseStream))
1029+
LocalConfig.SetValue(OsuSetting.ReleaseStream, releaseStream);
1030+
10281031
var languages = Enum.GetValues<Language>();
10291032

10301033
var mappings = languages.Select(language =>

osu.Game/OsuGameBase.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ public partial class OsuGameBase : Framework.Game, ICanAcceptFiles, IBeatSyncPro
8383

8484
public const string OSU_PROTOCOL = "osu://";
8585

86-
public const string CLIENT_STREAM_NAME = @"lazer";
87-
8886
/// <summary>
8987
/// The filename of the main client database.
9088
/// </summary>
@@ -120,17 +118,23 @@ public virtual EndpointConfiguration CreateEndpoints() =>
120118

121119
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
122120

123-
internal const string BUILD_SUFFIX = "lazer";
124-
125121
public virtual string Version
126122
{
127123
get
128124
{
129125
if (!IsDeployedBuild)
130126
return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release");
131127

132-
var version = AssemblyVersion;
133-
return $@"{version.Major}.{version.Minor}.{version.Build}-{BUILD_SUFFIX}";
128+
string informationalVersion = Assembly.GetEntryAssembly()?
129+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
130+
.InformationalVersion;
131+
132+
// Example: [assembly: AssemblyInformationalVersion("2025.613.0-tachyon+d934e574b2539e8787956c3c9ecce9dadebb10ee")]
133+
if (!string.IsNullOrEmpty(informationalVersion))
134+
return informationalVersion.Split('+').First();
135+
136+
Version version = AssemblyVersion;
137+
return $@"{version.Major}.{version.Minor}.{version.Build}-lazer";
134138
}
135139
}
136140

osu.Game/Overlays/ChangelogOverlay.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,18 @@ public void ShowBuild([NotNull] APIChangelogBuild build)
7676
Show();
7777
}
7878

79-
public void ShowBuild([NotNull] string updateStream, [NotNull] string version)
79+
public void ShowBuild([NotNull] string version)
8080
{
81-
ArgumentNullException.ThrowIfNull(updateStream);
8281
ArgumentNullException.ThrowIfNull(version);
8382

8483
Show();
8584

8685
performAfterFetch(() =>
8786
{
88-
var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream)
87+
string versionPart = version.Split('-')[0];
88+
string updateStream = version.Split('-')[1];
89+
90+
var build = builds.Find(b => b.Version == versionPart && b.UpdateStream.Name == updateStream)
8991
?? Streams.Find(s => s.Name == updateStream)?.LatestBuild;
9092

9193
if (build != null)

osu.Game/Overlays/Settings/SettingsFooter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public BuildDisplay(string version)
100100
[BackgroundDependencyLoader]
101101
private void load(ChangelogOverlay? changelog)
102102
{
103-
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
103+
Action = () => changelog?.ShowBuild(version);
104104

105105
Add(new OsuSpriteText
106106
{

osu.Game/Updater/UpdateManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private void load(OsuColour colours, ChangelogOverlay changelog, INotificationOv
111111
Activated = delegate
112112
{
113113
notificationOverlay.Hide();
114-
changelog.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
114+
changelog.ShowBuild(version);
115115
return true;
116116
};
117117
}

osu.Game/Utils/SentryLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public SentryLogger(OsuGame game, Storage? storage = null)
5252
options.IsGlobalModeEnabled = true;
5353
options.CacheDirectoryPath = storage?.GetFullPath(string.Empty);
5454
// The reported release needs to match version as reported to Sentry in .github/workflows/sentry-release.yml
55-
options.Release = $"osu@{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}";
55+
options.Release = $"osu@{game.Version.Split('-').First()}";
5656
});
5757

5858
Logger.NewEntry += processLogEntry;

0 commit comments

Comments
 (0)