-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
30 lines (27 loc) · 947 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use build_data::get_git_dirty;
/// Outputs a readable version number such as
/// 0.4.0 (if git commit is clean)
/// 0.4.0-SNAPSHOT (if git commit is dirty, should not happen in CI/CD builds)
fn version() -> String {
let version = String::from(env!("CARGO_PKG_VERSION"));
match get_git_dirty().unwrap() {
false => version,
true => {
format!("{}-SNAPSHOT", version)
}
}
}
fn main() {
build_data::set_GIT_COMMIT_SHORT();
build_data::set_GIT_DIRTY();
build_data::set_BUILD_DATE();
build_data::set_BUILD_TIME();
build_data::no_debug_rebuilds();
println!(
"cargo:rustc-env=SAMPLY_USER_AGENT=Routine Connector/{}",
version()
);
// Ensure running new migrations, even if no source file is changed.
// https://docs.rs/sqlx/latest/sqlx/macro.migrate.html#triggering-recompilation-on-migration-changes
println!("cargo:rerun-if-changed=migrations");
}