diff options
| author | pml68 <contact@pml68.dev> | 2025-03-03 23:49:03 +0100 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-03-03 23:49:03 +0100 |
| commit | 0b8e2d4570cecf3bae2273b9882f48815acffa6c (patch) | |
| tree | feddc88df4246b278a0da6584933b58fa2deceee | |
| parent | feat: impl `Value` for `Pixels` and `Alignment` (diff) | |
| download | iced-builder-0b8e2d4570cecf3bae2273b9882f48815acffa6c.tar.gz | |
fix: build.rs not running on git changes
| -rw-r--r-- | build.rs | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -1,3 +1,7 @@ +// (c) 2023 Cory Forsstrom +// (c) 2024-2025 Polesznyák Márk László + +use std::path::Path; use std::process::Command; fn main() { @@ -12,6 +16,39 @@ fn main() { println!("cargo:rustc-env=GIT_HASH={}", hash); } + if git_hash.is_none() { + return; + } + + let Some(git_dir): Option<String> = Command::new("git") + .args(["rev-parse", "--git-dir"]) + .output() + .ok() + .filter(|output| output.status.success()) + .and_then(|x| String::from_utf8(x.stdout).ok()) + else { + return; + }; + + let head = Path::new(&git_dir).join("HEAD"); + if head.exists() { + println!("cargo:rerun-if-changed={}", head.display()); + } + + let Some(head_ref): Option<String> = Command::new("git") + .args(["symbolic-ref", "HEAD"]) + .output() + .ok() + .filter(|output| output.status.success()) + .and_then(|x| String::from_utf8(x.stdout).ok()) + else { + return; + }; + let head_ref = Path::new(&git_dir).join(head_ref); + if head_ref.exists() { + println!("cargo:rerun-if-changed={}", head_ref.display()); + } + println!("cargo::rerun-if-changed=fonts/icons.toml"); iced_fontello::build("fonts/icons.toml").expect("Build icons font"); #[cfg(windows)] |
