-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
68 lines (52 loc) · 1.41 KB
/
build.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Param(
[Parameter(Position=0)]
[string]
$mode = "debug",
[Parameter(Position=1)]
[string]
$version = "0.0.1"
)
$ErrorActionPreference = "Stop";
if($mode -eq "release")
{
dotnet test -c Release /p:TreatWarningsAsErrors=true
$compileCode = $LASTEXITCODE;
if ($compileCode -ne 0)
{
exit $compileCode;
}
# Release mode, build single file.
# /p:PublishSingleFile=true
dotnet publish ./src/AutoStep.LanguageServer/ -r win-x64 -o .\artifacts\server\win-x64 -c Release /p:PublishSingleFile=true
dotnet publish ./src/AutoStep.LanguageServer/ -r linux-x64 -o .\artifacts\server\linux-x64 -c Release /p:PublishSingleFile=true
}
else
{
dotnet publish ./src/AutoStep.LanguageServer/ -r win-x64 -o .\artifacts\server\win-x64 -c Debug
dotnet publish ./src/AutoStep.LanguageServer/ -r linux-x64 -o .\artifacts\server\linux-x64 -c Debug
}
if (Test-Path src/Extension/server)
{
Remove-Item ./src/Extension/server -Recurse -Force
}
Copy-Item ./artifacts/server ./src/Extension/server -Recurse
# Do the NPM compile.
Push-Location ./src/Extension
npm install -g vsce
npm install
npm run compile
$compileCode = $LASTEXITCODE;
if ($compileCode -ne 0)
{
exit $compileCode;
}
if ($mode -eq "release")
{
# Package
vsce package -o "autostep-$version.vsix"
}
Pop-Location
if($mode -eq "release")
{
Move-Item ./src/Extension/autostep*.vsix ./artifacts -Force
}