feat: add build.rs setup

This commit is contained in:
Aravinth Manivannan 2022-04-02 16:28:56 +05:30
parent efd4db8e1c
commit 68704573c6
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 65 additions and 4 deletions

View file

@ -1,20 +1,25 @@
[package] [package]
name = "starchart"
repository = "https://github.com/forgeflux-org/starchart"
version = "0.1.0"
authors = ["realaravinth <realaravinth@batsense.net>"] authors = ["realaravinth <realaravinth@batsense.net>"]
description = "ForgeFlux StarChart - Federated forge spider" description = "ForgeFlux StarChart - Federated forge spider"
documentation = "https://forgeflux.org/" documentation = "https://forgeflux.org/"
edition = "2021" edition = "2021"
license = "AGPLv3 or later version" license = "AGPLv3 or later version"
name = "starchart" build = "build.rs"
repository = "https://github.com/forgeflux-org/starchart"
version = "0.1.0"
[dependencies] [dependencies]
actix-rt = "2.7" actix-rt = "2.7"
config = "0.12.0" config = "0.11.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
rand = "0.8.5" rand = "0.8.5"
tera = "1.15" tera = "1.15"
tokio = { version = "1.17", features = ["fs", "time"] } tokio = { version = "1.17", features = ["fs", "time"] }
url = "2.2.2" url = "2.2.2"
validator = { version = "0.14", features = ["derive"]}
derive_more = "0.99.17"
log = "0.4.16"
[dependencies.reqwest] [dependencies.reqwest]
features = ["rustls-tls-native-roots", "gzip", "deflate", "brotli", "json"] features = ["rustls-tls-native-roots", "gzip", "deflate", "brotli", "json"]

56
build.rs Normal file
View file

@ -0,0 +1,56 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* 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, either version 3 of the
* License, or (at your option) any later version.
*
* 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;
//use cache_buster::{BusterBuilder, NoHashCategory};
fn main() {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.expect("error in git command, is git installed?");
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
// cache_bust();
}
//fn cache_bust() {
// // until APPLICATION_WASM gets added to mime crate
// // PR: https://github.com/hyperium/mime/pull/138
// // let types = vec![
// // mime::IMAGE_PNG,
// // mime::IMAGE_SVG,
// // mime::IMAGE_JPEG,
// // mime::IMAGE_GIF,
// // mime::APPLICATION_JAVASCRIPT,
// // mime::TEXT_CSS,
// // ];
//
// println!("cargo:rerun-if-changed=static/cache");
// let no_hash = vec![NoHashCategory::FileExtentions(vec!["wasm"])];
//
// let config = BusterBuilder::default()
// .source("./static/cache/")
// .result("./assets")
// .no_hash(no_hash)
// .follow_links(true)
// .build()
// .unwrap();
//
// config.process().unwrap();
//}