Skip to content

Commit 7e145a9

Browse files
authored
Move ICleanStrategy/IDirtyStrategy to Core — Core owns Differential contracts (#385)
* WIP: prep for CleanStrategy/DirtyStrategy move * Move ICleanStrategy/IDirtyStrategy to Core, Differential aliases extend Core - Create ICleanStrategy and IDirtyStrategy in Core.Differential namespace - Update AbstractBootstrap extension points to use the actual interface types: CleanStrategy<T>() where T : ICleanStrategy, new() DirtyStrategy<T>() where T : IDirtyStrategy, new() - Differential interfaces become backward-compatible aliases extending Core's - Default implementations use the local (Differential) interface types This satisfies: Core owns the canonical interface definitions. Differential references Core (via ProjectReference) and implements them. No circular dependency.
1 parent 9dd44d6 commit 7e145a9

5 files changed

Lines changed: 45 additions & 37 deletions

File tree

src/c#/GeneralUpdate.Core/Configuration/AbstractBootstrap.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,11 @@ protected T GetOption<T>(UpdateOption<T>? option)
8585
public TBootstrap DownloadOrchestrator<T>() where T : Download.Abstractions.IDownloadOrchestrator, new()
8686
{ _extensions[typeof(Download.Abstractions.IDownloadOrchestrator)] = typeof(T); return (TBootstrap)this; }
8787

88-
/// <summary>Register a custom clean strategy by type name (interface lives in GeneralUpdate.Differential).</summary>
89-
public TBootstrap CleanStrategy<T>() where T : class, new()
90-
{ _extensions[typeof(T)] = typeof(T); return (TBootstrap)this; }
88+
public TBootstrap CleanStrategy<T>() where T : Differential.ICleanStrategy, new()
89+
{ _extensions[typeof(Differential.ICleanStrategy)] = typeof(T); return (TBootstrap)this; }
9190

92-
/// <summary>Register a custom dirty strategy by type name (interface lives in GeneralUpdate.Differential).</summary>
93-
public TBootstrap DirtyStrategy<T>() where T : class, new()
94-
{ _extensions[typeof(T)] = typeof(T); return (TBootstrap)this; }
91+
public TBootstrap DirtyStrategy<T>() where T : Differential.IDirtyStrategy, new()
92+
{ _extensions[typeof(Differential.IDirtyStrategy)] = typeof(T); return (TBootstrap)this; }
9593

9694
public TBootstrap ConfigureBlackList(BlackListConfig config)
9795
{
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Threading.Tasks;
2+
3+
namespace GeneralUpdate.Core.Differential;
4+
5+
/// <summary>
6+
/// Defines the complete execution strategy for the Clean (patch-generation) phase.
7+
/// Implement this interface to fully control how source and target directories are
8+
/// compared and how the patch output is produced.
9+
/// </summary>
10+
public interface ICleanStrategy
11+
{
12+
/// <summary>
13+
/// Executes the Clean phase: compares <paramref name="sourcePath"/> with
14+
/// <paramref name="targetPath"/> and writes the resulting patch artifacts to
15+
/// <paramref name="patchPath"/>.
16+
/// </summary>
17+
Task ExecuteAsync(string sourcePath, string targetPath, string patchPath);
18+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Threading.Tasks;
2+
3+
namespace GeneralUpdate.Core.Differential;
4+
5+
/// <summary>
6+
/// Defines the complete execution strategy for the Dirty (patch-application) phase.
7+
/// Implement this interface to fully control how patch files are applied to the
8+
/// target application directory.
9+
/// </summary>
10+
public interface IDirtyStrategy
11+
{
12+
/// <summary>
13+
/// Executes the Dirty phase: applies patches from <paramref name="patchPath"/>
14+
/// to the application files in <paramref name="appPath"/>.
15+
/// </summary>
16+
Task ExecuteAsync(string appPath, string patchPath);
17+
}
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
using System.Threading.Tasks;
2-
1+
// ReSharper disable once CheckNamespace
32
namespace GeneralUpdate.Differential.Matchers
43
{
5-
/// <summary>
6-
/// Defines the complete execution strategy for the Clean (patch-generation) phase.
7-
/// Implement this interface to fully control how source and target directories are
8-
/// compared and how the patch output is produced.
9-
/// </summary>
10-
public interface ICleanStrategy
11-
{
12-
/// <summary>
13-
/// Executes the Clean phase: compares <paramref name="sourcePath"/> with
14-
/// <paramref name="targetPath"/> and writes the resulting patch artifacts to
15-
/// <paramref name="patchPath"/>.
16-
/// </summary>
17-
Task ExecuteAsync(string sourcePath, string targetPath, string patchPath);
18-
}
4+
/// <summary>Backward-compatible alias for <see cref="Core.Differential.ICleanStrategy"/>.</summary>
5+
public interface ICleanStrategy : GeneralUpdate.Core.Differential.ICleanStrategy { }
196
}
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
using System.Threading.Tasks;
2-
1+
// ReSharper disable once CheckNamespace
32
namespace GeneralUpdate.Differential.Matchers
43
{
5-
/// <summary>
6-
/// Defines the complete execution strategy for the Dirty (patch-application) phase.
7-
/// Implement this interface to fully control how patch files are applied to the
8-
/// target application directory.
9-
/// </summary>
10-
public interface IDirtyStrategy
11-
{
12-
/// <summary>
13-
/// Executes the Dirty phase: applies patches from <paramref name="patchPath"/>
14-
/// to the application files in <paramref name="appPath"/>.
15-
/// </summary>
16-
Task ExecuteAsync(string appPath, string patchPath);
17-
}
4+
/// <summary>Backward-compatible alias for <see cref="Core.Differential.IDirtyStrategy"/>.</summary>
5+
public interface IDirtyStrategy : GeneralUpdate.Core.Differential.IDirtyStrategy { }
186
}

0 commit comments

Comments
 (0)