Skip to content

Commit

Permalink
wip: build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed Jul 27, 2024
1 parent b76facd commit f239e0c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ sea-orm = { version = "0.12", features = [
"runtime-tokio-native-tls",
] }
sea-orm-migration = { version = "0.12" }
chrono = "0.4.38"
serde_json = "1.0.117"
chrono = { version = "0.4" }
serde_json = { version = "1.0" }
bollard = "*"
bcrypt = "0.15.1"
once_cell = "1.19.0"
Expand All @@ -55,10 +55,13 @@ validator = { version = "0.18", features = ["derive"] }
openssl = { version = "0.10", features = ["vendored"] }
wsrx = { version = "0.2", features = ["server"] }
serde_yaml = "0.9.34"
kube = { version = "0.92.1", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.22.0", features = ["latest"] }
kube = { version = "0.93", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.22", features = ["latest"] }
reqwest = { version = "0.12", features = ["json"] }
async-trait = "0.1.81"
async-trait = { version = "0.1" }

[build-dependencies]
chrono = { version = "0.4" }

[[bin]]
name = "cloudsdale"
Expand Down
23 changes: 23 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::{fs, path::Path, process::Command};

fn main() {
println!(
"cargo:rustc-env=GIT_COMMIT_ID={}",
String::from_utf8(
Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.expect("Failed to execute git command")
.stdout,
)
.expect("Invalid UTF-8 sequence")
.trim()
);

println!(
"cargo:rustc-env=BUILD_AT={}",
chrono::Utc::now()
.format("%Y-%m-%d %H:%M:%S UTC")
.to_string()
);
}
11 changes: 8 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ const BANNER: &str = r#"
/ __| |/ _ \| | | |/ _` / __|/ _` |/ _` | |/ _ \
| (__| | (_) | |_| | (_| \__ \ (_| | (_| | | __/
\___|_|\___/ \__,_|\__,_|___/\__,_|\__,_|_|\___|
Version {{.Version}}
Commit: {{.Commit}}
Version {{version}}
Commit: {{commit}}
Build At: {{build_at}}
GitHub: https://github.com/elabosak233/cloudsdale
"#;

#[tokio::main]
async fn main() {
println!(
"{}",
BANNER.replace("{{.Version}}", env!("CARGO_PKG_VERSION"))
BANNER
.replace("{{version}}", env!("CARGO_PKG_VERSION"))
.replace("{{commit}}", env!("GIT_COMMIT_ID"))
.replace("{{build_at}}", env!("BUILD_AT"))
);

server::bootstrap().await;
Expand Down

0 comments on commit f239e0c

Please sign in to comment.