Skip to content

Commit a5cf595

Browse files
committed
try
1 parent 012b95a commit a5cf595

File tree

6 files changed

+43
-40
lines changed

6 files changed

+43
-40
lines changed

BUILD.backward-stacktrace.bazel

Lines changed: 0 additions & 13 deletions
This file was deleted.

BUILD.bazel

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ configure_make(
3535
# We need 'binutils' in order to read the debug info if we want to get
3636
# the ultimate stack trace.
3737
configure_make(
38-
name = "binutils",
38+
name = "binutils_bazelified",
3939
args = [
4040
# Without this make argument binutils will not compile.
4141
# https://www.linuxquestions.org/questions/linux-from-scratch-13/problem-compiling-binutils-575412/
@@ -59,9 +59,12 @@ configure_make(
5959
)
6060

6161
cc_library(
62-
name = "backward",
62+
name = "backward-stacktrace",
63+
srcs = [
64+
"backward-stacktrace.cc",
65+
],
6366
hdrs = [
64-
"backward.hpp",
67+
"backward-stacktrace.h",
6568
],
6669
defines = [
6770
# For binutils
@@ -71,7 +74,6 @@ cc_library(
7174
],
7275
linkopts = [
7376
# For binutils
74-
"-ldl",
7577
"-lz",
7678
],
7779
# For now we support this library for macOS and Linux. Maybe in
@@ -84,13 +86,17 @@ cc_library(
8486
visibility = ["//visibility:public"],
8587
deps = select({
8688
"@bazel_tools//src/conditions:darwin": [
87-
":binutils",
89+
":binutils_bazelified",
8890
":lzma",
91+
"@com_github_backward_cpp//:backward",
92+
"@com_github_google_googletest//:gtest",
8993
],
9094
"//conditions:default": [
91-
":binutils",
95+
":binutils_bazelified",
9296
":libunwind",
9397
":lzma",
98+
"@com_github_backward_cpp//:backward",
99+
"@com_github_google_googletest//:gtest",
94100
],
95101
}),
96102
# Link any binary that depends (directly or indirectly) on this C++ library

backward-stacktrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace backward_stacktrace {
1616
// (check_line_length skip)
1717
// https://github.com/YOU-i-Labs/googletest/blob/master/googletest/docs/V1_7_AdvancedGuide.md#global-set-up-and-tear-down
1818
class BackwardStackTrace : public ::testing::Environment {
19-
private:
19+
private:
2020
// A simple helper class that registers for you the most
2121
// common signals and other callbacks to segfault,
2222
// hardware exception, un-handled exception etc.

backward_cpp.patch

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/BUILD.bazel b/BUILD.bazel
2+
new file mode 100644
3+
index 0000000..83e888a
4+
--- /dev/null
5+
+++ b/BUILD.bazel
6+
@@ -0,0 +1,5 @@
7+
+cc_library(
8+
+ name = "backward",
9+
+ hdrs = ["backward.hpp"],
10+
+ visibility = ["//visibility:public"],
11+
+)
12+
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
13+
new file mode 100644
14+
index 0000000..2a5377b
15+
--- /dev/null
16+
+++ b/WORKSPACE.bazel
17+
@@ -0,0 +1 @@
18+
+workspace(name = "backward_cpp")

bazel/deps.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,3 @@ def deps(repo_mapping = {}):
6969
strip_prefix = "googletest-release-1.12.1",
7070
repo_mapping = repo_mapping,
7171
)
72-
73-
maybe(
74-
http_archive,
75-
name = "com_github_backward_cpp",
76-
url = "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz",
77-
sha256 = "c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10",
78-
strip_prefix = "backward-cpp-1.6",
79-
repo_mapping = repo_mapping,
80-
build_file = "@com_github_3rdparty_bazel_rules_backward_cpp//:BUILD.bazel",
81-
)

bazel/repos.bzl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_r
1313
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
1414
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1515

16-
def repos(external = True, repo_mapping = {}):
16+
def repos(external = True, repo_mapping = {}, workspace_prefix = ""):
1717
maybe(
1818
git_repository,
1919
name = "com_github_3rdparty_bazel_rules_backward_cpp",
@@ -23,15 +23,6 @@ def repos(external = True, repo_mapping = {}):
2323
repo_mapping = repo_mapping,
2424
)
2525

26-
maybe(
27-
new_git_repository,
28-
name = "com_github_3rdparty_bazel_rules_backward_cpp_stacktrace",
29-
remote = "https://github.com/3rdparty/bazel-rules-backward-cpp",
30-
build_file = "@com_github_3rdparty_bazel_rules_backward_cpp//:BUILD.backward-stacktrace.bazel",
31-
commit = "69449957a41619e9b8b8be2e9bfaca2ac0642760",
32-
shallow_since = "1658132015 +0300",
33-
)
34-
3526
maybe(
3627
http_archive,
3728
name = "rules_foreign_cc",
@@ -40,3 +31,14 @@ def repos(external = True, repo_mapping = {}):
4031
strip_prefix = "rules_foreign_cc-0.9.0",
4132
repo_mapping = repo_mapping,
4233
)
34+
35+
maybe(
36+
http_archive,
37+
name = "com_github_backward_cpp",
38+
url = "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz",
39+
sha256 = "c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10",
40+
strip_prefix = "backward-cpp-1.6",
41+
repo_mapping = repo_mapping,
42+
patch_args = ["-p1"],
43+
patches = [workspace_prefix + "//:backward_cpp.patch"],
44+
)

0 commit comments

Comments
 (0)