-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Build.cs
76 lines (65 loc) · 2.16 KB
/
Build.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
partial class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main () => Execute<Build>(x => x.Compile);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Solution] readonly Solution Solution;
Target Clean => _ => _
.Before(Restore)
.Executes(() =>
{
AbsolutePath.Create(WorkingDirectory).CreateOrCleanDirectory();
});
Target Restore => _ => _
.Executes(() =>
{
DotNetRestore(s => s
.SetProjectFile(Solution));
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() =>
{
DotNetBuild(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.EnableNoRestore());
});
Target UnitTests => _ => _
.DependsOn(Compile)
.Executes(() =>
{
DotNetTest(s => s
.SetProjectFile(Solution)
.SetFilter("UnitTests")
.SetConfiguration(Configuration)
.EnableNoRestore()
.EnableNoBuild());
});
Target ArchitectureTests => _ => _
.DependsOn(UnitTests)
.Executes(() =>
{
DotNetTest(s => s
.SetProjectFile(Solution)
.SetFilter("ArchTests")
.SetConfiguration(Configuration)
.EnableNoRestore()
.EnableNoBuild());
});
Target BuildAndUnitTests => _ => _
.Triggers(ArchitectureTests)
.Executes(() =>
{
});
}