mCaptcha/build.rs

23 lines
721 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
2023-10-16 15:41:04 +00:00
let now = OffsetDateTime::now_utc();
let now = format!("{}{}{}", now.year(), now.month(), now.date());
2021-07-21 16:45:52 +00:00
println!("cargo:rustc-env=COMPILED_DATE={}", &now);
2021-03-24 07:13:32 +00:00
}