deprecate version build field
This commit is contained in:
parent
0b03b4f16a
commit
c073829627
|
@ -48,9 +48,12 @@
|
||||||
* Fixed `Context.IsPlayerFree` being true before the player finishes transitioning to a new location in multiplayer.
|
* Fixed `Context.IsPlayerFree` being true before the player finishes transitioning to a new location in multiplayer.
|
||||||
* Suppressed the game's 'added crickets' debug output.
|
* Suppressed the game's 'added crickets' debug output.
|
||||||
* Updated dependencies (Harmony 1.0.9.1 → 1.2.0.1, Mono.Cecil 0.10 → 0.10.1).
|
* Updated dependencies (Harmony 1.0.9.1 → 1.2.0.1, Mono.Cecil 0.10 → 0.10.1).
|
||||||
* **Deprecation:** non-string manifest versions are now deprecated and will no longer work in SMAPI 3.0.
|
* **Deprecations:**
|
||||||
* **Breaking change:** `helper.ModRegistry` now returns `IModInfo` instead of `IManifest` directly. This lets SMAPI return more metadata about mods.
|
* Non-string manifest versions are now deprecated and will no longer work in SMAPI 3.0. Affected mods should be updated to use a string version, like `"Version": "1.0.0"`.
|
||||||
* **Breaking change:** most SMAPI files have been moved into a `smapi-internal` subfolder. This won't affect compiled mod releases, but you'll need to update the build config NuGet package.
|
* `ISemanticVersion.Build` is now deprecated and will be removed in SMAPI 3.0. Affected mods should use `ISemanticVersion.PrereleaseTag` instead.
|
||||||
|
* **Breaking changes:**
|
||||||
|
* `helper.ModRegistry` now returns `IModInfo` instead of `IManifest` directly. This lets SMAPI return more metadata about mods.
|
||||||
|
* Most SMAPI files have been moved into a `smapi-internal` subfolder. This won't affect compiled mod releases, but you'll need to update the build config NuGet package.
|
||||||
|
|
||||||
* For SMAPI developers:
|
* For SMAPI developers:
|
||||||
* Added support for parallel stable/beta unofficial updates in update checks.
|
* Added support for parallel stable/beta unofficial updates in update checks.
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace StardewModdingAPI.Framework
|
||||||
|
|
||||||
/// <summary>Manages deprecation warnings.</summary>
|
/// <summary>Manages deprecation warnings.</summary>
|
||||||
/// <remarks>This is initialised after the game starts.</remarks>
|
/// <remarks>This is initialised after the game starts.</remarks>
|
||||||
private DeprecationManager DeprecationManager;
|
private readonly DeprecationManager DeprecationManager;
|
||||||
|
|
||||||
/// <summary>Manages SMAPI events for mods.</summary>
|
/// <summary>Manages SMAPI events for mods.</summary>
|
||||||
private readonly EventManager EventManager;
|
private readonly EventManager EventManager;
|
||||||
|
@ -134,6 +134,10 @@ namespace StardewModdingAPI.Framework
|
||||||
};
|
};
|
||||||
this.MonitorForGame = this.GetSecondaryMonitor("game");
|
this.MonitorForGame = this.GetSecondaryMonitor("game");
|
||||||
this.EventManager = new EventManager(this.Monitor, this.ModRegistry);
|
this.EventManager = new EventManager(this.Monitor, this.ModRegistry);
|
||||||
|
this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
|
||||||
|
|
||||||
|
// inject deprecation managers
|
||||||
|
SemanticVersion.DeprecationManager = this.DeprecationManager;
|
||||||
|
|
||||||
// init logging
|
// init logging
|
||||||
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
|
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
|
||||||
|
@ -340,9 +344,6 @@ namespace StardewModdingAPI.Framework
|
||||||
/// <summary>Initialise SMAPI and mods after the game starts.</summary>
|
/// <summary>Initialise SMAPI and mods after the game starts.</summary>
|
||||||
private void InitialiseAfterGameStart()
|
private void InitialiseAfterGameStart()
|
||||||
{
|
{
|
||||||
// load core components
|
|
||||||
this.DeprecationManager = new DeprecationManager(this.Monitor, this.ModRegistry);
|
|
||||||
|
|
||||||
// redirect direct console output
|
// redirect direct console output
|
||||||
if (this.MonitorForGame.WriteToConsole)
|
if (this.MonitorForGame.WriteToConsole)
|
||||||
this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(this.MonitorForGame, message);
|
this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(this.MonitorForGame, message);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using StardewModdingAPI.Framework;
|
||||||
|
|
||||||
namespace StardewModdingAPI
|
namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
|
@ -12,6 +13,9 @@ namespace StardewModdingAPI
|
||||||
/// <summary>The underlying semantic version implementation.</summary>
|
/// <summary>The underlying semantic version implementation.</summary>
|
||||||
private readonly ISemanticVersion Version;
|
private readonly ISemanticVersion Version;
|
||||||
|
|
||||||
|
/// <summary>Manages deprecation warnings.</summary>
|
||||||
|
internal static DeprecationManager DeprecationManager { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Accessors
|
** Accessors
|
||||||
|
@ -26,7 +30,18 @@ namespace StardewModdingAPI
|
||||||
public int PatchVersion => this.Version.PatchVersion;
|
public int PatchVersion => this.Version.PatchVersion;
|
||||||
|
|
||||||
/// <summary>An optional build tag.</summary>
|
/// <summary>An optional build tag.</summary>
|
||||||
public string Build => this.Version.Build;
|
[Obsolete("Use " + nameof(ISemanticVersion.PrereleaseTag) + " instead")]
|
||||||
|
public string Build
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
SemanticVersion.DeprecationManager?.Warn($"{nameof(ISemanticVersion)}.{nameof(ISemanticVersion.Build)}", "2.8", DeprecationLevel.Notice);
|
||||||
|
return this.Version.PrereleaseTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>An optional prerelease tag.</summary>
|
||||||
|
public string PrereleaseTag => this.Version.PrereleaseTag;
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
|
|
|
@ -18,8 +18,12 @@ namespace StardewModdingAPI
|
||||||
int PatchVersion { get; }
|
int PatchVersion { get; }
|
||||||
|
|
||||||
/// <summary>An optional build tag.</summary>
|
/// <summary>An optional build tag.</summary>
|
||||||
|
[Obsolete("Use " + nameof(ISemanticVersion.PrereleaseTag) + " instead")]
|
||||||
string Build { get; }
|
string Build { get; }
|
||||||
|
|
||||||
|
/// <summary>An optional prerelease tag.</summary>
|
||||||
|
string PrereleaseTag { get; }
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Accessors
|
** Accessors
|
||||||
|
|
|
@ -40,7 +40,11 @@ namespace StardewModdingAPI.Toolkit
|
||||||
public int PatchVersion { get; }
|
public int PatchVersion { get; }
|
||||||
|
|
||||||
/// <summary>An optional prerelease tag.</summary>
|
/// <summary>An optional prerelease tag.</summary>
|
||||||
public string Build { get; }
|
[Obsolete("Use " + nameof(ISemanticVersion.PrereleaseTag) + " instead")]
|
||||||
|
public string Build => this.PrereleaseTag;
|
||||||
|
|
||||||
|
/// <summary>An optional prerelease tag.</summary>
|
||||||
|
public string PrereleaseTag { get; }
|
||||||
|
|
||||||
/// <summary>Whether the version was parsed from the legacy object format.</summary>
|
/// <summary>Whether the version was parsed from the legacy object format.</summary>
|
||||||
public bool IsLegacyFormat { get; }
|
public bool IsLegacyFormat { get; }
|
||||||
|
@ -60,7 +64,7 @@ namespace StardewModdingAPI.Toolkit
|
||||||
this.MajorVersion = major;
|
this.MajorVersion = major;
|
||||||
this.MinorVersion = minor;
|
this.MinorVersion = minor;
|
||||||
this.PatchVersion = patch;
|
this.PatchVersion = patch;
|
||||||
this.Build = this.GetNormalisedTag(tag);
|
this.PrereleaseTag = this.GetNormalisedTag(tag);
|
||||||
this.IsLegacyFormat = isLegacyFormat;
|
this.IsLegacyFormat = isLegacyFormat;
|
||||||
|
|
||||||
this.AssertValid();
|
this.AssertValid();
|
||||||
|
@ -98,7 +102,7 @@ namespace StardewModdingAPI.Toolkit
|
||||||
this.MajorVersion = int.Parse(match.Groups["major"].Value);
|
this.MajorVersion = int.Parse(match.Groups["major"].Value);
|
||||||
this.MinorVersion = match.Groups["minor"].Success ? int.Parse(match.Groups["minor"].Value) : 0;
|
this.MinorVersion = match.Groups["minor"].Success ? int.Parse(match.Groups["minor"].Value) : 0;
|
||||||
this.PatchVersion = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0;
|
this.PatchVersion = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0;
|
||||||
this.Build = match.Groups["prerelease"].Success ? this.GetNormalisedTag(match.Groups["prerelease"].Value) : null;
|
this.PrereleaseTag = match.Groups["prerelease"].Success ? this.GetNormalisedTag(match.Groups["prerelease"].Value) : null;
|
||||||
|
|
||||||
this.AssertValid();
|
this.AssertValid();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue