-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
169 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Synthesis.Bethesda.Execution/Patchers/Running/Git/BuildDirectoryCleaner.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.IO.Abstractions; | ||
using Noggog; | ||
using Serilog; | ||
using Synthesis.Bethesda.Execution.DotNet.Dto; | ||
using Synthesis.Bethesda.Execution.Patchers.Git; | ||
|
||
namespace Synthesis.Bethesda.Execution.Patchers.Running.Git; | ||
|
||
public class BuildDirectoryCleaner | ||
{ | ||
private readonly IFileSystem _fileSystem; | ||
private readonly ILogger _logger; | ||
|
||
public BuildDirectoryCleaner( | ||
IFileSystem fileSystem, | ||
ILogger logger) | ||
{ | ||
_fileSystem = fileSystem; | ||
_logger = logger; | ||
} | ||
|
||
public void Clean( | ||
RunnerRepoInfo info, | ||
DotNetVersion dotNetVersion, | ||
GitCompilationMeta? meta) | ||
{ | ||
if (dotNetVersion.Version == meta?.NetSdkVersion) return; | ||
var buildFolder = Path.Combine(info.Project.ProjPath.Directory!, "bin"); | ||
var objFolder = Path.Combine(info.Project.ProjPath.Directory!, "obj"); | ||
_logger.Information("Deleting build folder", buildFolder); | ||
_fileSystem.Directory.DeleteEntireFolder(buildFolder); | ||
_logger.Information("Deleting obj folder", objFolder); | ||
_fileSystem.Directory.DeleteEntireFolder(objFolder); | ||
} | ||
} |
14 changes: 8 additions & 6 deletions
14
Synthesis.Bethesda.Execution/Patchers/Running/Git/GitCompilationMeta.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
namespace Synthesis.Bethesda.Execution.Patchers.Running.Git; | ||
|
||
public class GitCompilationMeta | ||
public record GitCompilationMeta | ||
{ | ||
public string MutagenVersion { get; set; } = string.Empty; | ||
public string SynthesisVersion { get; set; } = string.Empty; | ||
public string Sha { get; set; } = string.Empty; | ||
public bool DoesNotHaveRunnability { get; set; } | ||
public SettingsConfiguration? SettingsConfiguration { get; set; } | ||
public required string SynthesisUiVersion { get; init; } | ||
public required string NetSdkVersion { get; init; } | ||
public required string MutagenVersion { get; init; } | ||
public required string SynthesisVersion { get; init; } | ||
public required string Sha { get; init; } | ||
public bool DoesNotHaveRunnability { get; init; } | ||
public SettingsConfiguration? SettingsConfiguration { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 9 additions & 12 deletions
21
Synthesis.Bethesda.Execution/Patchers/Running/Git/ShouldShortCircuitCompilation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
using Synthesis.Bethesda.Execution.Patchers.Git; | ||
using Mutagen.Bethesda.Synthesis.Versioning; | ||
using Synthesis.Bethesda.Execution.Patchers.Git; | ||
|
||
namespace Synthesis.Bethesda.Execution.Patchers.Running.Git; | ||
|
||
public interface IShouldShortCircuitCompilation | ||
{ | ||
bool ShouldShortCircuit(RunnerRepoInfo info); | ||
} | ||
|
||
public class ShouldShortCircuitCompilation : IShouldShortCircuitCompilation | ||
public class ShouldShortCircuitCompilation | ||
{ | ||
private readonly IShortCircuitSettingsProvider _settingsProvider; | ||
private readonly IBuildMetaFileReader _metaFileReader; | ||
private readonly IProvideCurrentVersions _provideCurrentVersions; | ||
|
||
public ShouldShortCircuitCompilation( | ||
IShortCircuitSettingsProvider settingsProvider, | ||
IBuildMetaFileReader metaFileReader) | ||
IBuildMetaFileReader metaFileReader, | ||
IProvideCurrentVersions provideCurrentVersions) | ||
{ | ||
_settingsProvider = settingsProvider; | ||
_metaFileReader = metaFileReader; | ||
_provideCurrentVersions = provideCurrentVersions; | ||
} | ||
|
||
public bool ShouldShortCircuit(RunnerRepoInfo info) | ||
public bool ShouldShortCircuit(RunnerRepoInfo info, GitCompilationMeta? meta) | ||
{ | ||
if (!_settingsProvider.Shortcircuit) return false; | ||
var meta = _metaFileReader.Read(info.MetaPath); | ||
if (meta == null) return false; | ||
if (meta.Sha != info.Target.TargetSha) return false; | ||
if (meta.MutagenVersion != info.TargetVersions.Mutagen) return false; | ||
if (meta.SynthesisVersion != info.TargetVersions.Synthesis) return false; | ||
if (meta.SynthesisUiVersion != _provideCurrentVersions.SynthesisVersion) return false; | ||
return true; | ||
} | ||
} |
14 changes: 11 additions & 3 deletions
14
Synthesis.Bethesda.Execution/Patchers/Running/Git/WriteShortCircuitMeta.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.