mCaptcha/build.rs

22 lines
670 B
Rust
Raw Normal View History

// Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2021-07-21 16:45:52 +00:00
use std::process::Command;
2021-03-24 07:13:32 +00:00
2021-07-21 16:45:52 +00:00
use sqlx::types::time::OffsetDateTime;
2021-04-01 09:53:36 +00:00
2021-03-24 07:13:32 +00:00
fn main() {
// note: add error checking yourself.
let output = Command::new("git")
2023-07-02 16:21:24 +00:00
.args(["rev-parse", "HEAD"])
2021-03-24 07:13:32 +00:00
.output()
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
2021-04-01 09:53:36 +00:00
2021-07-21 16:45:52 +00:00
let now = OffsetDateTime::now_utc().format("%y-%m-%d");
println!("cargo:rustc-env=COMPILED_DATE={}", &now);
2021-03-24 07:13:32 +00:00
}