Browse Source

Add check that loaded plugins depend on loader

pull/94/head
Anairkoen Schno 3 years ago
parent
commit
f4a49de253
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      IPA.Loader/Loader/PluginLoader.cs

+ 16
- 1
IPA.Loader/Loader/PluginLoader.cs View File

@ -823,10 +823,12 @@ namespace IPA.Loader
}
}
// TODO: bsipa dependency check
// first load dependencies
var dependsOnSelf = false;
foreach (var dep in plugin.Manifest.Dependencies)
{
if (dep.Key == SelfMeta.Id)
dependsOnSelf = true;
if (!TryResolveId(dep.Key, out var depMeta, out var depDisabled, out var depIgnored))
{
Logger.loader.Warn($"Dependency '{dep.Key}@{dep.Value}' for '{plugin.Id}' does not exist; ignoring '{plugin.Id}'");
@ -862,6 +864,19 @@ namespace IPA.Loader
_ = plugin.Dependencies.Add(depMeta);
}
// make sure the plugin depends on the loader (assuming it actually needs to)
if (!dependsOnSelf && !plugin.IsSelf && !plugin.IsBare)
{
Logger.loader.Warn($"Plugin '{plugin.Id}' does not depend on any particular loader version; assuming its incompatible");
ignoredPlugins.Add(plugin, new(Reason.Dependency)
{
ReasonText = "Does not depend on any loader version, so it is assumed to be incompatible",
RelatedTo = SelfMeta
});
ignored = true;
return;
}
// handle LoadsAfter populated by Features processing
foreach (var loadAfter in plugin.LoadsAfter)
{


Loading…
Cancel
Save