Skip to content

Commit

Permalink
Don't break build when git is missing (#856)
Browse files Browse the repository at this point in the history
If git is missing, the build script will fail. This changes it so that
it uses the string `unknown` instead of the version.

This version is currently only used to log a warning if there is a
version mismatch between the client and server. We should switch to
using only the version number for this soon anyway now that the protocol
is more stable.
  • Loading branch information
paulgb authored Dec 18, 2024
1 parent 9480135 commit db0a709
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "plane-common"
version = "0.5.3"
version = "0.5.4"
edition = "2021"
description = "Client library and common utilities for the Plane session backend orchestrator."
license = "MIT"
Expand Down
11 changes: 6 additions & 5 deletions common/build.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use std::process::Command;

fn main() {
let output = Command::new("git")
let git_hash = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.expect("Failed to execute git command");

let git_hash = String::from_utf8_lossy(&output.stdout).trim().to_string();
let git_hash: String = git_hash.chars().take(8).collect();
.map(|output| {
let hash = String::from_utf8_lossy(&output.stdout).trim().to_string();
hash.chars().take(8).collect::<String>()
})
.unwrap_or_else(|_| String::from("unknown"));

println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}
2 changes: 1 addition & 1 deletion dynamic-proxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "plane-dynamic-proxy"
version = "0.5.3"
version = "0.5.4"
edition = "2021"
description = "Dynamic proxy crate for Plane"
repository = "https://github.com/jamsocket/plane"
Expand Down
2 changes: 1 addition & 1 deletion plane/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "plane"
version = "0.5.3"
version = "0.5.4"
edition = "2021"
default-run = "plane"
description = "Session backend orchestrator for ambitious browser-based apps."
Expand Down

0 comments on commit db0a709

Please sign in to comment.