Skip to content

Commit b62ed98

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
extract dep-provider rules to folly/portability/provide/
Summary: Rules which conditionally provide exported deps. * `libdwarf` * `libunwind` Reviewed By: dtolnay Differential Revision: D78818646 fbshipit-source-id: 2d89e2e8518902dab453aeaf7131756e571f08a6
1 parent bc2003a commit b62ed98

File tree

8 files changed

+98
-29
lines changed

8 files changed

+98
-29
lines changed

folly/debugging/symbolizer/BUCK

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ non_fbcode_target(
3131
":symbolized_frame",
3232
"//third-party/boost:boost",
3333
"//third-party/glog:glog",
34-
"//third-party/libdwarf:dwarf",
3534
"//xplat/folly:function",
3635
"//xplat/folly:optional",
3736
"//xplat/folly:portability_sys_mman",
3837
"//xplat/folly:portability_unistd",
3938
"//xplat/folly:range",
4039
"//xplat/folly:scope_guard",
40+
"//xplat/folly/portability/provide:libdwarf", # @manual
4141
],
4242
)
4343

@@ -209,12 +209,12 @@ fbcode_target(
209209
"//folly/portability:unistd",
210210
],
211211
exported_deps = [
212-
"fbsource//third-party/libdwarf:dwarf",
213212
":elf",
214213
":elf_cache",
215214
":symbolized_frame",
216215
"//folly:function",
217216
"//folly:range",
217+
"//folly/portability/provide:libdwarf", # @manual
218218
],
219219
)
220220

folly/debugging/symbolizer/Dwarf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#if FOLLY_HAVE_DWARF && FOLLY_HAVE_ELF
2929

30-
#include <dwarf.h> // @manual=fbsource//third-party/libdwarf:dwarf
30+
#include <dwarf.h> // @manual
3131

