Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notices for development builds #578

Merged
merged 21 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ClientCore/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ public IEnumerable<string> SupplementalMapFileExtensions
/// </summary>
public bool DisallowJoiningIncompatibleGames => clientDefinitionsIni.GetBooleanValue(SETTINGS, nameof(DisallowJoiningIncompatibleGames), false);

/// <summary>
/// Activates warnings for development builds of XNA Client
/// </summary>
public bool ShowDevelopmentBuildWarnings => clientDefinitionsIni.GetBooleanValue(SETTINGS, nameof(ShowDevelopmentBuildWarnings), true);

#endregion

#region Network definitions
Expand Down
2 changes: 1 addition & 1 deletion ClientUpdater/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ internal static void UpdateUserAgent(HttpClient httpClient)
if (UpdaterVersion != "N/A")
httpClient.DefaultRequestHeaders.UserAgent.Add(new(nameof(Updater), UpdaterVersion));

httpClient.DefaultRequestHeaders.UserAgent.Add(new("Client", Assembly.GetEntryAssembly().GetName().Version.ToString()));
httpClient.DefaultRequestHeaders.UserAgent.Add(new("Client", GitVersionInformation.AssemblySemVer));
}

/// <summary>
Expand Down
9 changes: 9 additions & 0 deletions DXMainClient/DXGUI/GameClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Rampastring.Tools;
using Rampastring.XNAUI;
using System;
using ClientGUI;

Check warning on line 13 in DXMainClient/DXGUI/GameClass.cs

View workflow job for this annotation

GitHub Actions / build-clients (Ares)

The using directive for 'ClientGUI' appeared previously in this namespace

Check warning on line 13 in DXMainClient/DXGUI/GameClass.cs

View workflow job for this annotation

GitHub Actions / build-clients (TS)

The using directive for 'ClientGUI' appeared previously in this namespace

Check warning on line 13 in DXMainClient/DXGUI/GameClass.cs

View workflow job for this annotation

GitHub Actions / build-clients (YR)

The using directive for 'ClientGUI' appeared previously in this namespace
using DTAClient.Domain.Multiplayer;
using DTAClient.Domain.Multiplayer.CnCNet;
using DTAClient.DXGUI.Multiplayer;
Expand Down Expand Up @@ -69,6 +69,15 @@
Window.Title = string.IsNullOrEmpty(windowTitle) ?
string.Format("{0} Client", MainClientConstants.GAME_NAME_SHORT) : windowTitle;

{
string developBuildTitle = "Development Build".L10N("Client:Main:DevelopmentBuildTitle");

#if DEVELOPMENT_BUILD
if (ClientConfiguration.Instance.ShowDevelopmentBuildWarnings)
Window.Title += $" ({developBuildTitle})";
#endif
}

base.Initialize();

AssetLoader.Initialize(GraphicsDevice, content);
Expand Down
19 changes: 18 additions & 1 deletion DXMainClient/DXGUI/Multiplayer/CnCNet/CnCNetLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,27 @@ private void PostUIInit()

gameCreationPanel.Hide();

string clientVersion = GitVersionInformation.AssemblySemVer;
#if DEVELOPMENT_BUILD
clientVersion = $"{GitVersionInformation.CommitDate} {GitVersionInformation.BranchName}@{GitVersionInformation.ShortSha}";
#endif

connectionManager.MainChannel.AddMessage(new ChatMessage(Color.White, Renderer.GetSafeString(
string.Format("*** DTA CnCNet Client version {0} ***".L10N("Client:Main:CnCNetClientVersionMessage"), Assembly.GetAssembly(typeof(CnCNetLobby)).GetName().Version),
string.Format("*** DTA CnCNet Client version {0} ***".L10N("Client:Main:CnCNetClientVersionMessage"), clientVersion),
lbChatMessages.FontIndex)));

{
string developBuildWarningMessage = "This is a development build of the client. Stability and reliability may not be fully guaranteed.".L10N("Client:Main:DevelopmentBuildWarning");

#if DEVELOPMENT_BUILD
if (ClientConfiguration.Instance.ShowDevelopmentBuildWarnings)
{
connectionManager.MainChannel.AddMessage(new ChatMessage(Color.Red, Renderer.GetSafeString(
developBuildWarningMessage, lbChatMessages.FontIndex)));
}
#endif
}

connectionManager.BannedFromChannel += ConnectionManager_BannedFromChannel;

loginWindow = new CnCNetLoginWindow(WindowManager);
Expand Down
14 changes: 12 additions & 2 deletions DXMainClient/PreStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,18 @@ public static void Initialize(StartupParams parameters)
MainClientConstants.Initialize();

Logger.Log("***Logfile for " + MainClientConstants.GAME_NAME_LONG + " client***");
Logger.Log("Client version: " + Assembly.GetAssembly(typeof(PreStartup)).GetName().Version);
Logger.Log(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion);

