taler-rust

GNU Taler code in Rust. Largely core banking integrations.
Log | Files | Refs | Submodules | README | LICENSE

commit e1d72e62dddcdd7455228d32833bb54564ac7c4b
parent 0f60fa4e8cb6a7e644a7c765b1789c735633d45a
Author: Antoine A <>
Date:   Fri,  9 Jan 2026 11:30:22 +0100

common: fix taler-build build.rs always running

Diffstat:
Mcommon/taler-build/build.rs | 22+++++++++++++++++-----
Mcommon/taler-test-utils/src/db.rs | 3+--
2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/common/taler-build/build.rs b/common/taler-build/build.rs @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2025 Taler Systems SA + Copyright (C) 2025, 2026 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -35,10 +35,19 @@ fn run_command(command: &str, args: &[&str]) -> Result<String, String> { } fn main() -> Result<(), String> { - // Tell Cargo to re-run the build script if the commit hash changes - // This covers both detached HEAD state and changes to local branch references - println!("cargo:rerun-if-changed=.git/HEAD"); - println!("cargo:rerun-if-changed=.git/refs/"); + // Get project git dir + let git_dir = run_command("git", &["rev-parse", "--git-dir"])?; + + // Watch HEAD + let head_path = format!("{git_dir}/HEAD"); + println!("cargo:rerun-if-changed={head_path}"); + + // Watch HEAD ref + let head_content = + std::fs::read_to_string(head_path).map_err(|e| format!("Failed to read git HEAD: {e}"))?; + if let Some(ref_path) = head_content.strip_prefix("ref: ") { + println!("cargo:rerun-if-changed={git_dir}/{ref_path}"); + } // Get the short commit hash let commit_hash = run_command("git", &["rev-parse", "--short", "HEAD"])?; @@ -46,5 +55,8 @@ fn main() -> Result<(), String> { // Set the environment variable VERSION println!("cargo:rustc-env=GIT_HASH={}", commit_hash); + // Watch the build script also + println!("cargo:rerun-if-changed=build.rs"); + Ok(()) } diff --git a/common/taler-test-utils/src/db.rs b/common/taler-test-utils/src/db.rs @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2025 Taler Systems SA + Copyright (C) 2025, 2026 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -44,7 +44,6 @@ pub async fn db_test_setup(src: ConfigSource) -> PgPool { } pub async fn db_test_setup_manual(sql_dir: &Path, component_name: &str) -> PgPool { - println!("{sql_dir:?} {component_name}"); setup_tracing(); let cfg = test_db().await; let pool = pool(cfg, &component_name.replace("-", "_")).await.unwrap();