fix(ci): remove Tauri resources for plugin files, simplify to path check

- Remove `resources` from tauri.linux.conf.json — the .so/.conf files
  don't exist on CI (plugin is built separately), causing cargo check
  to fail with "resource path doesn't exist"
- Simplify ensure_plugin_installed to just check system paths exist,
  no bundled comparison needed
- Remove prebuild script and copy-plugin.mjs (no longer needed)
- Remove plugin entries from .gitignore

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
aeoformandClaude Opus 4.7 committed 2026-05-28 23:16:53 +08:00
1 parent d426b9e7b8
commit 2bd733ecb3
5 files changed
+10 -79

No files matched your search

-2
View File
@@ -9,5 +9,3 @@ dist/
# Tauri
src-tauri/target/
src-tauri/gen/
src-tauri/linux-fcitx5-plugin/libopenless.so
src-tauri/linux-fcitx5-plugin/openless.conf
-1
View File
@@ -6,7 +6,6 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"prebuild": "node scripts/copy-plugin.mjs",
"preview": "vite preview",
"tauri": "tauri",
"check:hotkey-injection": "node scripts/check-hotkey-injection.mjs"
-27
View File
@@ -1,27 +0,0 @@
import { copyFileSync, mkdirSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { platform } from 'os';
// Only relevant on Linux — skip silently on other platforms
if (platform() !== 'linux') {
process.exit(0);
}
const __dirname = dirname(fileURLToPath(import.meta.url));
const srcDir = join(__dirname, '..', 'scripts', 'linux-fcitx5-plugin', 'build_release');
const destDir = join(__dirname, 'src-tauri', 'linux-fcitx5-plugin');
const files = ['libopenless.so', 'openless.conf'];
for (const f of files) {
const src = join(srcDir, f);
const dest = join(destDir, f);
try {
mkdirSync(destDir, { recursive: true });
copyFileSync(src, dest);
console.log(`[copy:linux-plugin] copied ${f}`);
} catch {
console.log(`[copy:linux-plugin] ${f} not found — skipping`);
}
}
+10 -45
View File
@@ -404,57 +404,22 @@ pub fn start_dictation_signal_listener(
.ok();
}
/// 检查 fcitx5 插件是否已安装到系统路径,与 bundled 版本比对。
/// 检查 fcitx5 插件是否已安装到系统路径。
///
/// 所有 Linux 格式(deb/rpm/AppImage)的插件安装都在打包时完成
///(`scripts/inject-fcitx5-plugin.sh`),此处仅做版本检查。
/// 不做任何文件 I/O 写入——版本不匹配或未安装时仅输出警告。
///(`scripts/inject-fcitx5-plugin.sh`),此处仅确认文件存在。
/// 未安装时输出警告,不做任何文件 I/O。
#[cfg(target_os = "linux")]
pub fn ensure_plugin_installed(app: &tauri::AppHandle) {
use tauri::Manager;
let resource_dir = match app.path().resource_dir() {
Ok(d) => d,
Err(e) => {
log::warn!("[fcitx] Cannot resolve resource dir: {e}");
return;
}
};
let bundled_so = resource_dir.join("linux-fcitx5-plugin").join("libopenless.so");
if !bundled_so.exists() {
// 非打包环境(dev build),跳过检查
return;
}
let bundled_size = match bundled_so.metadata() {
Ok(m) => m.len(),
Err(_) => return,
};
// fcitx5 标准系统路径(打包时由 inject-fcitx5-plugin.sh 注入)
pub fn ensure_plugin_installed(_app: &tauri::AppHandle) {
let system_so = std::path::Path::new("/usr/lib/x86_64-linux-gnu/fcitx5/libopenless.so");
let system_conf = std::path::Path::new("/usr/share/fcitx5/addon/openless.conf");
match (system_so.exists(), system_conf.exists()) {
(true, true) => {
if let Ok(m) = system_so.metadata() {
if m.len() != bundled_size {
log::warn!(
"[fcitx] Plugin version mismatch: system={}, bundled={}. Reinstall OpenLess to update.",
m.len(),
bundled_size
);
}
}
}
(false, _) | (_, false) => {
log::warn!(
"[fcitx] fcitx5 plugin not installed at system paths ({:?}, {:?}). \
The OpenLess package may be incomplete.",
system_so, system_conf
);
}
if !system_so.exists() || !system_conf.exists() {
log::warn!(
"[fcitx] fcitx5 plugin not installed at system paths ({:?}, {:?}). \
The OpenLess package may be incomplete.",
system_so, system_conf
);
}
}
@@ -53,10 +53,6 @@
]
},
"bundle": {
"resources": [
"linux-fcitx5-plugin/libopenless.so",
"linux-fcitx5-plugin/openless.conf"
],
"linux": {
"deb": {
"depends": [