windows: Add update-workspace-hack.ps1 script (#28219)

Release Notes:

- N/A
This commit is contained in:
张小白 authored and GitHub committed 2025-04-07 21:26:26 +08:00
1 parent 53fdf076e7
commit 0748ff0cb8
2 files changed
+38 -2

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
$ErrorActionPreference = "Stop"
$HAKARI_VERSION = "0.9"
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location (Split-Path -Parent $scriptPath)
$hakariInstalled = $false
try {
$versionOutput = cargo hakari --version 2>&1
if ($versionOutput -match "cargo-hakari $HAKARI_VERSION") {
$hakariInstalled = $true
}
}
catch {
$hakariInstalled = $false
}
if (-not $hakariInstalled) {
Write-Host "Installing cargo-hakari@^$HAKARI_VERSION..."
cargo install "cargo-hakari@^$HAKARI_VERSION"
if ($LASTEXITCODE -ne 0) {
throw "Failed to install cargo-hakari@^$HAKARI_VERSION"
}
}
else {
Write-Host "cargo-hakari@^$HAKARI_VERSION is already installed."
}
# update the workspace-hack crate
cargo hakari generate
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# make sure workspace-hack is added as a dep for all crates in the workspace
cargo hakari manage-deps
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }