forked from ChilliCream/graphql-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.cs
63 lines (54 loc) · 1.9 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
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.AzurePipelines;
using Nuke.Common.Execution;
using Nuke.Common.Tools.DotNet;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Helpers;
[CheckBuildProjectConfigurations]
[UnsetVisualStudioEnvironmentVariables]
partial class Build : NukeBuild
{
public static int Main() => Execute<Build>(x => x.Compile);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly string Configuration = IsLocalBuild ? Debug : Release;
[CI] readonly AzurePipelines DevOpsPipeLine;
Target Clean => _ => _
.Before(Restore)
.Executes(() =>
{
});
Target Restore => _ => _
.Executes(() =>
{
DotNetBuildSonarSolution(AllSolutionFile);
DotNetRestore(c => c.SetProjectFile(AllSolutionFile));
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() =>
{
if (!InvokedTargets.Contains(Restore))
{
DotNetBuildSonarSolution(AllSolutionFile);
}
DotNetBuild(c => c
.SetProjectFile(AllSolutionFile)
.SetNoRestore(InvokedTargets.Contains(Restore))
.SetConfiguration(Configuration)
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.SetVersion(GitVersion.SemVer));
});
Target Reset => _ => _
.Executes(() =>
{
TryDelete(AllSolutionFile);
TryDelete(SonarSolutionFile);
TryDelete(TestSolutionFile);
TryDelete(PackSolutionFile);
DotNetBuildSonarSolution(AllSolutionFile);
DotNetRestore(c => c.SetProjectFile(AllSolutionFile));
});
}