-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.ps1
More file actions
39 lines (31 loc) · 748 Bytes
/
Copy pathbuild.ps1
File metadata and controls
39 lines (31 loc) · 748 Bytes
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
#!/bin/env pwsh -f
param(
[switch]$release
)
$ErrorActionPreference = "stop"
function starts-with-space($s) {
$s.length -eq 0 -or
[char]::IsWhitespace($s.chars(0))
}
function build-project($cfg = "debug", $out) {
$output = dotnet publish `
--nologo `
--configuration $cfg `
--output $out 2>&1
while(starts-with-space $output[0]) {
$output = $output[1..($output.length)]
}
$output | % {
$_.replace("$PSScriptRoot\", "")
}
}
$out = "$PSScriptRoot/bin/Dotenv"
if(test-path -pathType container $out) {
remove-item -recurse $out
}
$cfg = if($release) { "release" } else { "debug" }
build-project $cfg $out
if($lastexitcode -eq 0) {
copy-item -recurse -force "$PSScriptRoot/module/*" $out
echo "built the module into $out"
}