build script update
This commit is contained in:
13
build.ps1
13
build.ps1
@@ -25,8 +25,14 @@ if (-not $Extension -and -not $Standalone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$distDir = Join-Path $repoRoot "dist"
|
$distDir = Join-Path $repoRoot "dist"
|
||||||
|
if (Test-Path $distDir) {
|
||||||
|
Remove-Item -Path (Join-Path $distDir "*") -Recurse -Force
|
||||||
|
}
|
||||||
New-Item -ItemType Directory -Path $distDir -Force | Out-Null
|
New-Item -ItemType Directory -Path $distDir -Force | Out-Null
|
||||||
|
|
||||||
|
$pkg = Get-Content (Join-Path $repoRoot "package.json") -Raw | ConvertFrom-Json
|
||||||
|
$version = $pkg.version
|
||||||
|
|
||||||
function Write-Step($msg) {
|
function Write-Step($msg) {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "==> $msg" -ForegroundColor Cyan
|
Write-Host "==> $msg" -ForegroundColor Cyan
|
||||||
@@ -104,13 +110,14 @@ if ($Standalone) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$exeOut = Join-Path $distDir "hpl-toolbox.exe"
|
$exeName = "hpl-toolbox-$version.exe"
|
||||||
|
$exeOut = Join-Path $distDir $exeName
|
||||||
go build -ldflags="-s -w -H windowsgui" -trimpath -o $exeOut .
|
go build -ldflags="-s -w -H windowsgui" -trimpath -o $exeOut .
|
||||||
if ($LASTEXITCODE -ne 0) { Write-Error "go build failed"; exit 1 }
|
if ($LASTEXITCODE -ne 0) { Write-Error "go build failed"; exit 1 }
|
||||||
|
|
||||||
$summary += [pscustomobject]@{
|
$summary += [pscustomobject]@{
|
||||||
Artifact = "hpl-toolbox.exe"
|
Artifact = $exeName
|
||||||
Path = "dist\hpl-toolbox.exe"
|
Path = "dist\$exeName"
|
||||||
Size = Get-FileSize $exeOut
|
Size = Get-FileSize $exeOut
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user