This repository has been archived on 2024-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
ux-survey/build.rs

23 lines
721 B
Rust
Raw Permalink Normal View History

2024-01-31 15:04:15 +05:30
// Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
use std::process::Command;
use sqlx::types::time::OffsetDateTime;
fn main() {
// note: add error checking yourself.
let output = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
let now = OffsetDateTime::now_utc();
let now = format!("{}{}{}", now.year(), now.month(), now.date());
println!("cargo:rustc-env=COMPILED_DATE={}", &now);
}