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:
Thorsten Ball 2024-05-07 17:50:19 +02:00 committed by GitHub
parent 33d4c563fb
commit 4eedbdedae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -348,7 +348,12 @@ impl<P: LinuxClient + 'static> Platform for P {
}
fn app_version(&self) -> Result<SemanticVersion> {
Ok(SemanticVersion::new(1, 0, 0))
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> {