mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-22 06:47:56 +01:00
Make build step only use git info when not building a tagged release
This commit is contained in:
parent
cc2b43a9f2
commit
dae9d0c93b
44
build.rs
44
build.rs
@ -9,29 +9,6 @@ fn is_hidden(entry: &DirEntry) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Build version number using the current git commit id
|
|
||||||
let out = Command::new("git").arg("rev-list")
|
|
||||||
.args(["HEAD", "-1"])
|
|
||||||
.output()
|
|
||||||
.expect("failed to run `git rev-list HEAD -1`");
|
|
||||||
let owned_gitrev = String::from_utf8(out.stdout)
|
|
||||||
.expect("git rev-list output was not valid UTF8");
|
|
||||||
let gitrev = owned_gitrev.trim();
|
|
||||||
let abbrev = match gitrev.len(){
|
|
||||||
0 => "unknown",
|
|
||||||
_ => &gitrev[0..9],
|
|
||||||
};
|
|
||||||
println!("cargo:rustc-env=CARGO_PKG_VERSION_GITREV={}", gitrev);
|
|
||||||
|
|
||||||
let out = Command::new("git").arg("log")
|
|
||||||
.args(["-1", "--format=%as"])
|
|
||||||
.output()
|
|
||||||
.expect("failed to run `git log -1 --format=\"format:%as\"`");
|
|
||||||
let commit_date = String::from_utf8(out.stdout)
|
|
||||||
.expect("git log output was not valid UTF8");
|
|
||||||
let commit_date = commit_date.trim();
|
|
||||||
println!("cargo:rustc-env=BFFH_GIT_COMMIT_DATE={}", commit_date);
|
|
||||||
|
|
||||||
let mut compile_command = ::capnpc::CompilerCommand::new();
|
let mut compile_command = ::capnpc::CompilerCommand::new();
|
||||||
|
|
||||||
// Set parent module of all generated schema files.
|
// Set parent module of all generated schema files.
|
||||||
@ -77,6 +54,27 @@ fn main() {
|
|||||||
version = env!("CARGO_PKG_VERSION"),
|
version = env!("CARGO_PKG_VERSION"),
|
||||||
rustc = rustc_version)
|
rustc = rustc_version)
|
||||||
} else {
|
} else {
|
||||||
|
// Build version number using the current git commit id
|
||||||
|
let out = Command::new("git").arg("rev-list")
|
||||||
|
.args(["HEAD", "-1"])
|
||||||
|
.output()
|
||||||
|
.expect("failed to run `git rev-list HEAD -1`");
|
||||||
|
let owned_gitrev = String::from_utf8(out.stdout)
|
||||||
|
.expect("git rev-list output was not valid UTF8");
|
||||||
|
let gitrev = owned_gitrev.trim();
|
||||||
|
let abbrev = match gitrev.len(){
|
||||||
|
0 => "unknown",
|
||||||
|
_ => &gitrev[0..9],
|
||||||
|
};
|
||||||
|
|
||||||
|
let out = Command::new("git").arg("log")
|
||||||
|
.args(["-1", "--format=%as"])
|
||||||
|
.output()
|
||||||
|
.expect("failed to run `git log -1 --format=\"format:%as\"`");
|
||||||
|
let commit_date = String::from_utf8(out.stdout)
|
||||||
|
.expect("git log output was not valid UTF8");
|
||||||
|
let commit_date = commit_date.trim();
|
||||||
|
|
||||||
format!("BFFH {version} ({gitrev} {date}) [{rustc}]",
|
format!("BFFH {version} ({gitrev} {date}) [{rustc}]",
|
||||||
version=env!("CARGO_PKG_VERSION"),
|
version=env!("CARGO_PKG_VERSION"),
|
||||||
gitrev=abbrev,
|
gitrev=abbrev,
|
||||||
|
@ -47,7 +47,6 @@ use crate::config::{ActorConn, Config, InitiatorConn};
|
|||||||
|
|
||||||
const RELEASE: &'static str = env!("BFFHD_RELEASE_STRING");
|
const RELEASE: &'static str = env!("BFFHD_RELEASE_STRING");
|
||||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
const GITREV: &'static str = env!("CARGO_PKG_VERSION_GITREV");
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
use clap::{crate_version, crate_description, crate_name};
|
use clap::{crate_version, crate_description, crate_name};
|
||||||
|
Loading…
Reference in New Issue
Block a user