-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.cake
71 lines (59 loc) · 1.96 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
#addin nuget:?package=Cake.VersionReader
// ------- ARGUMENTS
var target = Argument("target", "all");
var configuration = Argument("configuration", "Release");
var platform = Argument("platform", "x86");
// ----- BUILD SEQUENCE
// Clean build
Task("clean_staging").Does(() => {
Information("Cleaning staging build...");
CreateDirectory("./build");
CleanDirectories("./build/app");
CleanDirectories("./src/**/bin");
CleanDirectories("./src/**/obj");
});
Task("clean").IsDependentOn("clean_staging").Does(() => {
Information("Full cleaning...");
CreateDirectory("./build");
CleanDirectories("./build");
});
// Build KFlearning
Task("build_apps").Does(() =>
{
Information("Publishing KFlearning.App...");
DotNetCorePublish("./src/KFlearning.App/KFlearning.App.csproj", new DotNetCorePublishSettings
{
Verbosity = DotNetCoreVerbosity.Minimal,
Configuration = configuration,
NoBuild = false, // implicit build
NoRestore = false, // implicit nuget restore
PublishReadyToRun = true,
SelfContained = false,
Runtime = "win-" + platform,
OutputDirectory = "./build/app"
});
});
// Build KFlearning and KFmaintenance MSI installer
Task("build_msi").Does(()=>
{
Information("Platform target: " + platform);
Information("Builidng KFlearning installer...");
MSBuild("./src/KFlearning.Setup/KFlearning.Setup.wixproj", new MSBuildSettings
{
Verbosity = Verbosity.Minimal,
Configuration = configuration,
PlatformTarget = platform == "x86" ? PlatformTarget.x86 : PlatformTarget.x64
});
Information("Determining assembly version...");
var version = GetVersionNumber("./build/app/KFlearning.App.exe");
Information("Moving build artifact...");
MoveFiles("./src/KFlearning.Setup/bin/**/*.msi", "./build");
MoveFile("./build/KFlearning.Setup.msi", $"./build/KFlearning-{version}_{platform}.msi");
});
// Build all
Task("all")
.IsDependentOn("clean_staging")
.IsDependentOn("build_apps")
.IsDependentOn("build_msi");
// Run target from command line
RunTarget(target);