Skip to content

Commit 5fd736f

Browse files
committed
Merge branch 'fix/prevent-old-config-file-generation' into fix/populate-platform-deployment-from-product
2 parents 102d37b + 1f93b5d commit 5fd736f

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

Assets/Tests/PlayMode/Config/EOSConfigTests.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,23 @@
2222

2323
namespace PlayEveryWare.EpicOnlineServices.Tests.Config
2424
{
25-
using Epic.OnlineServices.Platform;
2625
using NUnit.Framework;
2726
using System;
2827
using System.Collections.Generic;
29-
using System.Linq;
30-
using System.Reflection;
31-
using static PlayEveryWare.EpicOnlineServices.EOSConfig;
32-
using Config = EpicOnlineServices.Config;
3328

3429
public class EOSConfigTests
3530
{
31+
// This warning suppression is here because with EOSConfig being obsolete,
32+
// it will generate a warning. Because EOSConfig still exists for the
33+
// purposes of migration, it is important that the tests remain intact.
34+
#pragma warning disable CS0618 // Type or member is obsolete
35+
3636
[Test]
3737
public void ProductName_MustNotBeEmpty()
3838
{
39+
3940
EOSConfig config = EOSConfig.Get<EOSConfig>();
41+
4042
config.productName = string.Empty;
4143

4244
if (!FieldValidator.TryGetFailingValidatorAttributes(config, out List<FieldValidatorFailure> failingAttributes))
@@ -49,6 +51,7 @@ public void ProductName_MustNotBeEmpty()
4951
failingAttributes,
5052
NonEmptyStringFieldValidatorAttribute.FieldIsEmptyMessage),
5153
"There should be a failure of the expected type and message.");
54+
5255
}
5356

5457
[Test]
@@ -307,6 +310,8 @@ public void DeploymentID_SuccessfulParse()
307310
"There should be a failure of the expected type and message.");
308311
}
309312

313+
#pragma warning restore CS0618 // Type or member is obsolete
314+
310315
/// <summary>
311316
/// Determines if the provided list of failures contains an expected failure
312317
/// </summary>

com.playeveryware.eos/Runtime/Core/Config/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ protected virtual void OnReadCompleted()
465465
/// lead to confusion later on.
466466
/// </summary>
467467
/// <returns>Task.</returns>
468-
private async Task EnsureConfigFileExistsAsync()
468+
protected virtual async Task EnsureConfigFileExistsAsync()
469469
{
470470
bool fileExists = await FileSystemUtility.FileExistsAsync(FilePath);
471471

com.playeveryware.eos/Runtime/Core/Config/EOSConfig.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace PlayEveryWare.EpicOnlineServices
4848
using System.Text.RegularExpressions;
4949
using Newtonsoft.Json;
5050
using PlayEveryWare.EpicOnlineServices.Utility;
51+
using System.Threading.Tasks;
5152

5253
/// <summary>
5354
/// Represents the default deployment ID to use when a given sandbox ID is
@@ -74,6 +75,7 @@ public class SandboxDeploymentOverride
7475
"Thread Affinity & Tick Budgets",
7576
"Overlay Options"
7677
}, false)]
78+
[Obsolete("EOSConfig is obsolete. It has been replaced by PlatformConfig and ProductConfig. It remains here for migration purposes.")]
7779
public class EOSConfig : Config
7880
{
7981
static EOSConfig()
@@ -97,6 +99,18 @@ protected override bool NeedsMigration()
9799
return false;
98100
}
99101

102+
/// <summary>
103+
/// Override the function that writes a config file if it doesn't exist,
104+
/// because now that EOSConfig is obsolete, we do not want an empty file
105+
/// being generated automatically - it would inevitably lead to some
106+
/// confusion.
107+
/// </summary>
108+
/// <returns>Returns a completed task.</returns>
109+
protected override Task EnsureConfigFileExistsAsync()
110+
{
111+
return Task.CompletedTask;
112+
}
113+
100114
#region Product Information
101115

102116
/// <summary>

com.playeveryware.eos/Runtime/Core/Config/PlatformConfig.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ protected PlatformConfig(PlatformManager.Platform platform) :
268268

269269
#region Logic for Migrating Override Values from Previous Structure
270270

271+
// This warning is suppressed because while EOSConfig is marked as
272+
// obsolete - it is important that it remain and be used within this
273+
// section of code so that things can be properly migrated.
274+
#pragma warning disable CS0618 // Type or member is obsolete
271275
#if !EOS_DISABLE
272276

273277
protected sealed class NonOverrideableConfigValues : Config
@@ -340,7 +344,9 @@ private static TK SelectValue<TK>(TK overrideValuesFromFieldMember, TK mainConfi
340344
return !overrideValuesFromFieldMember.Equals(default) ? overrideValuesFromFieldMember : mainConfigValue;
341345
}
342346

347+
343348
private void MigrateButtonDelays(EOSConfig overrideValuesFromFieldMember, OverrideableConfigValues mainOverrideableConfig)
349+
344350
{
345351
// Import the values for initial button delay and repeat button
346352
// delay

0 commit comments

Comments
 (0)