-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.ps1
More file actions
67 lines (60 loc) · 1.88 KB
/
Copy pathdev.ps1
File metadata and controls
67 lines (60 loc) · 1.88 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
param(
[Parameter(Position = 0)]
[ValidateSet("help", "build", "test", "fmt", "vet", "clean", "run")]
[string]$Task = "help",
[string]$Manifest,
[string]$Out
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
function Invoke-Cargo {
param(
[Parameter(Mandatory = $true)]
[string[]]$Arguments
)
& cargo @Arguments
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
$taskAliases = @{
build = "ox-build"
test = "ox-test"
fmt = "ox-fmt"
vet = "ox-vet"
clean = "ox-clean"
}
if ($Task -eq "help") {
Write-Host "Canonical tasks live in .cargo/config.toml and run everywhere via cargo aliases:"
Write-Host " cargo ox-build"
Write-Host " cargo ox-test"
Write-Host " cargo ox-fmt"
Write-Host " cargo ox-vet"
Write-Host " cargo ox-clean"
Write-Host " cargo ox-run --manifest fixtures/minimal.manifest.json"
Write-Host ""
Write-Host "PowerShell convenience wrapper:"
Write-Host " ./scripts/dev.ps1 build"
Write-Host " ./scripts/dev.ps1 test"
Write-Host " ./scripts/dev.ps1 fmt"
Write-Host " ./scripts/dev.ps1 vet"
Write-Host " ./scripts/dev.ps1 clean"
Write-Host " ./scripts/dev.ps1 run -Manifest fixtures/minimal.manifest.json"
Write-Host " ./scripts/dev.ps1 run -Manifest fixtures/api.manifest.json -Out delta.json"
Write-Host ""
Write-Host "If execution policy blocks direct script invocation, use:"
Write-Host " powershell -ExecutionPolicy Bypass -File .\\scripts\\dev.ps1 help"
}
elseif ($Task -eq "run") {
if ([string]::IsNullOrWhiteSpace($Manifest)) {
throw "run requires -Manifest <path>"
}
$arguments = @("ox-run", "--manifest", $Manifest)
if (-not [string]::IsNullOrWhiteSpace($Out)) {
$arguments += @("--out", $Out)
}
Invoke-Cargo $arguments
}
else {
Invoke-Cargo @($taskAliases[$Task])
}