-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.cake
91 lines (80 loc) · 4.01 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
#addin nuget:?package=Cake.MinVer&version=2.0.0
////////////////////////////////////////////////////////////////
// Tasks
Task("Clean")
.Does(ctx =>
{
CleanDirectory("./.artifacts");
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
});
Task("Copy-Files")
.IsDependentOn("Clean")
.Does(ctx =>
{
CopyFile("resources/CODE_OF_CONDUCT.md", "./templates/lib/CODE_OF_CONDUCT.md");
CopyFile("resources/default.gitignore", "./templates/lib/.gitignore");
CopyFile("resources/Directory.Build.props", "./templates/lib/src/Directory.Build.props");
CopyFile("resources/Directory.Packages.Lib.props", "./templates/lib/src/Directory.Packages.props");
CopyFile("resources/Directory.Build.targets", "./templates/lib/src/Directory.Build.targets");
CopyFile("resources/dotnet-tools.json", "./templates/lib/dotnet-tools.json");
CopyFile("resources/global.json", "./templates/lib/global.json");
CopyFile("resources/LICENSE.md", "./templates/lib/LICENSE.md");
CopyFile("resources/root.editorconfig", "./templates/lib/.editorconfig");
CopyFile("resources/source.editorconfig", "./templates/lib/src/.editorconfig");
CopyFile("resources/test.editorconfig", "./templates/lib/src/TheProject.Tests/.editorconfig");
CopyFile("resources/stylecop.json", "./templates/lib/src/stylecop.json");
CopyFile("resources/CODE_OF_CONDUCT.md", "./templates/cli/CODE_OF_CONDUCT.md");
CopyFile("resources/default.gitignore", "./templates/cli/.gitignore");
CopyFile("resources/Directory.Build.props", "./templates/cli/src/Directory.Build.props");
CopyFile("resources/Directory.Packages.Cli.props", "./templates/cli/src/Directory.Packages.props");
CopyFile("resources/Directory.Build.targets", "./templates/cli/src/Directory.Build.targets");
CopyFile("resources/dotnet-tools.json", "./templates/cli/dotnet-tools.json");
CopyFile("resources/global.json", "./templates/cli/global.json");
CopyFile("resources/LICENSE.md", "./templates/cli/LICENSE.md");
CopyFile("resources/root.editorconfig", "./templates/cli/.editorconfig");
CopyFile("resources/source.editorconfig", "./templates/cli/src/.editorconfig");
CopyFile("resources/test.editorconfig", "./templates/cli/src/TheProject.Tests/.editorconfig");
CopyFile("resources/stylecop.json", "./templates/cli/src/stylecop.json");
CopyFile("resources/CODE_OF_CONDUCT.md", "./templates/empty/CODE_OF_CONDUCT.md");
CopyFile("resources/default.gitignore", "./templates/empty/.gitignore");
CopyFile("resources/Directory.Build.props", "./templates/empty/src/Directory.Build.props");
CopyFile("resources/Directory.Packages.Empty.props", "./templates/empty/src/Directory.Packages.props");
CopyFile("resources/Directory.Build.targets", "./templates/empty/src/Directory.Build.targets");
CopyFile("resources/dotnet-tools.json", "./templates/empty/dotnet-tools.json");
CopyFile("resources/global.json", "./templates/empty/global.json");
CopyFile("resources/LICENSE.md", "./templates/empty/LICENSE.md");
CopyFile("resources/root.editorconfig", "./templates/empty/.editorconfig");
CopyFile("resources/source.editorconfig", "./templates/empty/src/.editorconfig");
CopyFile("resources/stylecop.json", "./templates/empty/src/stylecop.json");
});
Task("Pack")
.IsDependentOn("Copy-Files")
.Does(ctx =>
{
DotNetPack("./Templates.csproj", new DotNetPackSettings {
Configuration = "Release",
OutputDirectory = "./.artifacts"
});
});
Task("Uninstall")
.ContinueOnError()
.Does(ctx =>
{
StartProcess("dotnet", "new -u SpectreSystems.Templates");
});
Task("Install")
.IsDependentOn("Pack")
.IsDependentOn("Uninstall")
.Does(ctx =>
{
// Get the version
var minver = MinVer(new MinVerSettings {
DefaultPreReleasePhase = "preview",
});
// Install
StartProcess("dotnet", $"new -i ./.artifacts/SpectreSystems.Templates.{minver.Version}.nupkg");
});
////////////////////////////////////////////////////////////////
// Execution
RunTarget(Argument("target", "Pack"));