mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Add BUILD_VERSION to lib.rs
In CMake this used a `version` file in the CARGO_MANIFEST_DIR, but relying on that is problematic due to change-detection, as if we add `cargo-rerun-if-changed:version`, cargo would rerun every time if the file does not exist, since cargo would expect the file to be generated by the build-script. We could generate it, but that relies on the output of `git describe`, whose dependencies we can only limit to anything in the `.git`-folder, again causing unnecessary build-script runs. Instead, this reads the `FISH_BUILD_VERSION`-env-variable at compile time instead of the `version`-file, and falls back to calling git-describe through the `git_version`-proc-macro. We thus do not need to deal with extraneous build-script running.
This commit is contained in:
committed by
Fabian Boehm
parent
360ba46660
commit
e7f8fb04cc
@@ -14,7 +14,7 @@ fn main() {
|
||||
.file("fish-rust/src/compat.c")
|
||||
.compile("libcompat.a");
|
||||
|
||||
let rust_dir = std::env::var("CARGO_MANIFEST_DIR").expect("Env var CARGO_MANIFEST_DIR missing");
|
||||
let rust_dir = env!("CARGO_MANIFEST_DIR");
|
||||
let target_dir =
|
||||
std::env::var("FISH_RUST_TARGET_DIR").unwrap_or(format!("{}/{}", rust_dir, "target/"));
|
||||
let cpp_fish_src_dir = format!("{}/{}", rust_dir, "src/");
|
||||
|
||||
Reference in New Issue
Block a user