mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-28 07:43:11 +08:00

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.