Files
ESP32S3_vt/scripts/build.ps1
T
sloray 896b21fe44
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s
feat(client): RMIC::2026 界面重做、可计算的版本机制与固件版本联动
- feat(client): 界面换成墨黑蓝底 + 单支红的矩形语言,切角全部去掉,仅装甲条保留平行四边形
- feat(client): 自托管 HarmonyOS Sans SC 与 JetBrains Mono,中文与拉丁数字逐字回退
- feat(client): 新增启动序列、首启门、用户端 HUD、裁判端控制台、设置抽屉与固件维护页
- feat(client): 裁判端中缝与下方控制台可拖,鼠标落在哪一路下方就看哪一路
- feat(client): 设置抽屉常驻实时预览,与画面共用同一份准星绘制代码
- feat(client): 动效改用 Material 3 的缓动曲线与时长,逐条替换掉自造的贝塞尔
- feat(version): 版本号与 CHANGELOG 由 scripts/version.mjs 从 git 历史算出,不再手写
- feat(firmware): Hello 报文携带语义化版本、构建号与自报协议号,负载向后兼容
- feat(client): 固件版本显示在绑定列表与裁判端每一格;协议不匹配时给出具体原因
- feat(firmware): 固件包版本与客户端同源,都从 version.json 读
- fix(client): getCurrentWindow() 在没有 Tauri 注入时同步抛异常,浏览器预览整棵树被卸载
- fix(client): 启动序列的淡出 effect 清掉了自己刚设的 setTimeout,界面永远停在启动页
- fix(client): 设置抽屉左侧导航的锚点没挂到 section 上,且用错了坐标系
- fix(protocol): Hello 改用宽松帧头解析,让协议不匹配的板子能被解释而不是静默消失
- fix(build): Windows 上 bindgen 加载不了 libclang 的同目录依赖,构建脚本补上搜索路径
- fix(build): esp-idf-sys 在长路径下拒绝构建,固件构建改用短的目标目录
- build(client): 队标图标,含光学尺寸分级与手工拼的多尺寸 ICO
- build(ci): 守门 job 增加版本一致性检查,产物名改为 rmic-2026-*
- docs: 补充界面语言、版本机制与协议通告布局的说明
2026-10-19 02:40:08 +08:00

88 lines
4.0 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Build the ESP32-S3 firmware from PowerShell without executing .env as code.
[CmdletBinding()]
param(
[string]$EnvFile = '.env',
[switch]$Package,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$CargoArgs = @()
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
Push-Location (Split-Path -Parent $PSScriptRoot)
$buildEnvironment = @{}
foreach ($name in @('CARGO_WORKSPACE_DIR', 'ESP_IDF_GLOB_BASE', 'ESP_IDF_GLOB_PARTITIONS')) {
$buildEnvironment[$name] = [Environment]::GetEnvironmentVariable($name, 'Process')
}
try {
if (Test-Path -LiteralPath $EnvFile) {
$lineNumber = 0
foreach ($line in Get-Content -LiteralPath $EnvFile -Encoding UTF8) {
$lineNumber++
if ($line -match '^\s*(#|$)') { continue }
if ($line -notmatch '^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$') {
throw "Invalid assignment in ${EnvFile}:${lineNumber}"
}
$key = $Matches[1]
$value = $Matches[2].Trim()
if ($value.StartsWith("'") -or $value.StartsWith('"')) {
$quote = $value.Substring(0, 1)
if ($value.Length -lt 2 -or -not $value.EndsWith($quote)) {
throw "Unclosed quote in ${EnvFile}:${lineNumber}"
}
$value = $value.Substring(1, $value.Length - 2)
} else {
$value = ($value -replace '\s+#.*$', '').TrimEnd()
}
[Environment]::SetEnvironmentVariable($key, $value, 'Process')
}
}
if ([string]::IsNullOrWhiteSpace($env:WIFI_SSID) -or $env:WIFI_SSID -eq 'your-ssid') {
throw 'Set WIFI_SSID in .env (copy .env.example) or the environment before building.'
}
if ($null -eq $env:WIFI_PASS) { $env:WIFI_PASS = '' }
# bindgen 要加载 esp-clang 自带的 libclang.dll,而它依赖**同目录**的 libLLVM-21.dll、
# libclang-cpp.dll 等。LoadLibraryEx 默认不会去 DLL 自己的目录找依赖,所以必须把这个
# 目录放进 PATH,否则报的是一句毫不相干的话:
# Unable to find libclang: "...\libclang.dll could not be opened: LoadLibraryExW failed"
# (`espup` 的 shell 会替你导出这些变量,直接跑脚本的人不会。)
$espClang = Join-Path $env:USERPROFILE '.rustup\toolchains\esp-1.97.0.0\xtensa-esp32-elf-clang\esp-clang\bin'
if (Test-Path -LiteralPath (Join-Path $espClang 'libclang.dll')) {
$env:LIBCLANG_PATH = $espClang
if (-not ($env:PATH -split ';' | Where-Object { $_ -eq $espClang })) {
$env:PATH = $espClang + ';' + $env:PATH
}
}
$env:CARGO_WORKSPACE_DIR = (Get-Location).Path
$env:ESP_IDF_GLOB_BASE = (Get-Location).Path
$env:ESP_IDF_GLOB_PARTITIONS = 'partitions.csv'
& cargo build --release --locked @CargoArgs
if ($LASTEXITCODE -ne 0) { throw "cargo build failed (exit $LASTEXITCODE)." }
if ($Package) {
$python = Get-Command python -ErrorAction SilentlyContinue
if ($null -eq $python) {
throw '-Package requires Python 3 on PATH (used by scripts/package_firmware.py).'
}
# 固件包的版本号与客户端同源:都读仓库根的 version.json(由 scripts/version.mjs
# 从 git 历史算出)。不传的话 make_bundle.py 会退回 BUILD-INFO.json 里的
# 变体名+提交号,那是另一套编号,装到客户端里会与界面上的版本对不上。
$versionArgs = @()
if (Test-Path -LiteralPath 'version.json') {
$info = Get-Content -LiteralPath 'version.json' -Raw | ConvertFrom-Json
$versionArgs = @('--version', "v$($info.version)+$($info.build)")
}
& python scripts/package_firmware.py --firmware target/firmware --name 'RMIC 图传固件' @versionArgs
if ($LASTEXITCODE -ne 0) { throw "package_firmware.py failed (exit $LASTEXITCODE)." }
}
} finally {
foreach ($name in $buildEnvironment.Keys) {
[Environment]::SetEnvironmentVariable($name, $buildEnvironment[$name], 'Process')
}
Pop-Location
}