-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
62 lines (51 loc) · 1.46 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
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var solutionFile = GetFiles("./*.sln").First();
var solution = new Lazy<SolutionParserResult>(() => ParseSolution(solutionFile));
var distDir = Directory("./dist");
var buildDir = Directory("./build");
Task("Clean")
.IsDependentOn("Clean-Outputs")
.Does(() =>
{
MSBuild(solutionFile, settings => settings
.SetConfiguration(configuration)
.WithTarget("Clean")
.SetVerbosity(Verbosity.Minimal));
});
Task("Clean-Outputs")
.Does(() =>
{
CleanDirectory(buildDir);
CleanDirectory(distDir);
});
Task("Build")
.IsDependentOn("Clean-Outputs")
.Does(() =>
{
NuGetRestore(solutionFile);
MSBuild(solutionFile, settings => settings
.SetConfiguration(configuration)
.WithTarget("Rebuild")
.SetVerbosity(Verbosity.Minimal));
});
Task("Websites")
.IsDependentOn("Build")
.Does(() =>
{
var project = solution.Value
.Projects
.First();
Information("Publishing {0}", project.Name);
var publishDir = distDir + Directory(project.Name);
MSBuild(project.Path, settings => settings
.SetConfiguration(configuration)
.WithProperty("DeployOnBuild", "true")
.WithProperty("WebPublishMethod", "FileSystem")
.WithProperty("DeployTarget", "WebPublish")
.WithProperty("publishUrl", MakeAbsolute(publishDir).FullPath)
.SetVerbosity(Verbosity.Minimal));
});
Task("Default")
.IsDependentOn("Websites");
RunTarget(target);