-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.cake
104 lines (95 loc) · 4.87 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
using System.Runtime.InteropServices;
using _Path = System.IO.Path;
public string RootDirectory => MakeAbsolute(Directory("./")).ToString();
public string ArtifactsDirectory => _Path.Combine(RootDirectory, "artifacts");
public string ExtensionStagingDirectory => _Path.Combine(RootDirectory, "extension");
public string MeteorWorkspaceProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.Workspace", "DotNet.Meteor.Workspace.csproj");
public string MeteorXamlProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.Xaml", "DotNet.Meteor.Xaml.LanguageServer", "DotNet.Meteor.Xaml.LanguageServer.csproj");
public string MeteorHotReloadProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.HotReload", "DotNet.Meteor.HotReload.csproj");
public string MeteorDebugProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.Debug", "DotNet.Meteor.Debug.csproj");
public string MeteorTestsProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.Tests", "DotNet.Meteor.Tests.csproj");
public string MeteorPluginProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Meteor.HotReload.Plugin", "DotNet.Meteor.HotReload.Plugin.csproj");
public string DotNetDSRouterProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Diagnostics", "src", "Tools", "dotnet-dsrouter", "dotnet-dsrouter.csproj");
public string DotNetGCDumpProjectPath => _Path.Combine(RootDirectory, "src", "DotNet.Diagnostics", "src", "Tools", "dotnet-gcdump", "dotnet-gcdump.csproj");
var target = Argument("target", "vsix");
var version = Argument("release-version", "1.0.0");
var configuration = Argument("configuration", "debug");
var runtime = Argument("arch", RuntimeInformation.RuntimeIdentifier);
Task("clean").Does(() => {
EnsureDirectoryExists(ArtifactsDirectory);
CleanDirectory(ExtensionStagingDirectory);
CleanDirectories(_Path.Combine(RootDirectory, "src", "**", "bin"));
CleanDirectories(_Path.Combine(RootDirectory, "src", "**", "obj"));
});
Task("workspace").Does(() => DotNetPublish(MeteorWorkspaceProjectPath, new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(ExtensionStagingDirectory, "bin", "Workspace"),
Configuration = configuration,
Runtime = runtime,
}));
Task("xaml").Does(() => DotNetPublish(MeteorXamlProjectPath, new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(ExtensionStagingDirectory, "bin", "Xaml"),
Configuration = configuration,
Runtime = runtime,
}));
Task("hotreload").Does(() => DotNetPublish(MeteorHotReloadProjectPath, new DotNetPublishSettings {
MSBuildSettings = new DotNetMSBuildSettings { AssemblyVersion = version },
OutputDirectory = _Path.Combine(ExtensionStagingDirectory, "bin", "HotReload"),
Configuration = configuration,
Runtime = runtime,
}));
Task("debugger").Does(() => DotNetPublish(MeteorDebugProjectPath, new DotNetPublishSettings {
Runtime = runtime,
Configuration = configuration,
MSBuildSettings = new DotNetMSBuildSettings {
ArgumentCustomization = args => args.Append("/p:NuGetVersionRoslyn=4.5.0"),
AssemblyVersion = version
},
}));
Task("dsrouter").Does(() => DotNetPublish(DotNetDSRouterProjectPath, new DotNetPublishSettings {
OutputDirectory = _Path.Combine(ExtensionStagingDirectory, "bin", "Debug"),
Configuration = configuration,
Runtime = runtime,
}));
Task("gcdump").Does(() => DotNetPublish(DotNetGCDumpProjectPath, new DotNetPublishSettings {
OutputDirectory = _Path.Combine(ExtensionStagingDirectory, "bin", "Debug"),
Configuration = configuration,
Runtime = runtime,
}));
Task("plugin").Does(() => DotNetPack(MeteorPluginProjectPath, new DotNetPackSettings {
Configuration = configuration,
MSBuildSettings = new DotNetMSBuildSettings {
AssemblyVersion = version,
Version = version
},
}));
Task("test").Does(() => DotNetTest(MeteorTestsProjectPath, new DotNetTestSettings {
Configuration = configuration,
Verbosity = DotNetVerbosity.Quiet,
ResultsDirectory = ArtifactsDirectory,
Loggers = new[] { "trx" }
}));
Task("vsix")
.IsDependentOn("clean")
.IsDependentOn("workspace")
.IsDependentOn("xaml")
.IsDependentOn("hotreload")
.IsDependentOn("debugger")
.IsDependentOn("dsrouter")
.IsDependentOn("gcdump")
.Does(() => {
var vsruntime = runtime.Replace("win-", "win32-").Replace("osx-", "darwin-");
var output = _Path.Combine(ArtifactsDirectory, $"DotNet.Meteor.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);