increase deprecation levels for the upcoming SMAPI 3.0

This commit is contained in:
Jesse Plamondon-Willard 2018-12-29 19:03:16 -05:00
parent dae12c16e5
commit e77f17d809
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
6 changed files with 14 additions and 7 deletions

View File

@ -11,6 +11,7 @@
* `Specialised.LoadStageChanged`.
* Added `e.IsCurrentLocation` event arg to `World` events.
* You can now use `helper.Data.Read/WriteSaveData` as soon as the save is loaded (instead of once the world is initialised).
* Increased deprecation levels from _notice_ to _info_ for APIs removed in the upcoming SMAPI 3.0.
* For the web UI:
* Reduced mod compatibility list's cache time.

View File

@ -26,7 +26,7 @@ namespace StardewModdingAPI.Framework.Content
[Obsolete("Access " + nameof(AssetData<IDictionary<TKey, TValue>>.Data) + "field directly.")]
public void Set(TKey key, TValue value)
{
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Notice);
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Info);
this.Data[key] = value;
}
@ -36,7 +36,7 @@ namespace StardewModdingAPI.Framework.Content
[Obsolete("Access " + nameof(AssetData<IDictionary<TKey, TValue>>.Data) + "field directly.")]
public void Set(TKey key, Func<TValue, TValue> value)
{
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Notice);
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Info);
this.Data[key] = value(this.Data[key]);
}
@ -45,7 +45,7 @@ namespace StardewModdingAPI.Framework.Content
[Obsolete("Access " + nameof(AssetData<IDictionary<TKey, TValue>>.Data) + "field directly.")]
public void Set(Func<TKey, TValue, TValue> replacer)
{
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Notice);
SCore.DeprecationManager.Warn($"AssetDataForDictionary.{nameof(Set)}", "2.10", DeprecationLevel.Info);
foreach (var pair in this.Data.ToArray())
this.Data[pair.Key] = replacer(pair.Key, pair.Value);
}

View File

@ -38,7 +38,7 @@ namespace StardewModdingAPI.Framework
/// <summary>Log a deprecation warning for the old-style events.</summary>
public void WarnForOldEvents()
{
this.Warn("legacy events", "2.9", DeprecationLevel.Notice);
this.Warn("legacy events", "2.9", DeprecationLevel.Info);
}
/// <summary>Log a deprecation warning.</summary>
@ -71,7 +71,13 @@ namespace StardewModdingAPI.Framework
foreach (DeprecationWarning warning in this.QueuedWarnings.OrderBy(p => p.ModName).ThenBy(p => p.NounPhrase))
{
// build message
#if SMAPI_3_0_STRICT
string message = $"{warning.ModName ?? "An unknown mod"} uses deprecated code ({warning.NounPhrase} is deprecated since SMAPI {warning.Version}).";
#else
string message = warning.NounPhrase == "legacy events"
? $"{warning.ModName ?? "An unknown mod"} uses deprecated code (legacy events are deprecated since SMAPI {warning.Version})."
: $"{warning.ModName ?? "An unknown mod"} uses deprecated code ({warning.NounPhrase} is deprecated since SMAPI {warning.Version}).";
#endif
if (warning.ModName == null)
message += $"{Environment.NewLine}{Environment.StackTrace}";

View File

@ -166,7 +166,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
[Obsolete("Use " + nameof(IModHelper) + "." + nameof(IModHelper.ContentPacks) + "." + nameof(IContentPackHelper.CreateTemporary) + " instead")]
public IContentPack CreateTransitionalContentPack(string directoryPath, string id, string name, string description, string author, ISemanticVersion version)
{
SCore.DeprecationManager.Warn($"{nameof(IModHelper)}.{nameof(IModHelper.CreateTransitionalContentPack)}", "2.5", DeprecationLevel.Notice);
SCore.DeprecationManager.Warn($"{nameof(IModHelper)}.{nameof(IModHelper.CreateTransitionalContentPack)}", "2.5", DeprecationLevel.Info);
return this.ContentPacks.CreateTemporary(directoryPath, id, name, description, author, version);
}

View File

@ -929,7 +929,7 @@ namespace StardewModdingAPI.Framework
// add deprecation warning for old version format
{
if (mod.Manifest?.Version is Toolkit.SemanticVersion version && version.IsLegacyFormat)
SCore.DeprecationManager.Warn(mod.DisplayName, "non-string manifest version", "2.8", DeprecationLevel.Notice);
SCore.DeprecationManager.Warn(mod.DisplayName, "non-string manifest version", "2.8", DeprecationLevel.Info);
}
#endif

View File

@ -33,7 +33,7 @@ namespace StardewModdingAPI
{
get
{
SCore.DeprecationManager?.Warn($"{nameof(ISemanticVersion)}.{nameof(ISemanticVersion.Build)}", "2.8", DeprecationLevel.Notice);
SCore.DeprecationManager?.Warn($"{nameof(ISemanticVersion)}.{nameof(ISemanticVersion.Build)}", "2.8", DeprecationLevel.Info);
return this.Version.PrereleaseTag;
}
}