Skip to content

Commit 9a9c241

Browse files
committed
moves DependsOn to Target base fluent interface so dependsOn can be used in groups
1 parent f51c29d commit 9a9c241

File tree

3 files changed

+85
-35
lines changed

3 files changed

+85
-35
lines changed

src/FlubuCore/Context/FluentInterface/Interfaces/ITarget.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -169,41 +169,6 @@ public interface ITarget : ITargetBaseFluentInterfaceOfT<ITarget>
169169
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
170170
new ITarget DoAsync<T, T1, T2, T3, T4>(Func<ITaskContext, T, T1, T2, T3, T4, Task> doAction, T param, T1 param2, T2 param3, T3 param4, T4 param5, Action<DoTaskAsync6<T, T1, T2, T3, T4>> doOptions = null);
171171

172-
/// <summary>
173-
/// Specifies targets on which this target depends on.
174-
/// </summary>
175-
/// <param name="targetNames">The dependency target names.</param>
176-
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
177-
ITarget DependsOn(params string[] targetNames);
178-
179-
/// <summary>
180-
/// Specifies targets on which this target depends on. Execution of dependant targets is synchronus.
181-
/// </summary>
182-
/// <param name="targets">The dependency target names.</param>
183-
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
184-
ITarget DependsOn(params ITargetInternal[] targets);
185-
186-
/// <summary>
187-
/// Specifies targets on which this target depends on. Execution of dependant targets is asynchronus.
188-
/// </summary>
189-
/// <param name="targets">The dependency target names.</param>
190-
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
191-
ITarget DependsOnAsync(params ITargetInternal[] targets);
192-
193-
/// <summary>
194-
/// Specifies targets on which this target depends on.
195-
/// </summary>
196-
/// <param name="targets">The dependency target names.</param>
197-
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
198-
ITarget DependsOn(params ITarget[] targets);
199-
200-
/// <summary>
201-
/// Specifies targets on which this target depends on. Execution of dependant targets is asynchronus.
202-
/// </summary>
203-
/// <param name="targets">The dependency target names.</param>
204-
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
205-
ITarget DependsOnAsync(params ITarget[] targets);
206-
207172
/// <summary>
208173
/// Sets the target as the default target for the runner.
209174
/// </summary>

src/FlubuCore/Context/FluentInterface/Interfaces/ITargetBaseFluentInterface.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,41 @@ public interface ITargetBaseFluentInterfaceOfT<TTargetFluentInterface> : ITarget
222222
/// </summary>
223223
/// <returns></returns>
224224
TTargetFluentInterface SequentialLogging(bool enable);
225+
226+
/// <summary>
227+
/// Specifies targets on which this target depends on.
228+
/// </summary>
229+
/// <param name="targetNames">The dependency target names.</param>
230+
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
231+
TTargetFluentInterface DependsOn(params string[] targetNames);
232+
233+
/// <summary>
234+
/// Specifies targets on which this target depends on. Execution of dependant targets is synchronus.
235+
/// </summary>
236+
/// <param name="targets">The dependency target names.</param>
237+
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
238+
TTargetFluentInterface DependsOn(params ITargetInternal[] targets);
239+
240+
/// <summary>
241+
/// Specifies targets on which this target depends on. Execution of dependant targets is asynchronus.
242+
/// </summary>
243+
/// <param name="targets">The dependency target names.</param>
244+
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
245+
TTargetFluentInterface DependsOnAsync(params ITargetInternal[] targets);
246+
247+
/// <summary>
248+
/// Specifies targets on which this target depends on.
249+
/// </summary>
250+
/// <param name="targets">The dependency target names.</param>
251+
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
252+
TTargetFluentInterface DependsOn(params ITarget[] targets);
253+
254+
/// <summary>
255+
/// Specifies targets on which this target depends on. Execution of dependant targets is asynchronus.
256+
/// </summary>
257+
/// <param name="targets">The dependency target names.</param>
258+
/// <returns>This same instance of <see cref="ITargetInternal" />.</returns>
259+
TTargetFluentInterface DependsOnAsync(params ITarget[] targets);
225260
}
226261

227262
public interface ITargetBaseFluentInterface

src/FlubuCore/Context/FluentInterface/TargetBaseFluentInterface.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,56 @@ public TargetBaseFluentInterface()
3333

3434
protected int ActionCount { get; set; }
3535

36+
public TTargetFluentInterface DependsOn(params string[] targetNames)
37+
{
38+
LastTargetAction = TargetAction.AddDependency;
39+
ActionCount = targetNames.Length;
40+
Target.DependsOn(targetNames);
41+
return this as TTargetFluentInterface;
42+
}
43+
44+
public TTargetFluentInterface DependsOn(params ITargetInternal[] targets)
45+
{
46+
LastTargetAction = TargetAction.AddDependency;
47+
ActionCount = targets.Length;
48+
Target.DependsOn(targets);
49+
return this as TTargetFluentInterface;
50+
}
51+
52+
public TTargetFluentInterface DependsOn(params ITarget[] targets)
53+
{
54+
LastTargetAction = TargetAction.AddDependency;
55+
ActionCount = targets.Length;
56+
foreach (var t in targets)
57+
{
58+
var target = (TargetFluentInterface)t;
59+
Target.DependsOn(target.Target);
60+
}
61+
62+
return this as TTargetFluentInterface;
63+
}
64+
65+
public TTargetFluentInterface DependsOnAsync(params ITargetInternal[] targets)
66+
{
67+
LastTargetAction = TargetAction.AddDependency;
68+
ActionCount = targets.Length;
69+
Target.DependsOnAsync(targets);
70+
return this as TTargetFluentInterface;
71+
}
72+
73+
public TTargetFluentInterface DependsOnAsync(params ITarget[] targets)
74+
{
75+
LastTargetAction = TargetAction.AddDependency;
76+
ActionCount = targets.Length;
77+
foreach (var t in targets)
78+
{
79+
var target = (TargetFluentInterface)t;
80+
Target.DependsOnAsync(target.Target);
81+
}
82+
83+
return this as TTargetFluentInterface;
84+
}
85+
3686
public TTargetFluentInterface AddTask(params ITask[] tasks)
3787
{
3888
ActionCount = tasks.Length;

0 commit comments

Comments
 (0)