rustyhorde / vergen

Generate cargo instructions at compile time in build scripts for use with the env! or option_env! macros
Apache License 2.0
370 stars 55 forks source link

Compilation failure #297

Closed faultymajority closed 7 months ago

faultymajority commented 7 months ago
% git checkout 8.3.0
% cargo build --no-default-features --features build,git,rustc
   Compiling thiserror v1.0.56
   Compiling darling_macro v0.14.4
   Compiling vergen v8.3.0 (/home/nicolas/git/vergen/vergen)
   Compiling gix-hash v0.14.1
   Compiling gix-path v0.10.3
   Compiling gix-date v0.8.3
   Compiling gix-validate v0.8.3
   Compiling gix-chunk v0.4.7
   Compiling gix-quote v0.4.10
   Compiling gix-bitmap v0.2.10
   Compiling gix-packetline-blocking v0.17.2
   Compiling gix-packetline v0.17.2
error[E0433]: failed to resolve: use of undeclared crate or module `gix`
  --> vergen/src/feature/git/gix.rs:21:5
   |
21 | use gix::{head::Kind, Commit, Head, Id, Repository};
   |     ^^^ use of undeclared crate or module `gix`
(...)
faultymajority commented 7 months ago

In fact.. cargo build --features git and cargo build --features git2 both fail.

CraZySacX commented 7 months ago

You still need to declare a "backend" git system in your feature list along with enabling the git feature to successfully compile.

So

cargo build --features git,gitcl
cargo build --features git,git2
cargo build --features git,gitoxide

I'm working on version 9 where this won't be necessary.

Also, version 8.3.0 makes this possible (due to cargo feature unification)

cargo build --features git,gitcl,git2,gitoxide

vergen will prefer gitcl over git2 and git2 over gitoxide. I do see the documentation says using only the git feature should compile, but that is incorrect. I will update that.

faultymajority commented 7 months ago

The problem was that 8.3 broke builds previously using 8.2 - but adding the backend explicitly does indeed fix things.