Skip to content

Commit d37029e

Browse files
snarkmastermeta-codesync[bot]
authored andcommitted
dirsync-ify folly/coro/safe
Reviewed By: mzlee Differential Revision: D91404786 fbshipit-source-id: ac6bb2a69a25c99b0a4d71a00c665b3453669fa5
1 parent 0f65227 commit d37029e

File tree

6 files changed

+35
-143
lines changed

6 files changed

+35
-143
lines changed

folly/coro/safe/BUCK

Lines changed: 7 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,19 @@
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("../../defs.bzl", "folly_xplat_cxx_library")
1+
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
42

53
oncall("fbcode_entropy_wardens_folly")
64

7-
non_fbcode_target(
8-
_kind = folly_xplat_cxx_library,
9-
name = "async_closure_fwd",
10-
raw_headers = ["AsyncClosure-fwd.h"],
11-
)
12-
13-
fbcode_target(
14-
_kind = cpp_library,
5+
fb_dirsync_cpp_library(
156
name = "async_closure_fwd",
167
headers = ["AsyncClosure-fwd.h"],
178
)
189

19-
###
20-
21-
non_fbcode_target(
22-
_kind = folly_xplat_cxx_library,
23-
name = "bind_captures",
24-
raw_headers = ["BindCaptures.h"],
25-
exported_deps = ["//xplat/folly/lang/bind:bind"],
26-
)
27-
28-
fbcode_target(
29-
_kind = cpp_library,
10+
fb_dirsync_cpp_library(
3011
name = "bind_captures",
3112
headers = ["BindCaptures.h"],
3213
exported_deps = ["//folly/lang/bind:bind"],
3314
)
3415

35-
###
36-
37-
non_fbcode_target(
38-
_kind = folly_xplat_cxx_library,
39-
name = "captures",
40-
raw_headers = ["Captures.h"],
41-
exported_deps = [
42-
":async_closure_fwd",
43-
"//xplat/folly:portability",
44-
"//xplat/folly:traits",
45-
"//xplat/folly:utility",
46-
"//xplat/folly/coro/safe/detail:define_movable_deep_const_lref_copyable",
47-
"//xplat/folly/detail:tuple",
48-
"//xplat/folly/lang:safe_alias_fwd",
49-
],
50-
)
51-
52-
fbcode_target(
53-
_kind = cpp_library,
16+
fb_dirsync_cpp_library(
5417
name = "captures",
5518
headers = ["Captures.h"],
5619
exported_deps = [
@@ -64,40 +27,15 @@ fbcode_target(
6427
],
6528
)
6629

67-
###
68-
69-
non_fbcode_target(
70-
_kind = folly_xplat_cxx_library,
71-
name = "async_closure",
72-
raw_headers = ["AsyncClosure.h"],
73-
exported_deps = [
74-
"//xplat/folly/coro/safe/detail:async_closure",
75-
],
76-
)
77-
78-
fbcode_target(
79-
_kind = cpp_library,
30+
fb_dirsync_cpp_library(
8031
name = "async_closure",
8132
headers = ["AsyncClosure.h"],
8233
exported_deps = [
8334
"//folly/coro/safe/detail:async_closure",
8435
],
8536
)
8637

87-
###
88-
89-
non_fbcode_target(
90-
_kind = folly_xplat_cxx_library,
91-
name = "now_task",
92-
raw_headers = ["NowTask.h"],
93-
exported_deps = [
94-
"//xplat/folly/coro:task_wrapper",
95-
"//xplat/folly/lang:safe_alias_fwd",
96-
],
97-
)
98-
99-
fbcode_target(
100-
_kind = cpp_library,
38+
fb_dirsync_cpp_library(
10139
name = "now_task",
10240
headers = ["NowTask.h"],
10341
exported_deps = [
@@ -106,21 +44,7 @@ fbcode_target(
10644
],
10745
)
10846

109-
###
110-
111-
non_fbcode_target(
112-
_kind = folly_xplat_cxx_library,
113-
name = "safe_task",
114-
raw_headers = ["SafeTask.h"],
115-
exported_deps = [
116-
":now_task",
117-
"//xplat/folly/coro:task_wrapper",
118-
"//xplat/folly/lang:safe_alias",
119-
],
120-
)
121-
122-
fbcode_target(
123-
_kind = cpp_library,
47+
fb_dirsync_cpp_library(
12448
name = "safe_task",
12549
headers = ["SafeTask.h"],
12650
exported_deps = [

folly/coro/safe/detail/BUCK

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
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("../../../defs.bzl", "folly_xplat_cxx_library")
1+
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
42

53
oncall("fbcode_entropy_wardens_folly")
64

7-
non_fbcode_target(
8-
_kind = folly_xplat_cxx_library,
9-
name = "async_closure",
10-
raw_headers = ["AsyncClosure.h"],
11-
exported_deps = [
12-
":bind_async_closure",
13-
"//xplat/folly/coro:value_or_fatal",
14-
"//xplat/folly/coro/safe:safe_task",
15-
"//xplat/folly/detail:tuple",
16-
],
17-
)
18-
19-
fbcode_target(
20-
_kind = cpp_library,
5+
fb_dirsync_cpp_library(
216
name = "async_closure",
227
headers = ["AsyncClosure.h"],
238
exported_deps = [
@@ -28,23 +13,7 @@ fbcode_target(
2813
],
2914
)
3015

31-
###
32-
33-
non_fbcode_target(
34-
_kind = folly_xplat_cxx_library,
35-
name = "bind_async_closure",
36-
raw_headers = ["BindAsyncClosure.h"],
37-
exported_deps = [
38-
"//xplat/folly/coro/safe:bind_captures",
39-
"//xplat/folly/coro/safe:captures",
40-
"//xplat/folly/lang:safe_alias",
41-
"//xplat/folly/lang/bind:named",
42-
"//xplat/folly/lang/bind:named_to_storage",
43-
],
44-
)
45-
46-
fbcode_target(
47-
_kind = cpp_library,
16+
fb_dirsync_cpp_library(
4817
name = "bind_async_closure",
4918
headers = ["BindAsyncClosure.h"],
5019
exported_deps = [
@@ -56,16 +25,7 @@ fbcode_target(
5625
],
5726
)
5827

59-
###
60-
61-
non_fbcode_target(
62-
_kind = folly_xplat_cxx_library,
63-
name = "define_movable_deep_const_lref_copyable",
64-
raw_headers = ["DefineMovableDeepConstLrefCopyable.h"],
65-
)
66-
67-
fbcode_target(
68-
_kind = cpp_library,
28+
fb_dirsync_cpp_library(
6929
name = "define_movable_deep_const_lref_copyable",
7030
headers = ["DefineMovableDeepConstLrefCopyable.h"],
7131
)

folly/coro/safe/detail/test/BUCK

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
2-
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
1+
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_unittest.bzl", "fb_dirsync_cpp_unittest")
32

43
oncall("fbcode_entropy_wardens_folly")
54

6-
fbcode_target(
7-
_kind = cpp_unittest,
5+
fb_dirsync_cpp_unittest(
86
name = "bind_async_closure_test",
97
srcs = ["BindAsyncClosureTest.cpp"],
108
deps = [
@@ -15,8 +13,7 @@ fbcode_target(
1513
],
1614
)
1715

18-
fbcode_target(
19-
_kind = cpp_unittest,
16+
fb_dirsync_cpp_unittest(
2017
name = "define_movable_deep_const_lref_copyable_test",
2118
srcs = ["DefineMovableDeepConstLrefCopyableTest.cpp"],
2219
deps = [

folly/coro/safe/test/AsyncClosureTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <folly/coro/ValueOrFatal.h>
2020
#include <folly/coro/safe/AsyncClosure.h>
2121
#include <folly/fibers/Semaphore.h>
22+
#include <folly/init/Init.h>
2223

2324
#if FOLLY_HAS_IMMOVABLE_COROUTINES
2425

@@ -990,3 +991,9 @@ CO_TEST(AsyncClosure, ctorCleanupDtorOrdering) {
990991
} // namespace folly::coro
991992

992993
#endif
994+
995+
int main(int argc, char** argv) {
996+
::testing::InitGoogleTest(&argc, argv);
997+
folly::Init init(&argc, &argv); // `timeout` uses a `Timekeeper` singleton
998+
return RUN_ALL_TESTS();
999+
}

folly/coro/safe/test/BUCK

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
2-
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
1+
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_unittest.bzl", "fb_dirsync_cpp_unittest")
32

43
oncall("fbcode_entropy_wardens_folly")
54

6-
fbcode_target(
7-
_kind = cpp_unittest,
5+
fb_dirsync_cpp_unittest(
86
name = "captures_test",
97
srcs = ["CapturesTest.cpp"],
108
deps = [
@@ -14,8 +12,7 @@ fbcode_target(
1412
],
1513
)
1614

17-
fbcode_target(
18-
_kind = cpp_unittest,
15+
fb_dirsync_cpp_unittest(
1916
name = "async_closure_test",
2017
srcs = ["AsyncClosureTest.cpp"],
2118
deps = [
@@ -24,11 +21,11 @@ fbcode_target(
2421
"//folly/coro:value_or_fatal",
2522
"//folly/coro/safe:async_closure",
2623
"//folly/fibers:semaphore",
24+
"//folly/init:init",
2725
],
2826
)
2927

30-
fbcode_target(
31-
_kind = cpp_unittest,
28+
fb_dirsync_cpp_unittest(
3229
name = "now_task_test",
3330
srcs = ["NowTaskTest.cpp"],
3431
deps = [
@@ -39,15 +36,15 @@ fbcode_target(
3936
],
4037
)
4138

42-
fbcode_target(
43-
_kind = cpp_unittest,
39+
fb_dirsync_cpp_unittest(
4440
name = "safe_task_test",
4541
srcs = ["SafeTaskTest.cpp"],
4642
deps = [
4743
"//folly/coro:gtest_helpers",
4844
"//folly/coro:timeout",
4945
"//folly/coro/safe:safe_task",
5046
"//folly/fibers:semaphore",
47+
"//folly/init:init",
5148
"//folly/portability:gtest",
5249
],
5350
)

folly/coro/safe/test/SafeTaskTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <folly/coro/Timeout.h>
1919
#include <folly/coro/safe/SafeTask.h>
2020
#include <folly/fibers/Semaphore.h>
21+
#include <folly/init/Init.h>
2122
#include <folly/portability/GTest.h>
2223

2324
#if FOLLY_HAS_IMMOVABLE_COROUTINES
@@ -304,3 +305,9 @@ static_assert(
304305
} // namespace folly::coro::detail
305306

306307
#endif
308+
309+
int main(int argc, char** argv) {
310+
::testing::InitGoogleTest(&argc, argv);
311+
folly::Init init(&argc, &argv); // `timeout` uses a `Timekeeper` singleton
312+
return RUN_ALL_TESTS();
313+
}

0 commit comments

Comments
 (0)