Skip to content

Commit

Permalink
Merge pull request #1590 from kate-goldenring/remove-git-build-requir…
Browse files Browse the repository at this point in the history
…ements

fix(build): Remove git worktree requirements for build to succeed
  • Loading branch information
kate-goldenring authored Jul 10, 2023
2 parents 173e866 + 2047693 commit 38e162b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const RUST_OUTBOUND_REDIS_INTEGRATION_TEST: &str = "tests/outbound-redis/http-ru
const TIMER_TRIGGER_INTEGRATION_TEST: &str = "examples/spin-timer/app-example";

fn main() {
// Extract environment information to be passed to plugins.
// Git information will be set to defaults if Spin is not
// built within a Git worktree.
vergen::EmitBuilder::builder()
.build_date()
.build_timestamp()
Expand All @@ -23,7 +26,6 @@ fn main() {
.git_commit_date()
.git_commit_timestamp()
.git_sha(true)
.fail_on_error()
.emit()
.expect("failed to extract build information");

Expand Down
13 changes: 5 additions & 8 deletions sdk/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ fn main() {
format!("-{pre}")
};

let output = Command::new("git")
let commit = Command::new("git")
.arg("rev-parse")
.arg("HEAD")
.output()
.expect("failed to execute `git`");

let commit = if output.status.success() {
String::from_utf8(output.stdout).unwrap()
} else {
panic!("`git` failed: {}", String::from_utf8_lossy(&output.stderr));
};
.ok()
.filter(|o| o.status.success())
.map(|o| String::from_utf8_lossy(&o.stdout).to_string())
.unwrap_or(String::from("unknown"));

let commit = commit.trim();

Expand Down

0 comments on commit 38e162b

Please sign in to comment.