3232
namespace folly {
3333
namespace symbolizer {

folly/debugging/symbolizer/DwarfImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#if FOLLY_HAVE_DWARF && FOLLY_HAVE_ELF
2929

30-
#include <dwarf.h> // @manual=fbsource//third-party/libdwarf:dwarf
30+
#include <dwarf.h> // @manual
3131

3232
// We need a single dwarf5 tag, but may not be building against
3333
// a new enough libdwarf, so just define it ourselves.

folly/debugging/symbolizer/DwarfUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#if FOLLY_HAVE_DWARF && FOLLY_HAVE_ELF
2929

30-
#include <dwarf.h> // @manual=fbsource//third-party/libdwarf:dwarf
30+
#include <dwarf.h> // @manual
3131

3232
// We need a single dwarf5 tag, but may not be building against
3333
// a new enough libdwarf, so just define it ourselves.

folly/debugging/symbolizer/DwarfUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <folly/debugging/symbolizer/ElfCache.h>
2727

2828
#if FOLLY_HAVE_DWARF && FOLLY_HAVE_ELF
29-
#include <dwarf.h> // @manual=fbsource//third-party/libdwarf:dwarf
29+
#include <dwarf.h> // @manual
3030

3131
namespace folly {
3232
namespace symbolizer {

folly/portability/BUCK

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,13 @@ non_fbcode_target(
278278
non_fbcode_target(
279279
_kind = folly_xplat_library,
280280
name = "libunwind",
281-
exported_preprocessor_flags = select({
282-
"DEFAULT": [],
283-
"ovr_config//runtime:anywhere-linux": [
284-
# anywhere-linux links in a different version of libunwind, do not use for now
285-
"-DFOLLY_HAVE_LIBUNWIND=0",
286-
],
287-
}),
288281
feature = triage_InfrastructureSupermoduleOptou,
289282
raw_headers = [
290283
"Libunwind.h",
291284
],
292-
exported_deps = select({
293-
"DEFAULT": ["//third-party/libunwind:unwind"],
294-
"ovr_config//os:android": [],
295-
"ovr_config//os:appletvos": [], # apple
296-
"ovr_config//os:iphoneos": [], # apple
297-
"ovr_config//os:macos": [], # apple
298-
"ovr_config//os:watchos": [], # apple
299-
"ovr_config//os:windows": [],
300-
"ovr_config//runtime:anywhere-linux": [],
301-
}),
285+
exported_deps = [
286+
"//xplat/folly/portability/provide:libunwind", # @manual
287+
],
302288
)
303289

304290
non_fbcode_target(
@@ -918,11 +904,8 @@ fbcode_target(
918904
_kind = cpp_library,
919905
name = "libunwind",
920906
headers = ["Libunwind.h"],
921-
os_deps = [
922-
(
923-
"linux",
924-
["fbsource//third-party/libunwind:unwind"],
925-
),
907+
exported_deps = [
908+
"//folly/portability/provide:libunwind", # @manual
926909
],
927910
)
928911

folly/portability/provide/BUCK

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
2+
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
3+
load("@fbsource//xplat/folly:defs.bzl", "folly_xplat_library")
4+
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")
5+
6+
oncall("fbcode_entropy_wardens_folly")
7+
8+
# Here are rules which conditionally provide exported-deps on other libraries,
9+
# encapsulating the conditional logic via select's.
10+
#
11+
# This enables other rules across folly which may need these deps to extract the
12+
# complexity to here and to take simple deps on the rules here.
13+
14+
# xplat build rules
15+
16+
non_fbcode_target(
17+
_kind = folly_xplat_library,
18+
name = "libdwarf",
19+
feature = triage_InfrastructureSupermoduleOptou,
20+
exported_deps = select({
21+
"DEFAULT": [],
22+
"ovr_config//os:linux": [
23+
"//third-party/libdwarf:dwarf",
24+
],
25+
}),
26+
)
27+
28+
non_fbcode_target(
29+
_kind = folly_xplat_library,
30+
name = "libunwind",
31+
feature = triage_InfrastructureSupermoduleOptou,
32+
exported_deps = select({
33+
"DEFAULT": [],
34+
"ovr_config//os:linux": [
35+
":libunwind-linux",
36+
],
37+
}),
38+
)
39+
40+
non_fbcode_target(
41+
_kind = folly_xplat_library,
42+
name = "libunwind-linux",
43+
feature = triage_InfrastructureSupermoduleOptou,
44+
exported_deps = select({
45+
"DEFAULT": [
46+
"//third-party/libunwind:unwind",
47+
],
48+
# anywhere-linux links in a different version of libunwind, do not use for now
49+
"ovr_config//runtime:anywhere-linux": [],
50+
}),
51+
)
52+
53+
# fbcode build rules
54+
55+
fbcode_target(
56+
_kind = cpp_library,
57+
name = "libdwarf",
58+
exported_deps = [
59+
"fbsource//third-party/libdwarf:dwarf",
60+
],
61+
)
62+
63+
fbcode_target(
64+
_kind = cpp_library,
65+
name = "libunwind",
66+
exported_deps = select({
67+
"DEFAULT": [],
68+
"ovr_config//os:linux": [
69+
":libunwind-linux",
70+
],
71+
}),
72+
)
73+
74+
fbcode_target(
75+
_kind = cpp_library,
76+
name = "libunwind-linux",
77+
exported_deps = [
78+
"fbsource//third-party/libunwind:unwind",
79+
],
80+
)

folly/somerge_defs.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Generated by xplat/cross_plat_devx/somerge_maps/compute_merge_maps.py
44
5-
@generated SignedSource<<58b02d4f74c351f1bf835678b4994dda>>
5+
@generated SignedSource<<86c7a6368a4495e6ff85c7500efbcd6d>>
66
"""
77

88
# Entry Points:
@@ -968,6 +968,12 @@ FOLLY_EXTENDED_NATIVE_LIBRARY_MERGE_MAP = [
968968
"fbsource//xplat/folly/net:tcpinfoAndroid$",
969969
"fbsource//xplat/folly/net:tcpinfo_dispatcher$",
970970
"fbsource//xplat/folly/net:tcpinfo_dispatcherAndroid$",
971+
"fbsource//xplat/folly/portability/provide:libdwarf$",
972+
"fbsource//xplat/folly/portability/provide:libdwarfAndroid$",
973+
"fbsource//xplat/folly/portability/provide:libunwind$",
974+
"fbsource//xplat/folly/portability/provide:libunwind-linux$",
975+
"fbsource//xplat/folly/portability/provide:libunwind-linuxAndroid$",
976+
"fbsource//xplat/folly/portability/provide:libunwindAndroid$",
971977
"fbsource//xplat/folly/portability:libunwind$",
972978
"fbsource//xplat/folly/portability:libunwindAndroid$",
973979
"fbsource//xplat/folly/portability:openssl$",

0 commit comments

Comments
 (0)