linux: Use optional compile-time RELEASE_VERSION variable (#11490)
This implements `app_version` on Linux by using an optional, compile-time `RELEASE_VERSION` env var that can be set. We settled on the `RELEASE_VERSION` as the name, since it's similar to `RELEASE_CHANNEL` which we use in Zed. cc @ConradIrwin @mikayla-maki Release Notes: - N/A Co-authored-by: Bennet <bennetbo@gmx.de>
This commit is contained in:
parent
33d4c563fb
commit
4eedbdedae
2 changed files with 10 additions and 1 deletions
|
@ -348,8 +348,13 @@ impl<P: LinuxClient + 'static> Platform for P {
|
|||
}
|
||||
|
||||
fn app_version(&self) -> Result<SemanticVersion> {
|
||||
const VERSION: Option<&str> = option_env!("RELEASE_VERSION");
|
||||
if let Some(version) = VERSION {
|
||||
version.parse()
|
||||
} else {
|
||||
Ok(SemanticVersion::new(1, 0, 0))
|
||||
}
|
||||
}
|
||||
|
||||
fn app_path(&self) -> Result<PathBuf> {
|
||||
// get the path of the executable of the current process
|
||||
|
|
|
@ -26,7 +26,11 @@ done
|
|||
export ZED_BUNDLE=true
|
||||
|
||||
channel=$(<crates/zed/RELEASE_CHANNEL)
|
||||
|
||||
version="$(cargo metadata --no-deps --manifest-path crates/zed/Cargo.toml --offline --format-version=1 | jq -r '.packages | map(select(.name == "zed"))[0].version')"
|
||||
# Set RELEASE_VERSION so it's compiled into GPUI and it knows about the version.
|
||||
export RELEASE_VERSION="${version}"
|
||||
|
||||
commit=$(git rev-parse HEAD | cut -c 1-7)
|
||||
|
||||
version_info=$(rustc --version --verbose)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue