Skip to content

Commit

Permalink
Run pipeline CLI fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Nov 11, 2024
1 parent 784a296 commit 9a520aa
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 127 deletions.
19 changes: 16 additions & 3 deletions Synthesis.Bethesda.CLI/RunPipeline/RunPipelineLogic.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.IO.Abstractions;
using Autofac;
using Mutagen.Bethesda.Environments.DI;
using Mutagen.Bethesda.Plugins.Order.DI;
using Noggog;
using Synthesis.Bethesda.Execution.Commands;
using Synthesis.Bethesda.Execution.Modules;
Expand All @@ -21,19 +23,30 @@ public RunPipelineLogic(
_runPipeline = runPipeline;
}

public static async Task<int> Run(RunPatcherPipelineCommand settings, IFileSystem? fileSystem = null)
public static async Task<int> Run(RunPatcherPipelineCommand cmd, IFileSystem? fileSystem = null)
{
try
{
var builder = new ContainerBuilder();
builder.RegisterModule(
new RunPipelineModule(settings));
new RunPipelineModule(cmd));
if (fileSystem != null)
{
builder.RegisterInstance(fileSystem).AsImplementedInterfaces();
}
builder.RegisterInstance(new ProfileIdentifier(settings.ProfileName)).AsImplementedInterfaces();
builder.RegisterInstance(new ProfileIdentifier(cmd.ProfileName)).AsImplementedInterfaces();
if (cmd.DataFolderPath.HasValue)
{
builder.RegisterInstance(new DataDirectoryInjection(cmd.DataFolderPath.Value))
.AsImplementedInterfaces();
}

if (cmd.LoadOrderFilePath.HasValue)
{
builder.RegisterInstance(new PluginListingsPathInjection(cmd.LoadOrderFilePath.Value))
.AsImplementedInterfaces();
}

var container = builder.Build();

await container
Expand Down
2 changes: 0 additions & 2 deletions Synthesis.Bethesda.CLI/RunPipeline/RunPipelineModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Noggog.Autofac;
using Noggog.Autofac.Modules;
using Serilog;
using Synthesis.Bethesda.CLI.RunPipeline.Settings;
using Synthesis.Bethesda.Execution.Commands;
using Synthesis.Bethesda.Execution.Modules;
using Synthesis.Bethesda.Execution.Reporters;
Expand Down Expand Up @@ -38,7 +37,6 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterAssemblyTypes(typeof(ProfileLoadOrderProvider).Assembly)
.InNamespacesOf(
typeof(ProfileLoadOrderProvider))
.NotInNamespacesOf(typeof(DataFolderPathDecorator))
.AsImplementedInterfaces()
.AsSelf();

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using CommandLine;
using Mutagen.Bethesda.Environments.DI;
using Noggog;
using Synthesis.Bethesda.Commands;
using Synthesis.Bethesda.Execution.Patchers.Git;
using Synthesis.Bethesda.Execution.Patchers.Git.Services;
using Synthesis.Bethesda.Execution.Pathing;
using Synthesis.Bethesda.Execution.Profile;
Expand All @@ -16,17 +14,16 @@ namespace Synthesis.Bethesda.Execution.Commands;
public class RunPatcherPipelineCommand :
IProfileDefinitionPathProvider,
IProfileNameProvider,
IExecutionParametersSettingsProvider,
IDataDirectoryProvider
IExecutionParametersSettingsProvider
{
[Option('o', "OutputDirectory", Required = true, HelpText = "Path where the patcher should place its resulting file(s).")]
public DirectoryPath OutputDirectory { get; set; }

[Option('d', "DataFolderPath", Required = false, HelpText = "Path to the data folder.")]
public DirectoryPath DataFolderPath { get; set; } = string.Empty;
public DirectoryPath? DataFolderPath { get; set; }

[Option('l', "LoadOrderFilePath", Required = false, HelpText = "Path to the load order file to use.")]
public FilePath LoadOrderFilePath { get; set; } = string.Empty;
public FilePath? LoadOrderFilePath { get; set; }

[Option('p', "SettingsFolderPath",
HelpText = "Path to the folder containing the PipelineSettings.json to be adjusted",
Expand Down Expand Up @@ -64,5 +61,4 @@ public override string ToString()

FilePath IProfileDefinitionPathProvider.Path => Path.Combine(SettingsFolderPath, "PipelineSettings.json");
string IProfileNameProvider.Name => ProfileName;
DirectoryPath IDataDirectoryProvider.Path => DataFolderPath;
}
2 changes: 1 addition & 1 deletion Synthesis.Bethesda.UnitTests/CLI/RunPipelineLogicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ await b.Build().Resolve<AddSolutionPatcherRunner>().Add(new AddSolutionPatcherCo
GroupName = groupName
});

await fileSystem.File.WriteAllTextAsync(pluginList.File, $"*{someMod}");
await fileSystem.File.WriteAllTextAsync(pluginList.File, $"*{someMod.ModKey.FileName}");
npc.EditorID = "Before";
await someMod.BeginWrite.ToPath(Path.Combine(dataFolder.Dir, someMod.ModKey.FileName))
.WithNoLoadOrder()
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 9a520aa

Please sign in to comment.