forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
112 lines (93 loc) · 3.58 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
104
105
106
107
108
109
110
111
112
// Main Cake Build entry points. Note most Cake scripts are located under Build/Cake.
#addin nuget:?package=Cake.XdtTransform&version=0.18.1&loaddependencies=true
#addin nuget:?package=Cake.FileHelpers&version=3.2.0
#addin nuget:?package=Cake.Powershell&version=0.4.8
#addin nuget:?package=Dnn.CakeUtils&version=1.1.6
#tool "nuget:?package=GitVersion.CommandLine&version=5.0.1"
#tool "nuget:?package=Microsoft.TestPlatform&version=15.7.0"
#tool "nuget:?package=NUnitTestAdapter&version=2.1.1"
#load "local:?path=Build/Cake/ci.cake"
#load "local:?path=Build/Cake/compiling.cake"
#load "local:?path=Build/Cake/create-database.cake"
#load "local:?path=Build/Cake/database.cake"
#load "local:?path=Build/Cake/devsite.cake"
#load "local:?path=Build/Cake/nuget.cake"
#load "local:?path=Build/Cake/packaging.cake"
#load "local:?path=Build/Cake/settings.cake"
#load "local:?path=Build/Cake/testing.cake"
#load "local:?path=Build/Cake/thirdparty.cake"
#load "local:?path=Build/Cake/unit-tests.cake"
#load "local:?path=Build/Cake/version.cake"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var tempFolder = "./Temp/";
var tempDir = Directory(tempFolder);
var artifactsFolder = "./Artifacts/";
var artifactsDir = Directory(artifactsFolder);
var websiteFolder = "./Website/";
var websiteDir = Directory(websiteFolder);
// Global information variables
bool isRunningInCI = false;
//////////////////////////////////////////////////////////////////////
// SETUP/TEARDOWN
//////////////////////////////////////////////////////////////////////
// Executed BEFORE the first task.
Setup(context =>
{
isRunningInCI = context.HasEnvironmentVariable("TF_BUILD");
Information("Is Running in CI : {0}", isRunningInCI);
if(Settings.Version == "auto" && !isRunningInCI){
// Temporarelly commit all changes to prevent checking in scripted changes like versioning.
StartPowershellScript("git add .");
StartPowershellScript("git commit --allow-empty -m 'backup'");
}
});
// Executed AFTER the last task even if any task fails.
Teardown(context =>
{
if(Settings.Version == "auto" && !isRunningInCI){
// Undoes the script changes to all tracked files.
StartPowershellScript("git reset --hard");
// Undoes the setup commit keeping file states as before this build script ran.
StartPowershellScript("git reset HEAD^");
}
});
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("CleanWebsite")
.Does(() =>
{
CleanDirectory(websiteDir);
});
Task("CleanTemp")
.Does(() =>
{
CleanDirectory(tempDir);
});
Task("CleanArtifacts")
.Does(() =>
{
CleanDirectory(artifactsDir);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("CleanArtifacts")
.IsDependentOn("UpdateDnnManifests")
.IsDependentOn("CreateInstall")
.IsDependentOn("CreateUpgrade")
.IsDependentOn("CreateDeploy")
.IsDependentOn("CreateSymbols");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);