-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.ps1
More file actions
48 lines (36 loc) · 1.04 KB
/
build.ps1
File metadata and controls
48 lines (36 loc) · 1.04 KB
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
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Builds CodeSearch.
.DESCRIPTION
Always runs `cargo build` (debug or release). Cargo's own incremental
compilation decides what actually needs to be recompiled — this script
no longer tries to second-guess it with git-diff heuristics.
Version bumping is handled by the pre-commit hook, NOT here.
.EXAMPLE
.\build.ps1
Builds in debug mode
.EXAMPLE
.\build.ps1 -Release
Builds in release mode
#>
param(
[switch]$Release
)
$ErrorActionPreference = "Stop"
# Change to script directory (where Cargo.toml is located)
$ScriptDir = $PSScriptRoot
Set-Location $ScriptDir
# Determine build mode
$BuildMode = if ($Release) { "release" } else { "debug" }
Write-Host "Building in $BuildMode mode..." -ForegroundColor Yellow
if ($Release) {
& cargo build --release
} else {
& cargo build
}
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
Write-Host "Build completed: target/$BuildMode/codesearch.exe" -ForegroundColor Green