/*
 * asklyphe-auth-frontend build.rs
 * - build script
 *
 * Copyright (C) 2025 Real Microsoft, LLC
 *
 * This program 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 Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

use std::process::Command;
fn main() {
    let output = Command::new("git")
        .args(["rev-parse", "--short", "HEAD"])
        .output()
        .expect("Failed to execute git command");
    let git_commit = String::from_utf8(output.stdout).unwrap();
    println!("cargo:rustc-env=GIT_COMMIT={}", git_commit);

    let output = Command::new("date")
        .args(["-u", "+%Y-%m-%d"])
        .output()
        .expect("Failed to execute date command");
    let built_on = String::from_utf8(output.stdout).unwrap();
    println!("cargo:rustc-env=BUILT_ON={}", built_on);

    let output = Command::new("date")
        .args(["-u", "+%Y"])
        .output()
        .expect("Failed to execute date command");
    let year = String::from_utf8(output.stdout).unwrap();
    println!("cargo:rustc-env=YEAR={}", year);
}
