Merge pull request #568 from daemitus/devUpdate

update dev plugin workflow + bugfix
This commit is contained in:
goaaats 2021-09-14 20:52:40 +02:00 committed by GitHub
commit 56d1ad0bc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 13 deletions

View file

@ -1361,7 +1361,7 @@ namespace Dalamud.Interface.Internal.Windows
{ {
this.installStatus = OperationStatus.InProgress; this.installStatus = OperationStatus.InProgress;
Task.Run(() => pluginManager.UpdateSinglePluginAsync(update, true, false)) Task.Run(async () => await pluginManager.UpdateSinglePluginAsync(update, true, false))
.ContinueWith(task => .ContinueWith(task =>
{ {
// There is no need to set as Complete for an individual plugin installation // There is no need to set as Complete for an individual plugin installation

View file

@ -685,7 +685,7 @@ namespace Dalamud.Plugin.Internal
} }
/// <summary> /// <summary>
/// Update all plugins. /// Update all non-dev plugins.
/// </summary> /// </summary>
/// <param name="dryRun">Perform a dry run, don't install anything.</param> /// <param name="dryRun">Perform a dry run, don't install anything.</param>
/// <returns>Success or failure and a list of updated plugin metadata.</returns> /// <returns>Success or failure and a list of updated plugin metadata.</returns>
@ -698,6 +698,10 @@ namespace Dalamud.Plugin.Internal
// Prevent collection was modified errors // Prevent collection was modified errors
foreach (var plugin in this.UpdatablePlugins) foreach (var plugin in this.UpdatablePlugins)
{ {
// Can't update that!
if (plugin.InstalledPlugin.IsDev)
return null;
var result = await this.UpdateSinglePluginAsync(plugin, false, dryRun); var result = await this.UpdateSinglePluginAsync(plugin, false, dryRun);
if (result != null) if (result != null)
updatedList.Add(result); updatedList.Add(result);
@ -721,10 +725,6 @@ namespace Dalamud.Plugin.Internal
{ {
var plugin = metadata.InstalledPlugin; var plugin = metadata.InstalledPlugin;
// Can't update that!
if (plugin.IsDev)
return null;
var updateStatus = new PluginUpdateStatus var updateStatus = new PluginUpdateStatus
{ {
InternalName = plugin.Manifest.InternalName, InternalName = plugin.Manifest.InternalName,
@ -753,16 +753,33 @@ namespace Dalamud.Plugin.Internal
} }
} }
try if (plugin.IsDev)
{ {
plugin.Disable(); try
this.InstalledPlugins = this.InstalledPlugins.Remove(plugin); {
plugin.DllFile.Delete();
this.InstalledPlugins = this.InstalledPlugins.Remove(plugin);
}
catch (Exception ex)
{
Log.Error(ex, "Error during delete (update)");
updateStatus.WasUpdated = false;
return updateStatus;
}
} }
catch (Exception ex) else
{ {
Log.Error(ex, "Error during disable (update)"); try
updateStatus.WasUpdated = false; {
return updateStatus; plugin.Disable();
this.InstalledPlugins = this.InstalledPlugins.Remove(plugin);
}
catch (Exception ex)
{
Log.Error(ex, "Error during disable (update)");
updateStatus.WasUpdated = false;
return updateStatus;
}
} }
try try