mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
fix: testing API level being ignored (#1472)
Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
parent
1f0b616e2c
commit
c228c92979
6 changed files with 39 additions and 11 deletions
|
|
@ -1178,7 +1178,8 @@ internal class PluginManager : IInternalDisposableService
|
|||
}
|
||||
|
||||
// API level - we keep the API before this in the installer to show as "outdated"
|
||||
if (manifest.DalamudApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
||||
var effectiveApiLevel = this.UseTesting(manifest) && manifest.TestingDalamudApiLevel != null ? manifest.TestingDalamudApiLevel.Value : manifest.DalamudApiLevel;
|
||||
if (effectiveApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
||||
{
|
||||
Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
||||
return false;
|
||||
|
|
@ -1698,7 +1699,7 @@ internal class PluginManager : IInternalDisposableService
|
|||
|
||||
if (plugin == null)
|
||||
throw new Exception("Plugin was null when adding to list");
|
||||
|
||||
|
||||
lock (this.pluginListLock)
|
||||
{
|
||||
this.installedPluginsList.Add(plugin);
|
||||
|
|
@ -1728,7 +1729,15 @@ internal class PluginManager : IInternalDisposableService
|
|||
var updates = this.AvailablePlugins
|
||||
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
||||
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
|
||||
.Where(remoteManifest => remoteManifest.DalamudApiLevel == DalamudApiLevel)
|
||||
.Where(remoteManifest =>
|
||||
{
|
||||
var useTesting = this.UseTesting(remoteManifest);
|
||||
var candidateApiLevel = useTesting && remoteManifest.TestingDalamudApiLevel != null
|
||||
? remoteManifest.TestingDalamudApiLevel.Value
|
||||
: remoteManifest.DalamudApiLevel;
|
||||
|
||||
return candidateApiLevel == DalamudApiLevel;
|
||||
})
|
||||
.Select(remoteManifest =>
|
||||
{
|
||||
var useTesting = this.UseTesting(remoteManifest);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ internal class LocalPlugin : IDisposable
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether this plugin's API level is out of date.
|
||||
/// </summary>
|
||||
public bool IsOutdated => this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
||||
public bool IsOutdated => this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the plugin is for testing use only.
|
||||
|
|
@ -318,8 +318,8 @@ internal class LocalPlugin : IDisposable
|
|||
if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}");
|
||||
|
||||
if (this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.DalamudApiLevel}");
|
||||
if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
||||
throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.EffectiveApiLevel}");
|
||||
|
||||
// We might want to throw here?
|
||||
if (!this.IsWantedByAnyProfile)
|
||||
|
|
|
|||
|
|
@ -63,11 +63,17 @@ public interface IPluginManifest
|
|||
public List<string>? Tags { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API level of this plugin. For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/>
|
||||
/// for the currently used API level.
|
||||
/// Gets the API level of this plugin.
|
||||
/// For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/> for the currently used API level.
|
||||
/// </summary>
|
||||
public int DalamudApiLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API level of the plugin's testing variant.
|
||||
/// For the current API level, please see <see cref="PluginManager.DalamudApiLevel"/> for the currently used API level.
|
||||
/// </summary>
|
||||
public int? TestingDalamudApiLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of downloads this plugin has.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ internal record LocalPluginManifest : PluginManifest, ILocalPluginManifest
|
|||
/// </summary>
|
||||
public Version EffectiveVersion => this.Testing && this.TestingAssemblyVersion != null ? this.TestingAssemblyVersion : this.AssemblyVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the effective API level of this plugin.
|
||||
/// </summary>
|
||||
public int EffectiveApiLevel => this.Testing && this.TestingDalamudApiLevel != null ? this.TestingDalamudApiLevel.Value : this.DalamudApiLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Save a plugin manifest to file.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ internal record PluginManifest : IPluginManifest
|
|||
[JsonProperty]
|
||||
public int DalamudApiLevel { get; init; } = PluginManager.DalamudApiLevel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[JsonProperty]
|
||||
public int? TestingDalamudApiLevel { get; init; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
[JsonProperty]
|
||||
public long DownloadCount { get; init; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue