You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/02-fundamentals/05-targets.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Target Definitions
3
3
---
4
4
5
-
Inside a `Build` class, you can define your build steps as `Target` properties. The implementation for a build step is provided as a lambda function through the `Executes` method:
5
+
Inside a `Build` class, you can define your build steps as `TargetX` properties. The implementation for a build step is provided as a lambda function through the `Executes` method:
6
6
7
7
<Tabs>
8
8
<TabItemvalue="regular"label="Regular Targets">
@@ -12,7 +12,7 @@ class Build : NukeBuild
12
12
{
13
13
publicstaticintMain() =>Execute<Build>();
14
14
15
-
TargetMyTarget=>_=>_
15
+
TargetXMyTargetX=>_=>_
16
16
.Executes(() =>
17
17
{
18
18
Console.WriteLine("Hello!");
@@ -29,7 +29,7 @@ class Build : NukeBuild
29
29
{
30
30
publicstaticintMain() =>Execute<Build>();
31
31
32
-
TargetMyTarget=>_=>_
32
+
TargetXMyTargetX=>_=>_
33
33
.Executes(async () =>
34
34
{
35
35
awaitConsole.Out.WriteLineAsync("Hello!");
@@ -58,13 +58,13 @@ Define that target `A` must run before target `B` unless `A` is skipped:
58
58
```csharp title="Build.cs"
59
59
classBuild : NukeBuild
60
60
{
61
-
TargetA=>_=>_
61
+
TargetXA=>_=>_
62
62
// highlight-start
63
63
.DependentFor(B) // Choose this...
64
64
// highlight-end
65
65
.Executes(() => { });
66
66
67
-
TargetB=>_=>_
67
+
TargetXB=>_=>_
68
68
// highlight-start
69
69
.DependsOn(A) // ...or this!
70
70
// highlight-end
@@ -82,13 +82,13 @@ Define that target `A` runs before target `B` if both are scheduled:
82
82
```csharp title="Build.cs"
83
83
classBuild : NukeBuild
84
84
{
85
-
TargetA=>_=>_
85
+
TargetXA=>_=>_
86
86
// highlight-start
87
87
.Before(B) // Choose this...
88
88
// highlight-end
89
89
.Executes(() => { });
90
90
91
-
TargetB=>_=>_
91
+
TargetXB=>_=>_
92
92
// highlight-start
93
93
.After(A) // ...or this!
94
94
// highlight-end
@@ -107,13 +107,13 @@ Define that target `A` invokes target `B` once it completes:
107
107
```csharp title="Build.cs"
108
108
classBuild : NukeBuild
109
109
{
110
-
TargetA=>_=>_
110
+
TargetXA=>_=>_
111
111
// highlight-start
112
112
.Triggers(B) // Choose this...
113
113
// highlight-end
114
114
.Executes(() => { });
115
115
116
-
TargetB=>_=>_
116
+
TargetXB=>_=>_
117
117
// highlight-start
118
118
.TriggeredBy(A) // ...or this!
119
119
// highlight-end
@@ -141,13 +141,13 @@ The execution is nondeterministic between `A->B->C` and `B->A->C`. This isn't ne
141
141
```csharp title="Build.cs"
142
142
classBuild : NukeBuild
143
143
{
144
-
TargetA=>_=>_
144
+
TargetXA=>_=>_
145
145
.Executes(() => { });
146
146
147
-
TargetB=>_=>_
147
+
TargetXB=>_=>_
148
148
.Executes(() => { });
149
149
150
-
TargetC=>_=>_
150
+
TargetXC=>_=>_
151
151
// highlight-start
152
152
.DependsOn(A, B)
153
153
// highlight-end
@@ -163,16 +163,16 @@ The execution is always deterministic with `A->B->C`.
163
163
```csharp title="Build.cs"
164
164
classBuild : NukeBuild
165
165
{
166
-
TargetA=>_=>_
166
+
TargetXA=>_=>_
167
167
.Executes(() => { });
168
168
169
-
TargetB=>_=>_
169
+
TargetXB=>_=>_
170
170
// highlight-start
171
171
.DependsOn(A)
172
172
// highlight-end
173
173
.Executes(() => { });
174
174
175
-
TargetC=>_=>_
175
+
TargetXC=>_=>_
176
176
// highlight-start
177
177
.DependsOn(B)
178
178
// highlight-end
@@ -199,10 +199,10 @@ class Build : NukeBuild
199
199
{
200
200
readonlyList<string> Data=new();
201
201
202
-
TargetA=>_=>_
202
+
TargetXA=>_=>_
203
203
.Executes(() => { /* Populate Data */ });
204
204
205
-
TargetB=>_=>_
205
+
TargetXB=>_=>_
206
206
.DependsOn(A)
207
207
// highlight-start
208
208
.OnlyWhenDynamic(() =>Data.Any())
@@ -219,10 +219,10 @@ Define a condition that is checked before target `A` and `B` execute:
219
219
```csharp
220
220
classBuild : NukeBuild
221
221
{
222
-
TargetA=>_=>_
222
+
TargetXA=>_=>_
223
223
.Executes(() => { });
224
224
225
-
TargetB=>_=>_
225
+
TargetXB=>_=>_
226
226
// highlight-start
227
227
.OnlyWhenStatic(() =>IsLocalBuild)
228
228
// By default, dependencies are skipped
@@ -247,7 +247,7 @@ You can define target requirements that are checked right at the beginning of th
247
247
```csharp
248
248
classBuild : NukeBuild
249
249
{
250
-
TargetA=>_=>_
250
+
TargetXA=>_=>_
251
251
// highlight-start
252
252
.Requires(() =>IsServerBuild)
253
253
// highlight-end
@@ -275,7 +275,7 @@ Define that execution continues after target `A` throws:
275
275
```csharp
276
276
classBuild : NukeBuild
277
277
{
278
-
TargetA=>_=>_
278
+
TargetXA=>_=>_
279
279
// highlight-start
280
280
.ProceedAfterFailure()
281
281
// highlight-end
@@ -284,7 +284,7 @@ class Build : NukeBuild
284
284
Assert.Fail("error");
285
285
});
286
286
287
-
TargetB=>_=>_
287
+
TargetXB=>_=>_
288
288
.DependsOn(A)
289
289
.Executes(() => { });
290
290
}
@@ -298,13 +298,13 @@ Define that target `B` executes even if another target fails:
298
298
```csharp
299
299
classBuild : NukeBuild
300
300
{
301
-
TargetA=>_=>_
301
+
TargetXA=>_=>_
302
302
.Executes(() =>
303
303
{
304
304
Assert.Fail("error");
305
305
});
306
306
307
-
TargetB=>_=>_
307
+
TargetXB=>_=>_
308
308
// highlight-start
309
309
.AssuredAfterFailure()
310
310
// highlight-end
@@ -323,7 +323,7 @@ It is good practice to follow the [single-responsibility principle](https://en.w
0 commit comments