forked from graphql-dotnet/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
123 lines (108 loc) · 3.24 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
113
114
115
116
117
118
119
120
121
122
123
#tool "nuget:?package=GitVersion.CommandLine&version=4.0.0-beta0012&prerelease"
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var artifactsDir = Directory(Argument<string>("artifactsDir", "./artifacts"));
var publishDir = Directory(Argument<string>("publishDir", "./publish"));
var framework = Argument<string>("framework", "netstandard2.0");
var runtime = Argument<string>("runtime", "win-x64");
var sln = "./GraphQL.Server.Transports.sln";
var projectFiles = new [] {
"./src/Core/Core.csproj",
"./src/Transports.AspNetCore/Transports.AspNetCore.csproj",
"./src/Transports.Subscriptions.Abstractions/Transports.Subscriptions.Abstractions.csproj",
"./src/Transports.Subscriptions.WebSockets/Transports.Subscriptions.WebSockets.csproj",
"./src/Ui.Playground/Ui.Playground.csproj",
"./src/Ui.GraphiQL/Ui.GraphiQL.csproj",
"./src/Ui.Voyager/Ui.Voyager.csproj",
"./src/Authorization.AspNetCore/Authorization.AspNetCore.csproj"
};
var version = "0.0.0-dev";
Task("Default")
.IsDependentOn("SetVersion")
.IsDependentOn("Pack");
Task("Publish")
.IsDependentOn("Build")
.Does(()=>
{
var settings = new DotNetCorePublishSettings
{
Framework = framework,
Configuration = configuration,
OutputDirectory = publishDir,
Runtime = runtime
};
foreach(var projectFile in projectFiles)
{
DotNetCorePublish(projectFile, settings);
}
});
Task("Pack")
.IsDependentOn("Build")
.IsDependentOn("Test")
.Does(()=>
{
var buildSettings = new DotNetCoreMSBuildSettings();
buildSettings.SetVersion(version);
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = artifactsDir,
IncludeSymbols = true,
MSBuildSettings = buildSettings
};
foreach(var projectFile in projectFiles)
{
DotNetCorePack(projectFile, settings);
}
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Framework = framework,
Configuration = configuration
};
foreach(var projectFile in projectFiles)
{
DotNetCoreBuild(projectFile, settings);
}
});
Task("Clean")
.Does(()=>
{
Information($"Cleaning: {artifactsDir}");
CleanDirectory(artifactsDir);
Information($"Cleaning: {publishDir}");
CleanDirectory(publishDir);
});
Task("Restore")
.Does(()=>
{
foreach(var projectFile in projectFiles)
{
DotNetCoreRestore(projectFile);
}
});
Task("SetVersion")
.Does(()=> {
var versionInfo = GitVersion(new GitVersionSettings {
RepositoryPath = "."
});
version = versionInfo.NuGetVersion;
Information($"Version: {version}, FullSemVer: {versionInfo.FullSemVer}");
if(AppVeyor.IsRunningOnAppVeyor) {
AppVeyor.UpdateBuildVersion(version);
}
});
Task("Test")
.Does(()=> {
var projectFiles = GetFiles("./tests/**/*.csproj");
foreach(var file in projectFiles)
{
DotNetCoreTest(file.FullPath);
}
});
RunTarget(target);