Skip to content

Commit

Permalink
Some work making translation packages into dotnet tools
Browse files Browse the repository at this point in the history
closes  #91
  • Loading branch information
Noggog committed Dec 1, 2024
1 parent 05cacfb commit c0e79f4
Show file tree
Hide file tree
Showing 49 changed files with 541 additions and 188 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ImplicitUsings>true</ImplicitUsings>
<LangVersion>preview</LangVersion>
<PackageOutputPath>./nupkg</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
30 changes: 16 additions & 14 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
<Project>
<ItemGroup>
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="GitVersion.MsBuild" Version="6.0.5" />
<PackageVersion Include="GitVersion.MsBuild" Version="6.0.5" />
<PackageVersion Include="McMaster.NETCore.Plugins">
<Version>1.4.0</Version>
</PackageVersion>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk">
<Version>17.12.0</Version>
</PackageVersion>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageVersion Include="Mutagen.Bethesda">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Core">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Kernel">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Skyrim">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Oblivion">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Fallout4">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Starfield">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Testing">
<Version>[0.49.0-alpha.23]</Version>
<Version>[0.49.0-alpha.25]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Serialization">
<Version>[1.29.0]</Version>
<Version>[1.30.0-alpha.1]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Serialization.Newtonsoft">
<Version>[1.29.0]</Version>
<Version>[1.30.0-alpha.1]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Serialization.SourceGenerator">
<Version>[1.29.0]</Version>
<Version>[1.30.0-alpha.1]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Serialization.Yaml">
<Version>[1.29.0]</Version>
<Version>[1.30.0-alpha.1]</Version>
</PackageVersion>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Noggog.Autofac">
<Version>[2.69]</Version>
</PackageVersion>
Expand Down Expand Up @@ -111,6 +112,7 @@
<PackageVersion Include="StrongInject">
<Version>1.4.4</Version>
</PackageVersion>
<PackageVersion Include="TestableIO.System.IO.Abstractions.Wrappers" Version="21.1.3" />
<PackageVersion Include="xunit">
<Version>2.9.2</Version>
</PackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Noggog.Processes.DI;
using Noggog.WorkEngine;
using Serilog;
using Spriggit.Core;
using Spriggit.Core.Services.Singletons;
using Spriggit.Engine.Merge;
using Spriggit.Engine.Services.Singletons;
using StrongInject;
Expand All @@ -14,6 +16,7 @@ namespace Spriggit.CLI.Lib.Commands.MergeVersionSyncer;
[Register(typeof(ConstructEntryPoint))]
[Register(typeof(NugetDownloader))]
[Register(typeof(ConstructAssemblyLoadedEntryPoint))]
[Register(typeof(ConstructDotNetToolEndpoint))]
[Register(typeof(FindTargetFramework))]
[Register(typeof(TargetFrameworkDirLocator))]
[Register(typeof(GetFrameworkType))]
Expand All @@ -28,6 +31,7 @@ namespace Spriggit.CLI.Lib.Commands.MergeVersionSyncer;
[Register(typeof(ConstructCliEndpoint))]
[Register(typeof(PrepareCliFolder))]
[Register(typeof(SpriggitFileLocator))]
[Register(typeof(DotNetToolTranslationPackagePathProvider))]
[Register(typeof(Engine.Merge.MergeVersionSyncer))]
partial class MergeVersionSyncerContainer : IContainer<Engine.Merge.MergeVersionSyncer>
{
Expand Down
1 change: 1 addition & 0 deletions Spriggit.CLI.Lib/Commands/Sort/SortCommandRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Mutagen.Bethesda.Plugins.Records;
using Serilog;
using Spriggit.Core;
using Spriggit.Core.Services.Singletons;
using Spriggit.Engine.Services.Singletons;

namespace Spriggit.CLI.Lib.Commands.Sort;
Expand Down
3 changes: 2 additions & 1 deletion Spriggit.CLI.Lib/Commands/Sort/SortRunnerContainer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO.Abstractions;
using Serilog;
using Spriggit.Engine.Services.Singletons;
using Spriggit.Core;
using Spriggit.Core.Services.Singletons;
using StrongInject;

namespace Spriggit.CLI.Lib.Commands.Sort;
Expand Down
4 changes: 4 additions & 0 deletions Spriggit.CLI.Lib/EngineContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Noggog.Processes.DI;
using Noggog.WorkEngine;
using Serilog;
using Spriggit.Core;
using Spriggit.Core.Services.Singletons;
using Spriggit.Engine.Services.Singletons;
using StrongInject;

Expand All @@ -21,6 +23,7 @@ namespace Spriggit.CLI.Lib;
[Register(typeof(TargetFrameworkDirLocator))]
[Register(typeof(CurrentVersionsProvider))]
[Register(typeof(ConstructAssemblyLoadedEntryPoint))]
[Register(typeof(ConstructDotNetToolEndpoint))]
[Register(typeof(GetFrameworkType))]
[Register(typeof(PreparePluginFolder))]
[Register(typeof(FindTargetFramework))]
Expand All @@ -32,6 +35,7 @@ namespace Spriggit.CLI.Lib;
[Register(typeof(NugetSourceProvider))]
[Register(typeof(ProcessFactory))]
[Register(typeof(PackageVersioningChecker))]
[Register(typeof(DotNetToolTranslationPackagePathProvider))]
[Register(typeof(AssociatedFilesLocator), typeof(IAssociatedFilesLocator))]
[Register(typeof(ModFilesMover), typeof(IModFilesMover))]
[Register(typeof(ProvideCurrentTime), typeof(IProvideCurrentTime))]
Expand Down
1 change: 0 additions & 1 deletion Spriggit.CLI.Lib/EngineRunner.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.IO.Abstractions;
using Noggog.WorkEngine;
using Spriggit.CLI.Lib.Commands;
using Spriggit.Core.Commands;
using Spriggit.Engine;
using Spriggit.Engine.Services.Singletons;
Expand Down
4 changes: 4 additions & 0 deletions Spriggit.CLI.Lib/FormIDCollisionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Noggog.Processes.DI;
using Noggog.WorkEngine;
using Serilog;
using Spriggit.Core;
using Spriggit.Core.Services.Singletons;
using Spriggit.Engine.Merge;
using Spriggit.Engine.Services.Singletons;
using StrongInject;
Expand All @@ -18,6 +20,7 @@ namespace Spriggit.CLI.Lib;
[Register(typeof(ConstructEntryPoint))]
[Register(typeof(NugetDownloader))]
[Register(typeof(ConstructAssemblyLoadedEntryPoint))]
[Register(typeof(ConstructDotNetToolEndpoint))]
[Register(typeof(FindTargetFramework))]
[Register(typeof(TargetFrameworkDirLocator))]
[Register(typeof(GetFrameworkType))]
Expand All @@ -38,6 +41,7 @@ namespace Spriggit.CLI.Lib;
[Register(typeof(PostSerializeChecker))]
[Register(typeof(SerializeBlocker))]
[Register(typeof(PluginBackupCreator))]
[Register(typeof(DotNetToolTranslationPackagePathProvider))]
[Register(typeof(ProvideCurrentTime), typeof(IProvideCurrentTime))]
[Register(typeof(AssociatedFilesLocator), typeof(IAssociatedFilesLocator))]
partial class FormIDCollisionContainer : IContainer<FormIDCollisionFixer>
Expand Down
34 changes: 0 additions & 34 deletions Spriggit.CLI.Lib/Spriggit.CLI.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,4 @@
<ItemGroup>
<ProjectReference Include="..\Spriggit.Engine\Spriggit.Engine.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Commands\SortProperties\SortPropertiesCommand.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Update="Commands\SortProperties\SortPropertiesFallout4.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Update="Commands\SortProperties\SortPropertiesStarfield.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Update="Commands\MergeVersionSyncer\MergeVersionSyncerContainer.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Update="Commands\MergeVersionSyncer\MergeVersionSyncerRunner.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Update="Commands\MergeVersionSyncer\MergeVersionSyncerCommand.cs">
<CodeLanguage>cs</CodeLanguage>
<DefaultPackFolder>content</DefaultPackFolder>
<BuildAction>Compile</BuildAction>
</Compile>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Spriggit.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Spriggit.CLI.Lib.Commands;
using Spriggit.CLI.Lib.Commands.MergeVersionSyncer;
using Spriggit.CLI.Lib.Commands.Sort;
using Spriggit.Core;
using Spriggit.Core.Commands;
using Spriggit.Engine.Services.Singletons;

try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using Mutagen.Bethesda.Plugins;
using Noggog;
using Spriggit.CLI.Lib.Commands;
using Spriggit.Core;
using Spriggit.Core.Commands;

namespace Spriggit.CLI.Lib;
namespace Spriggit.Core.Commands;

public static class SerializeCommandMetaExtractor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Noggog;

namespace Spriggit.Engine.Services.Singletons;
namespace Spriggit.Core;

public class CurrentVersionsProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using Newtonsoft.Json;
using Noggog;
using Serilog;
using Spriggit.Core;

namespace Spriggit.Engine.Services.Singletons;
namespace Spriggit.Core.Services.Singletons;

public class SpriggitFileLocator
{
Expand Down
4 changes: 4 additions & 0 deletions Spriggit.Core/Spriggit.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Noggog.CSharpExt" />
<PackageReference Include="Mutagen.Bethesda.Kernel" />
<PackageReference Include="CommandLineParser" />
<PackageReference Include="Noggog.SourceGenerators" />
<PackageReference Include="Serilog" />
<PackageReference Include="StrongInject" />
</ItemGroup>

</Project>
12 changes: 10 additions & 2 deletions Spriggit.Engine/CliEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public async Task Serialize(
{
_logger.Error(x);
});
await processWrapper.Run();
var ret = await processWrapper.Run();
if (ret != 0)
{
throw new InvalidOperationException("Failed to serialize");
}
}

public async Task Deserialize(string inputPath, string outputPath, DirectoryPath? dataPath,
Expand All @@ -95,6 +99,10 @@ public async Task Deserialize(string inputPath, string outputPath, DirectoryPath
{
_logger.Error(x);
});
await processWrapper.Run();
var ret = await processWrapper.Run();
if (ret != 0)
{
throw new InvalidOperationException("Failed to deserialize");
}
}
}
Loading

0 comments on commit c0e79f4

Please sign in to comment.