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 19:45:52 +03:00
use std::process::Command;
2021-03-24 10:13:32 +03:00
2021-07-21 19:45:52 +03:00
use sqlx::types::time::OffsetDateTime;
2021-04-01 12:53:36 +03:00
2021-03-24 10:13:32 +03:00
fn main() {
// note: add error checking yourself.
let output = Command::new("git")
2023-07-02 19:21:24 +03:00
.args(["rev-parse", "HEAD"])
2021-03-24 10:13:32 +03:00
.output()
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
2021-04-01 12:53:36 +03:00
2023-10-16 18:41:04 +03:00
let now = OffsetDateTime::now_utc();
let now = format!("{}{}{}", now.year(), now.month(), now.date());
2021-07-21 19:45:52 +03:00
println!("cargo:rustc-env=COMPILED_DATE={}", &now);
2021-03-24 10:13:32 +03:00
}