diff options
| author | Polesznyák Márk László <116908301+pml68@users.noreply.github.com> | 2025-03-23 02:49:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-23 02:49:57 +0100 |
| commit | 3076889c00116b22f022792471253e7188c6e93e (patch) | |
| tree | bff0cda7a9152e9f94d3176bbf5acaf879394f5f /build.rs | |
| parent | feat: update to Rust 2024 (diff) | |
| parent | feat: finish `ApplyOptions` impls (diff) | |
| download | iced-builder-3076889c00116b22f022792471253e7188c6e93e.tar.gz | |
Merge pull request #7 from pml68/feat/options-backend
Options backend done (for now)
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -1,4 +1,54 @@ +// (c) 2023 Cory Forsstrom +// (c) 2024-2025 Polesznyák Márk László + +use std::path::Path; +use std::process::Command; + fn main() { + let git_hash = Command::new("git") + .args(["describe", "--always", "--dirty", "--exclude='*'"]) + .output() + .ok() + .filter(|output| output.status.success()) + .and_then(|x| String::from_utf8(x.stdout).ok()); + + if let Some(hash) = git_hash.as_ref() { + 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)] |
