-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish-server.ps1
46 lines (42 loc) · 1.05 KB
/
publish-server.ps1
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
param(
[switch]$Debug = $false
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$package = Get-Content "package.json" | ConvertFrom-Json
$version = $package.version
$archs = @("win", "linux", "osx")
$dotnetArgs = @(
"--nologo",
"--verbosity", "quiet",
"--self-contained",
"-p:PublishSingleFile=true",
"-p:Version=$version"
)
if ($Debug) {
$dotnetArgs += @("--configuration", "Debug")
}
else {
$dotnetArgs += @(
"--configuration", "Release",
"-p:PublishTrimmed=true"
)
}
Push-Location "server"
foreach ($os in $archs) {
if ($os -eq "win") {
Remove-Item -Path "bin/loretta-lsp-win.exe" -ErrorAction SilentlyContinue
}
else {
Remove-Item -Path "bin/loretta-lsp-$os" -ErrorAction SilentlyContinue
}
dotnet publish @dotnetArgs --runtime "$os-x64" --output "bin/$os"
if ($os -eq "win") {
Copy-Item -Path "bin/$os/Loretta.LanguageServer.exe" -Destination "bin/loretta-lsp-win.exe"
}
else {
Copy-Item -Path "bin/$os/Loretta.LanguageServer" -Destination "bin/loretta-lsp-$os"
}
Remove-Item -Path "bin/$os" -Recurse
}
Pop-Location