blob: 43e39d8fbffb051c90f3f540b8be7678f232ea97 (
plain) (
blame)
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
|
Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Path) -ErrorAction Stop
if ($args.Count -eq 0) {
Write-Host "Available:"
if (Test-Path "dev_tools/src/bin") {
$files = Get-ChildItem -Path "dev_tools/src/bin/*.rs"
foreach ($file in $files) {
if ($file -is [System.IO.FileInfo]) {
Write-Host $file.BaseName
}
}
} else {
Write-Host "Warning: dev_tools/src/bin directory does not exist"
}
if (Test-Path "dev_tools/scripts") {
$scripts = Get-ChildItem -Path "dev_tools/scripts/*.ps1"
foreach ($script in $scripts) {
if ($script -is [System.IO.FileInfo]) {
Write-Host $script.BaseName
}
}
} else {
Write-Host "Warning: dev_tools/scripts directory does not exist"
}
exit 1
}
$target_name = $args[0]
$script_file = "dev_tools/scripts/${target_name}.ps1"
$rust_file = "dev_tools/src/bin/${target_name}.rs"
if (Test-Path $script_file) {
& $script_file
} elseif (Test-Path $rust_file) {
cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name
} else {
Write-Host "Error: target '$target_name' does not exist as a script or Rust program"
exit 1
}
|