forked from JaneySprings/DotRush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
103 lines (90 loc) · 4.12 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
using System.Runtime.InteropServices;
using _Path = System.IO.Path;
public string RootDirectory => MakeAbsolute(Directory("./")).ToString();
public string ArtifactsDirectory => _Path.Combine(RootDirectory, "artifacts");
public string VSCodeExtensionDirectory => _Path.Combine(RootDirectory, "extension");
var target = Argument("target", "vsix");
var version = Argument("release-version", "1.0.0");
var configuration = Argument("configuration", "debug");
var runtime = Argument("arch", RuntimeInformation.RuntimeIdentifier);
Setup(context => {
var date = DateTime.Now;
version = $"{DateTime.Now.ToString("yy")}.{date.ToString("%M")}.{date.DayOfYear}";
EnsureDirectoryExists(ArtifactsDirectory);
});
Task("clean").Does(() => {
EnsureDirectoryExists(ArtifactsDirectory);
CleanDirectories(_Path.Combine(RootDirectory, "src", "DotRush.*", "**", "bin"));
CleanDirectories(_Path.Combine(RootDirectory, "src", "DotRush.*", "**", "obj"));
CleanDirectories(VSCodeExtensionDirectory);
});
Task("server")
.Does(() => DotNetPublish(_Path.Combine(RootDirectory, "src", "DotRush.Roslyn.Server", "DotRush.Roslyn.Server.csproj"), new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(VSCodeExtensionDirectory, "bin", "LanguageServer"),
Configuration = configuration,
Runtime = runtime,
}))
.Does(() => {
var input = _Path.Combine(VSCodeExtensionDirectory, "bin", "LanguageServer");
var output = _Path.Combine(ArtifactsDirectory, $"DotRush.Roslyn.Server.v{version}_{runtime}.zip");
Zip(input, output);
});
Task("workspaces")
.Does(() => DotNetPublish(_Path.Combine(RootDirectory, "src", "DotRush.Essentials.Workspaces", "DotRush.Essentials.Workspaces.csproj"), new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(VSCodeExtensionDirectory, "bin", "Workspaces"),
Configuration = configuration,
Runtime = runtime,
}));
Task("explorer")
.Does(() => DotNetPublish(_Path.Combine(RootDirectory, "src", "DotRush.Essentials.TestExplorer", "DotRush.Essentials.TestExplorer.csproj"), new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(VSCodeExtensionDirectory, "bin", "TestExplorer"),
Configuration = configuration,
Runtime = runtime,
}));
Task("test")
.IsDependentOn("clean")
.Does(() => DotNetTest(_Path.Combine(RootDirectory, "src", "DotRush.Roslyn.Workspaces.Tests", "DotRush.Roslyn.Workspaces.Tests.csproj"),
new DotNetTestSettings {
Configuration = configuration,
Verbosity = DotNetVerbosity.Quiet,
ResultsDirectory = ArtifactsDirectory,
Loggers = new[] { "trx" }
}
// )).Does(() => DotNetTest(_Path.Combine(RootDirectory, "src", "DotRush.Roslyn.Navigation.Tests", "DotRush.Roslyn.Navigation.Tests.csproj"),
// new DotNetTestSettings {
// Configuration = configuration,
// Verbosity = DotNetVerbosity.Quiet,
// ResultsDirectory = ArtifactsDirectory,
// Loggers = new[] { "trx" }
// }
// )).Does(() => DotNetTest(_Path.Combine(RootDirectory, "src", "DotRush.Roslyn.CodeAnalysis.Tests", "DotRush.Roslyn.CodeAnalysis.Tests.csproj"),
// new DotNetTestSettings {
// Configuration = configuration,
// Verbosity = DotNetVerbosity.Quiet,
// ResultsDirectory = ArtifactsDirectory,
// Loggers = new[] { "trx" }
// }
));
Task("vsix")
.IsDependentOn("clean")
.IsDependentOn("server")
.IsDependentOn("workspaces")
.IsDependentOn("explorer")
.Does(() => {
var vsruntime = runtime.Replace("win-", "win32-").Replace("osx-", "darwin-");
var output = _Path.Combine(ArtifactsDirectory, $"DotRush.v{version}_{vsruntime}.vsix");
ExecuteCommand("npm", "install");
ExecuteCommand("vsce", $"package --target {vsruntime} --out {output} --no-git-tag-version {version}");
});
void ExecuteCommand(string command, string arguments) {
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
arguments = $"/c \"{command} {arguments}\"";
command = "cmd";
}
if (StartProcess(command, arguments) != 0)
throw new Exception("Command exited with non-zero exit code.");
}
RunTarget(target);