-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.cake
103 lines (82 loc) · 2.78 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Install modules
#module nuget:?package=Cake.DotNetTool.Module&version=0.1.0
// Install addins.
#addin "nuget:https://api.nuget.org/v3/index.json?package=Cake.Gulp&version=0.12.0"
// Install tools.
#tool "nuget:https://api.nuget.org/v3/index.json?package=nuget.commandline&version=4.9.2"
// Load other scripts.
#load "./build/parameters.cake"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
var solutionName = "Ocelot.ConfigEditor";
var solutionPath = $"./{solutionName}.sln";
var projectPath = $"./src/{solutionName}/{solutionName}.csproj";
var buildDir = Directory($"./src/{solutionName}/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
var settings = new DotNetCoreCleanSettings
{
Configuration = configuration
};
DotNetCoreClean(solutionPath, settings);
});
Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetCoreRestore(solutionPath);
});
Task("Gulp")
.Does(() =>
{
Gulp.Local.Execute(settings =>
{
settings.WithGulpFile($"./src/{solutionName}/gulpfile.js");
settings.SetPathToGulpJs($"./src/{solutionName}/node_modules/gulp/bin/gulp.js");
});
});
Task("Build")
.IsDependentOn("Restore")
.IsDependentOn("Gulp")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
NoRestore = true,
Configuration = configuration
};
DotNetCoreBuild(solutionPath, settings);
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = "./artifacts/",
NoBuild = true,
NoRestore = true
};
DotNetCorePack(projectPath, settings);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);