Guide · 06 CLI & Manifest
命令行工具与工程配置 (CLI & gpux.json)
详解 gpux-cli 全生命周期子命令、7 端交叉编译参数与 gpux.json 声明式工程清单(gpux_core::AppManifest)。
`gpux-cli` 命令速查表
| 命令 | 参数选项与别名 | 说明 |
|---|---|---|
gpux init <name> | 别名 create,-p, --path <dir> | 生成包含 gpux.json、Cargo.toml、共享视图 src/lib.rs 及 iOS / Android / HarmonyOS / Web 宿主工程的 7 端脚手架。 |
gpux dev | -t, --target <platform> | 启动开发与热重载宿主(支持 desktop | macos | linux | windows | ios | android | harmonyos | ohos | web)。 |
gpux build | -t, --target <platform> --release | 编译并打包 7 端生产产物(.dmg、.msi、.AppImage、.ipa、.apk、.hap 与 .wasm)。 |
gpux doctor | 别名 info | 自检 Rust、Cargo、Xcode、Android NDK、HarmonyOS SDK 与 wasm32-unknown-unknown 工具链就绪状态。 |
gpux plugin | add <name> | remove <name> | list | 管理官方与第三方原生系统插件(如 clipboard、notification、biometric、sqlite、ble)。 |
gpux permission | list | add <cap> | 查看与授予细粒度 ACL 能力权限(如 clipboard:read-text、notification:default)并同步至 gpux.json。 |
gpux icon | [source](默认 assets/icon.svg) | 从单张 1024×1024 SVG/PNG 源文件自动生成全平台图标集(.icns、.ico、AppIcon、AdaptiveIcon)。 |
gpux migrate | 无 | 升级旧版 gpux.json 清单结构并检查 Workspace 依赖兼容性。 |
`gpux.json` 完整配置示例 (`AppManifest`)
gpux.json 对应 gpux_core::AppManifest 结构体,可在编译期校验或在运行时通过 serde_json 反序列化:
json
{
"name": "cluster-monitor",
"identifier": "com.gpux.clustermonitor",
"version": "0.1.0",
"window": {
"title": "Cluster Telemetry Monitor",
"width": 1200.0,
"height": 780.0,
"resizable": true,
"decorations": true,
"transparent": false
},
"targets": [
"MacOs",
"Linux",
"Windows",
"Ios",
"Android",
"HarmonyOs",
"Web"
]
}