feat(platform): 三端支持 —— Windows / Linux 已出包,macOS 走 Actions
老板要求:开发 macOS 和 Linux 版。
一、代码跨平台化(原来只能编 Windows)
· Cargo.toml:clipboard-win / windows-sys 挪到 [target.'cfg(windows)'.dependencies];
非 Windows 加 arboard(macOS 走 NSPasteboard,Linux 走 X11/Wayland)
· main.rs:
- windows_subsystem 属性加目标平台判断(mac/Linux 没这个概念)
- 剪贴板三个命令按平台分文件级实现
- 「复制文件本身」在 mac/Linux 退化为复制路径文本(这两个平台剪贴板没有
通用的文件格式,要写 NSPasteboard / GTK 私有 target,代价不值)
- reveal_in_explorer:explorer / open -R / xdg-open
- open_external:explorer / open / xdg-open
· 修了重构时误删的 message_box 命令(构建时才暴露,已核对 19 个命令齐全)
二、打包配置
· tauri icon 生成三端图标集(.ico / .icns / 多尺寸 png)
· bundle.targets = "all":win→nsis,mac→app+dmg,linux→deb+rpm+appimage
· macOS minimumSystemVersion 10.15;linux.deb 依赖声明
三、发布链路升级成多平台
· publish.py 重写:自动扫描 target 下**存在的**产物,按平台归位,
清单**合并**写入(在 Windows 发版不会冲掉 mac 的条目)
· 官网页新增 macOS / Linux 下载卡,按 latest.json 里有没有该平台决定显隐,
避免指向不存在的文件
四、实测(Linux 版)
· 本机装 webkit2gtk-4.1 等依赖后原生构建成功
· deb 2.79MB、AppImage 103.62MB(AppImage 自带 webkit 运行时所以大)
· 已发布:latest.json 现在有 windows-x86_64 + linux-x86_64 两个平台
· 官网 Linux 卡已显示,macOS 卡等有产物再自动出现
五、macOS
· .github/workflows/build.yml:macos-latest(arm64 + intel)/ ubuntu / windows 矩阵出包
· 需要仓库 Secrets 配升级签名私钥(和可选的苹果开发者证书)
This commit is contained in:
1 parent
6aa1689574
commit
db654100f3
61 files changed
+633
-109
No files matched your search
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
</adaptive-icon>
|
||||
Reference in new issue
Block a user