|
4 | 4 | const KEYS: &[&str] = &["GDRIVE_BUILTIN_CLIENT_ID", "GDRIVE_BUILTIN_CLIENT_SECRET"]; |
5 | 5 |
|
6 | 6 | fn main() { |
| 7 | + println!("cargo:rerun-if-changed=../../../package.json"); |
| 8 | + println!("cargo:rerun-if-changed=../../../packages/icon"); |
| 9 | + println!("cargo:rerun-if-changed=native/sync-icons.cjs"); |
| 10 | + let platform = std::env::var("CARGO_CFG_TARGET_OS").expect("missing target platform"); |
| 11 | + println!("cargo:rerun-if-changed=native/{platform}/sync-icons.cjs"); |
| 12 | + // Direct cargo builds also generate the target platform's resources. |
| 13 | + let status = std::process::Command::new("node") |
| 14 | + .args(["native/sync-icons.cjs", &platform]) |
| 15 | + .status() |
| 16 | + .expect("failed to generate native icons; install Node.js and pnpm dependencies first"); |
| 17 | + assert!(status.success(), "native icon generation failed"); |
| 18 | + println!("cargo:rerun-if-changed=native/{platform}/icons"); |
7 | 19 | // macOS:screencapturekit → swift-rs 会把 @rpath/libswiftCore.dylib 等系统 Swift 运行库 |
8 | 20 | // 链进最终二进制,但 rustc 不会像 Xcode 那样自动补 LC_RPATH,缺少 rpath 时应用会在 |
9 | 21 | // 启动阶段被 dyld abort("Library not loaded: @rpath/libswiftCore.dylib, no LC_RPATH's found")。 |
10 | 22 | // /usr/lib/swift 是系统自带 Swift 运行时(dyld shared cache)的解析路径,随系统存在; |
11 | 23 | // @executable_path/../Frameworks 兜底,以便日后向 .app/Contents/Frameworks 内嵌库时无需改动。 |
12 | 24 | if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") { |
13 | | - // Tauri 的开发版会把 icns 缓存后嵌入二进制,显式跟踪源文件以免继续使用旧图标。 |
14 | | - println!("cargo:rerun-if-changed=icons/icon.icns"); |
15 | 25 | println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift"); |
16 | 26 | println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks"); |
17 | 27 | } |
|
0 commit comments