mirror of
https://github.com/hasura/graphql-engine.git
synced 2025-01-07 08:13:18 +03:00
c3987ff712
### What In order to talk about artifacts in MBS, we pull in the entirety of engine-multitenant, which pulls in the entirety of engine, which is quite a big dependency tree. This PR factors that code out into a separate package, `build-artifacts`, to lighten the MBS dependency burden. --------- Co-authored-by: Daniel Harvey <danieljamesharvey@gmail.com> V3_GIT_ORIGIN_REV_ID: ad60badb5b793a80cf60cf4b040501eb6abc6bb2
30 lines
1.1 KiB
Rust
30 lines
1.1 KiB
Rust
// This is copy/pasted into MBS so we can avoid pulling in the entire engine crate. If you want to
|
|
// update this script, please update the other one too.
|
|
|
|
fn main() -> Result<(), String> {
|
|
// Ensure that we rebuild if the version is specified.
|
|
println!("cargo:rerun-if-env-changed=RELEASE_VERSION");
|
|
|
|
// On release builds, use the Git commit as a backup if the version is not set.
|
|
// On debug builds, use "dev".
|
|
// If we fail to get the Git information, fail.
|
|
let build_profile = std::env::var("PROFILE").map_err(|err| err.to_string())?;
|
|
let release_version = if build_profile == "release" {
|
|
if let Some(version) = option_env!("RELEASE_VERSION") {
|
|
version.to_string()
|
|
} else {
|
|
let git_commit_ref = build_data::get_git_commit_short()?;
|
|
let git_dirty = build_data::get_git_dirty().unwrap_or(false);
|
|
if git_dirty {
|
|
format!("{git_commit_ref}-dirty")
|
|
} else {
|
|
git_commit_ref
|
|
}
|
|
}
|
|
} else {
|
|
"dev".to_string()
|
|
};
|
|
println!("cargo:rustc-env=CARGO_V3_ENGINE_VERSION={release_version}");
|
|
Ok(())
|
|
}
|