一个二进制两种用法:两个 GUI 的 main.rs 在进 UI 之前分发子命令,命中就把控制权交给 unlucky_cli::run —— 不建窗口、不探后端、不扫字体、不 dlopen 图形库。 分发判据只有一条,子命令表不重复:crates/cli 的解析器是唯一真相源。 - 首个 token 是裸词 → 子命令位置,交 CLI(未知子命令由 CLI 报错 + 提示 --help,退出 1, 不静默开窗) - 首个 token 是 flag → 只有 CLI 解析出真命令才算 CLI 调用;--data-dir X 解析成 Welcome、 --screenshot / --renderer / --diff 等 GUI 参数解析失败,一律仍走 GUI(CI 脚本零改动) 顺带:unlucky-launcher --version 以前会直接开窗,现在走 CLI 分发报版本。 packaging:ull 作为独立裸资产随每个槽位发布(make_artifacts.py + release.yml 的 assets 数组与 SHA256SUMS glob),矩阵完整性检查改成 GUI/CLI 各查一次。 app-iced 的 x11 / wayland / linux-theme-detection 收进 target 专属的 cfg(target_os) 段。 门禁实跑:cargo fmt --all --check 通过;cargo clippy --workspace --all-targets -D warnings 通过(exit 0);cargo test --workspace 通过(51 个测试二进制 / 1369 个用例,含本次新增的 5 + 5 条分发判据用例)。
69 lines
3.1 KiB
TOML
69 lines
3.1 KiB
TOML
[package]
|
||
name = "unlucky-app-iced"
|
||
description = "Unlucky-Launcher 桌面壳(iced 0.14 重写版):M3 Expressive 骨架 / 令牌适配 / 截图通道"
|
||
version.workspace = true
|
||
edition.workspace = true
|
||
license.workspace = true
|
||
authors.workspace = true
|
||
repository.workspace = true
|
||
rust-version.workspace = true
|
||
publish.workspace = true
|
||
|
||
# 并存期(D26):Slint 版仍是 `crates/app` 的 `unlucky-launcher`,本 crate 出
|
||
# `unlucky-launcher-iced`。两个 package 在同一 target 目录产出同名 bin 会冲突,
|
||
# 所以**翻牌前不许改回 `unlucky-launcher`**(步骤见 SubAgentsTalk/app-iced-骨架与翻牌.md)。
|
||
[[bin]]
|
||
name = "unlucky-launcher-iced"
|
||
path = "src/main.rs"
|
||
|
||
[lib]
|
||
name = "unlucky_app_iced"
|
||
path = "src/lib.rs"
|
||
|
||
[dependencies]
|
||
# 令牌唯一真源(M61):颜色/排版/形状/间距/图标几何全部只从这里取。
|
||
unlucky-design = { path = "../design", version = "0.1" }
|
||
|
||
# UI 框架(D26 锁定 iced 0.14)。**不得依赖 slint**。
|
||
# 关掉默认 features 后必须显式给执行器(M60 踩坑 Q2:否则 `No futures executor has been enabled`),
|
||
# 这里给 `thread-pool`(iced 自己的默认执行器,不额外引 tokio 运行时)。
|
||
# `wgpu` 由本 crate 的 `gpu` feature 打开,于是「仅 CPU」体积基线用 `--no-default-features` 就能量到。
|
||
iced = { version = "=0.14.0", default-features = false, features = [
|
||
"tiny-skia",
|
||
"crisp",
|
||
"advanced",
|
||
"svg",
|
||
"thread-pool",
|
||
] }
|
||
|
||
# 截图落 PNG。只开 png 编码器,不要默认全套 codec(体积)。
|
||
image = { version = "0.25", default-features = false, features = ["png"] }
|
||
|
||
# M82:同一个二进制也带 CLI 子命令(`unlucky-launcher-iced instances list` …),
|
||
# 进 UI 之前分发,命中就把控制权交给 `unlucky_cli::run`。依赖方向 app-iced → cli →
|
||
# core/agent 不违反 core 零 UI 铁律(core 的依赖树里没有 cli)。零 UI 依赖的 `ull`
|
||
# 仍在 `crates/cli`,给没有图形库的机器用——两者不是重复品。
|
||
unlucky-cli = { path = "../cli", version = "0.1" }
|
||
|
||
# X11 / Wayland 后端与 Linux 主题检测只在 Linux 上启用:macOS 没有 X11/Wayland(走 Metal +
|
||
# 系统外观),Windows 走 DX12,这三个 feature 在那边没有意义。同一个包在两处写 features 是
|
||
# **取并集**(Cargo 的 feature 解析是加法),所以 Linux 上拿到的仍是上面 5 个 + 这 3 个,
|
||
# Windows / macOS 只拿上面那 5 个(`cargo tree --target` 可复核)。
|
||
# 诚实边界:这**不**解决「iced 版至今没在 macOS 上编过」这件事——`iced_winit` 已把 `mundy`
|
||
# 放在 `cfg(target_os = "linux")` 段里,这三个 feature 在非 Linux 上本来就不拉依赖,这里只是
|
||
# 让本仓库的依赖图按平台自述清楚,不再把 Linux 专属能力写成全平台事实。
|
||
[target.'cfg(target_os = "linux")'.dependencies]
|
||
iced = { version = "=0.14.0", default-features = false, features = [
|
||
"x11",
|
||
"wayland",
|
||
"linux-theme-detection",
|
||
] }
|
||
|
||
[features]
|
||
default = ["gpu"]
|
||
# 硬件渲染后端(wgpu→Vulkan/DX12)。关闭后只剩 tiny-skia(CPU),用于体积基线与无 GPU 机器。
|
||
gpu = ["iced/wgpu"]
|
||
|
||
[lints]
|
||
workspace = true
|