string clientVersion = GitVersionInformation.AssemblySemVer;
#if DEVELOPMENT_BUILD
clientVersion = $"{GitVersionInformation.CommitDate} {GitVersionInformation.BranchName}@{GitVersionInformation.ShortSha}";
#endif

Logger.Log($"Client version: {clientVersion}");
Logger.Log(GitVersionInformation.InformationalVersion);

#if DEVELOPMENT_BUILD
Logger.Log("This is a development build of the client. Stability and reliability may not be fully guaranteed.");
#endif

// Log information about given startup params
if (parameters.NoAudio)
Expand Down
4 changes: 4 additions & 0 deletions DXMainClient/Resources/ClientDefinitions.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ Quickmatch=CnCNetQM.exe

; Set to true to disable the updater and to hide the "cheater!" dialog when modding the game
ModMode=true

; Activates warnings for non-release build of XNA Client.
; Please, make sure you are not publishing stable mod version with unstable development client build.
ShowDevelopmentBuildWarnings=true
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<Product>CnCNet Client</Product>
<Copyright>Copyright © CnCNet, Rampastring 2011-2024</Copyright>
<Trademark>CnCNet</Trademark>
<!-- GitVersion will rewrite the informational version anyway -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
8 changes: 8 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
<Message Importance="high" Text="Engine: $(Engine); Game: $(Game); Platform: $(Platform); TargetFramework: $(TargetFramework); Configuration: $(Configuration)" />
</Target>

<!-- "GetVersion" target is defined in GitVersion package -->
<Target Name="NonReleaseBuildWarning" AfterTargets="GetVersion" BeforeTargets="CoreCompile" Condition="'$(MSBuildProjectName)' == 'DXMainClient' AND ($(GitVersion_CommitsSinceVersionSource) != 0 OR $(GitVersion_BranchName) != 'master')">
<PropertyGroup>
<DefineConstants>$(DefineConstants);DEVELOPMENT_BUILD</DefineConstants>
</PropertyGroup>
<Warning Text="This is a development build of the client. Stability and reliability may not be fully guaranteed." Condition="'$(BuildingInsideVisualStudio)' != 'true'"></Warning>
</Target>

<Target Name="RestoreUpdater" AfterTargets="Restore" Condition="'$(PublishDir)' != '' AND '$(MSBuildProjectName)' == 'DXMainClient'">
<MSBuild
Projects="$(MSBuildThisFileDirectory)SecondStageUpdater\SecondStageUpdater.csproj"
Expand Down
19 changes: 9 additions & 10 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
# This configuration will allow the gitversion msbuild task to auto version our executable. It uses existing tags
# to determine the next version by auto incrementing the Minor, Patch, or Tag version. The Tag version is calculated
# by counting the number of commits since the last tag.
# Minor version is incremented by 1 when a build is created from the develop branch.
# Patch version is incremented by 1 when a build is created from the master branch.
# Patch version is incremented by 1 when a build is created from the develop or master branch.
#
# Examples:
#
# Latest tag is "2.8.0" -
# The next commit on develop branch will start version 2.9.0-beta.1.
# That increments the Minor by 1. That also increments the beta by 1 for the 1 additional commit.
# Another commit creates 2.9.0-beta.2 and so on.
# The next commit on develop branch will start version 2.8.1-beta.1.
# That increments the Patch by 1. That also increments the beta by 1 for the 1 additional commit.
# Another commit creates 2.8.1-beta.2 and so on.
#
# Latest tag is "2.8.0-beta.1" -
# The next commit on develop branch is "2.8.0-beta.2". Minor version is NOT incremented, because the
# The next commit on develop branch is "2.8.0-beta.2". Patch version is NOT incremented, because the
# base tag of "2.8.0-beta.1" is also a beta.
#
# Latest tag is "2.8.0" -
# A new commit is added directly to master. The new version is "2.8.1".
# That increments th Patch, because it is treated as a "hotfix" directly on master.
# A new commit is added directly to master. The new version is "2.8.1-rc.1".
# That increments the Patch, because it is treated as a "hotfix" directly on master.
#
# Versioning Modes Quick View:
#
Expand All @@ -37,11 +36,11 @@ branches:
increment: Patch
is-mainline: true
source-branches: [ 'develop' ]
tag: ''
tag: rc

develop:
regex: ^develop$
increment: Minor
increment: Patch
is-mainline: false
mode: ContinuousDeployment
tag: beta
2 changes: 1 addition & 1 deletion SecondStageUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static void Main(string[] args)
Logger.WriteLogFile = true;
Logger.WriteToConsole = false;
Logger.Log("CnCNet Client Second-Stage Updater");
Logger.Log("Version: " + Assembly.GetAssembly(typeof(Program)).GetName().Version);
Logger.Log("Version: " + GitVersionInformation.AssemblySemVer);
Write("Base directory: " + baseDirectory.FullName);
Write($"Waiting for the client ({clientExecutable}) to exit..");

Expand Down
Loading