Skip to content

Commit b715636

Browse files
gleocadiegyuheon0h
andauthored
chore(crashtracker): fix benchmark job (#1664)
# What does this PR do? At build time, initialize libunwind submodule # Motivation Fix benchmark (gitlab) job Co-authored-by: gyuheon.oh <gyuheon.oh@datadoghq.com>
1 parent 412ae10 commit b715636

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libdd-libunwind-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "libdd-libunwind"
2+
name = "libdd-libunwind-sys"
33
edition.workspace = true
44
version.workspace = true
55
rust-version.workspace = true

libdd-libunwind-sys/build.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,27 @@ mod linux {
1818
let libunwind_dir = std::path::Path::new(&manifest_dir).join("libunwind");
1919

2020
if !libunwind_dir.join("src").exists() {
21-
panic!(
22-
"libunwind source not found at {}. \
23-
Did you forget to run `git submodule update --init`?",
24-
libunwind_dir.display()
25-
);
26-
}
21+
eprintln!("Initializing libunwind submodule...");
22+
let status = std::process::Command::new("git")
23+
.args([
24+
"submodule",
25+
"update",
26+
"--init",
27+
"--recursive",
28+
"--",
29+
"libdd-libunwind-sys/libunwind",
30+
])
31+
.current_dir(std::path::Path::new(&manifest_dir).parent().unwrap())
32+
.status()
33+
.expect("Failed to run git. Is git installed?");
2734

28-
// Check if libunwind submodule is initialized
29-
if !libunwind_dir.exists() || std::fs::read_dir(&libunwind_dir).unwrap().next().is_none() {
30-
panic!(
31-
"libunwind submodule not initialized!\n\
32-
Run: git submodule update --init --recursive\n\
33-
\n\
34-
For CI, ensure your workflow checks out submodules:\n\
35-
- GitHub Actions: add 'submodules: recursive' to actions/checkout\n\
36-
- GitLab CI: add 'GIT_SUBMODULE_STRATEGY: recursive'\n\
37-
\n\
38-
Directory checked: {}",
39-
libunwind_dir.display()
40-
);
35+
if !status.success() || !libunwind_dir.join("src").exists() {
36+
panic!(
37+
"Failed to initialize libunwind submodule at {}.\n\
38+
Try manually: git submodule update --init --recursive",
39+
libunwind_dir.display()
40+
);
41+
}
4142
}
4243

4344
std::fs::create_dir_all(&build_dir).unwrap();

0 commit comments

Comments
 (0)