Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux: Use optional compile-time RELEASE_VERSION variable (#11490)

Thorsten Ball4eedbdedaee6
diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs
index 842b0d6f53d..f09f92d31a5 100644
--- a/crates/gpui/src/platform/linux/platform.rs
+++ b/crates/gpui/src/platform/linux/platform.rs
@@ -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> {
diff --git a/script/bundle-linux b/script/bundle-linux
index 6097e638c99..9cf869dc01e 100755
--- a/script/bundle-linux
+++ b/script/bundle-linux
@@ -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)