mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-22 18:46:37 +00:00
dep: Replace vergen with vergen-gitcl (#2207)
* dep: Bump vergen to 9.0.6 Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Replace vergen with vergen-gitcl Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix vergen-gitcl dep req Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix use of vergen_gitcl in build.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix build.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix build.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix fmt in build.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix fmt in build.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Print out newly installed cargo-binstall version verbose in self-install.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
f317ddf23a
commit
a1ca1a46ab
3 changed files with 35 additions and 15 deletions
|
@ -49,7 +49,7 @@ zeroize = "1.8.1"
|
|||
|
||||
[build-dependencies]
|
||||
embed-resource = "3.0.1"
|
||||
vergen = { version = "8.2.7", features = ["build", "cargo", "git", "gitcl", "rustc"] }
|
||||
vergen-gitcl = { version = "1.0.8", features = ["build", "cargo", "rustc"] }
|
||||
|
||||
[features]
|
||||
default = ["static", "rustls", "trust-dns", "fancy-no-backtrace", "zstd-thin", "git"]
|
||||
|
|
|
@ -12,6 +12,8 @@ fn succeeds(res: io::Result<Child>) -> bool {
|
|||
}
|
||||
|
||||
fn emit_vergen_info() {
|
||||
use vergen_gitcl::*;
|
||||
|
||||
let git = Command::new("git").arg("--version").spawn();
|
||||
|
||||
// .git is usually a dir, but it also can be a file containing
|
||||
|
@ -21,24 +23,42 @@ fn emit_vergen_info() {
|
|||
// should exists.
|
||||
let is_git_repo = Path::new("../../.git").exists();
|
||||
|
||||
let mut builder = vergen::EmitBuilder::builder();
|
||||
builder.all_build().all_cargo().all_rustc();
|
||||
|
||||
if is_git_repo && succeeds(git) {
|
||||
builder.all_git();
|
||||
} else {
|
||||
builder.disable_git();
|
||||
}
|
||||
|
||||
builder.emit().unwrap();
|
||||
Emitter::default()
|
||||
.fail_on_error()
|
||||
.add_instructions(&BuildBuilder::default().build_date(true).build().unwrap())
|
||||
.unwrap()
|
||||
.add_instructions(&CargoBuilder::default().features(true).build().unwrap())
|
||||
.unwrap()
|
||||
.add_instructions(
|
||||
&RustcBuilder::default()
|
||||
.semver(true)
|
||||
.commit_hash(true)
|
||||
.llvm_version(true)
|
||||
.build()
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap()
|
||||
.add_instructions(&{
|
||||
let mut gitcl_builder = GitclBuilder::default();
|
||||
if is_git_repo && succeeds(git) {
|
||||
// sha(false) means enable the default sha output but not the short output
|
||||
gitcl_builder.commit_date(true).sha(false);
|
||||
}
|
||||
gitcl_builder.build().unwrap()
|
||||
})
|
||||
.unwrap()
|
||||
.emit()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
const RERUN_INSTRUCTIONS: &str = "cargo:rerun-if-changed=build.rs
|
||||
cargo:rerun-if-changed=manifest.rc
|
||||
cargo:rerun-if-changed=windows.manifest";
|
||||
|
||||
fn main() {
|
||||
thread::scope(|s| {
|
||||
let handle = s.spawn(|| {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=manifest.rc");
|
||||
println!("cargo:rerun-if-changed=windows.manifest");
|
||||
println!("{RERUN_INSTRUCTIONS}");
|
||||
|
||||
embed_resource::compile("manifest.rc", embed_resource::NONE)
|
||||
.manifest_required()
|
||||
|
|
|
@ -10,5 +10,5 @@ export PATH="$CARGO_HOME/bin:$PATH"
|
|||
|
||||
"./$1" --self-install
|
||||
|
||||
cargo binstall --help
|
||||
cargo binstall -vV
|
||||
cargo install --list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue