-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.cake
67 lines (59 loc) · 1.85 KB
/
build.cake
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
/// <summary>
/// Main Cake build script to manage the build, restore, and clean tasks.
/// Supports conditional execution based on provided arguments.
/// </summary>
var configuration = Argument("configuration", "Release");
// Define the solution context
var slnContext = ".";
/// <summary>
/// Task to clean build output directories.
/// Ensures a clean state before restoring or building the solution.
/// </summary>
Task("Clean")
.Does(() =>
{
Information("Cleaning build output directories...");
DotNetClean($"{slnContext}/NETCore.Keycloak.sln");
});
/// <summary>
/// Task to restore NuGet packages for the solution.
/// Depends on the Clean task to ensure a clean environment before restoring.
/// </summary>
Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
Information("Restoring NuGet packages...");
DotNetRestore($"{slnContext}/NETCore.Keycloak.sln");
});
/// <summary>
/// Task to build the solution.
/// Depends on the Restore task to ensure all packages are restored before building.
/// </summary>
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building the solution...");
DotNetBuild($"{slnContext}/NETCore.Keycloak.sln", new DotNetBuildSettings
{
Configuration = configuration
});
});
/// <summary>
/// Default task to orchestrate conditional execution based on the provided "target" argument.
/// If a target is specified, runs the "Test" task.
/// </summary>
Task("Default")
.Does(() =>
{
// Get the target argument if provided
var target = Argument<string>("target", null);
// Check if a specific target is provided and execute the Test task
if (!string.IsNullOrEmpty(target))
{
RunTarget("Build");
}
});
// Execute the Default task
RunTarget("Default");