Files
YuChuan/scripts/codegen.ps1
T
WT810787899 c8fc597e25 chore: 初始化仓库 —— 雨传 YuChuan(局域网聊天 / 传文件工具)
- 应用图标:由 icon.png 生成 Android 各密度 mipmap 与 Windows app_icon.ico,
  生成脚本 scripts/gen_icons.py 可重复执行(不引入额外 pub 依赖)
- README:重写为「功能 / 用途 / 截图」(原内容是无关的模板残留)
- .gitignore:排除构建产物(build/、target/)、本地备份、过程文档、
  图标设计源文件与历史截图
2026-10-15 20:31:50 +08:00

31 lines
1.3 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.
# 重新生成 flutter_rust_bridge 桥接代码(修改 rust_builder/src/api 后执行)
# 用法: .\scripts\codegen.ps1
# PS 5.1 下 native 命令写 stderr 会被 $ErrorActionPreference='Stop' 当成终止错误
# (flutter/cargo 都会写 stderr),改为 Continue + 逐条检查 $LASTEXITCODE。
$ErrorActionPreference = 'Continue'
$root = Split-Path $PSScriptRoot -Parent
Set-Location $root
# 环境:PATH / 镜像
$env:PATH = "C:\Users\81078\.cargo\bin;C:\flutter\bin;" + $env:PATH
$env:PUB_HOSTED_URL = 'https://pub.flutter-io.cn'
$env:FLUTTER_STORAGE_BASE_URL = 'https://storage.flutter-io.cn'
# 版本锁:flutter_rust_bridge 必须与 codegen 精确一致(PLAN 风险13)
$pubspec = Get-Content "$root\pubspec.yaml" -Raw
if ($pubspec -notmatch 'flutter_rust_bridge:\s*2\.8\.0') {
throw 'pubspec.yaml 中 flutter_rust_bridge 必须锁定 2.8.0'
}
$ver = & flutter_rust_bridge_codegen --version 2>&1 | Out-String
if ($ver -notmatch '2\.8\.0') {
throw "codegen 版本不是 2.8.0: $ver (cargo install flutter_rust_bridge_codegen --version 2.8.0 --locked)"
}
& flutter pub get
if ($LASTEXITCODE -ne 0) { throw 'flutter pub get failed' }
& flutter_rust_bridge_codegen generate --config-file flutter_rust_bridge.yaml
if ($LASTEXITCODE -ne 0) { throw 'codegen failed' }
Write-Host 'codegen OK'