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 non-release builds #578

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 non-release build of XNA Client
/// </summary>
public bool ShowDevelopmentBuildWarnings => clientDefinitionsIni.GetBooleanValue(SETTINGS, nameof(ShowDevelopmentBuildWarnings), true);

#endregion

#region Network definitions
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 = Assembly.GetExecutingAssembly().GetName().Version.ToString();
#if DEVELOPMENT_BUILD
clientVersion = $"{ThisAssembly.Git.Branch}@{ThisAssembly.Git.Sha}";
#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
4 changes: 4 additions & 0 deletions DXMainClient/DXMainClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<PackageReference Include="OpenMcdf" />
<PackageReference Include="System.Management" />
<PackageReference Include="System.DirectoryServices" />
<PackageReference Include="ThisAssembly.Git">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DTAConfig\DTAConfig.csproj" />
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 = Assembly.GetExecutingAssembly().GetName().Version.ToString();
#if DEVELOPMENT_BUILD
clientVersion = $"{ThisAssembly.Git.Branch}@{ThisAssembly.Git.Sha}";
#endif

Logger.Log($"Client version: {clientVersion}");
Logger.Log(Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().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" 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
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<PackageVersion Include="System.DirectoryServices" Version="$(DotnetLibrariesVersion)" />
<PackageVersion Include="System.Management" Version="$(DotnetLibrariesVersion)" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="$(DotnetLibrariesVersion)" />
<PackageVersion Include="ThisAssembly.Git" Version="2.0.6" />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildProjectName)' == 'ClientCore' Or '$(MSBuildProjectName)' == 'ClientGUI' Or '$(MSBuildProjectName)' == 'DTAConfig' Or '$(MSBuildProjectName)' == 'DXMainClient'">
<ProjectReference Include="$(MSBuildThisFileDirectory)TranslationNotifierGenerator\TranslationNotifierGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
Expand Down
6 changes: 3 additions & 3 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# 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,7 +37,7 @@ branches:
increment: Patch
is-mainline: true
source-branches: [ 'develop' ]
tag: ''
tag: rc

develop:
regex: ^develop$
Expand Down
Loading