diff --git a/BUILD b/BUILD index 999000c6fb7..cdebd29d9d7 100644 --- a/BUILD +++ b/BUILD @@ -898,6 +898,341 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "poll", + external_deps = [ + "absl/types:variant", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/poll.h", + ], + deps = ["gpr_platform"], +) + +grpc_cc_library( + name = "context", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/context.h", + ], + deps = [ + "gpr_platform", + "gpr_tls", + ], +) + +grpc_cc_library( + name = "map", + language = "c++", + public_hdrs = ["src/core/lib/promise/map.h"], + deps = [ + "gpr_platform", + "poll", + "promise_like", + ], +) + +grpc_cc_library( + name = "promise", + external_deps = [ + "absl/types:optional", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/promise.h", + ], + deps = [ + "gpr_platform", + "poll", + "promise_like", + ], +) + +grpc_cc_library( + name = "promise_like", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/promise_like.h", + ], + deps = [ + "gpr_platform", + "poll", + ], +) + +grpc_cc_library( + name = "promise_factory", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/promise_factory.h", + ], + deps = [ + "gpr_platform", + "poll", + "promise_like", + ], +) + +grpc_cc_library( + name = "if", + external_deps = [ + "absl/status:statusor", + ], + language = "c++", + public_hdrs = ["src/core/lib/promise/if.h"], + deps = [ + "gpr_platform", + "poll", + "promise_factory", + ], +) + +grpc_cc_library( + name = "promise_status", + external_deps = [ + "absl/status", + "absl/status:statusor", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/status.h", + ], + deps = ["gpr_platform"], +) + +grpc_cc_library( + name = "race", + language = "c++", + public_hdrs = ["src/core/lib/promise/race.h"], + deps = [ + "gpr_platform", + "poll", + ], +) + +grpc_cc_library( + name = "loop", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/loop.h", + ], + deps = [ + "gpr_platform", + "poll", + "promise_factory", + ], +) + +grpc_cc_library( + name = "switch", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/switch.h", + ], + deps = ["gpr_platform"], +) + +grpc_cc_library( + name = "basic_join", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/basic_join.h", + ], + deps = [ + "bitset", + "construct_destruct", + "gpr_platform", + "poll", + "promise_factory", + ], +) + +grpc_cc_library( + name = "join", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/join.h", + ], + deps = [ + "basic_join", + "gpr_platform", + ], +) + +grpc_cc_library( + name = "try_join", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/try_join.h", + ], + deps = [ + "basic_join", + "gpr_platform", + "promise_status", + ], +) + +grpc_cc_library( + name = "basic_seq", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/detail/basic_seq.h", + ], + deps = [ + "construct_destruct", + "gpr_platform", + "poll", + "promise_factory", + "switch", + ], +) + +grpc_cc_library( + name = "seq", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/seq.h", + ], + deps = [ + "basic_seq", + "gpr_platform", + ], +) + +grpc_cc_library( + name = "try_seq", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/try_seq.h", + ], + deps = [ + "basic_seq", + "gpr_platform", + "promise_status", + ], +) + +grpc_cc_library( + name = "activity", + srcs = [ + "src/core/lib/promise/activity.cc", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/activity.h", + ], + deps = [ + "atomic_utils", + "construct_destruct", + "context", + "gpr_base", + "gpr_codegen", + "poll", + "promise_factory", + "promise_status", + ], +) + +grpc_cc_library( + name = "exec_ctx_wakeup_scheduler", + hdrs = [ + "src/core/lib/promise/exec_ctx_wakeup_scheduler.h", + ], + language = "c++", + deps = [ + "exec_ctx", + "gpr_base", + ], +) + +grpc_cc_library( + name = "wait_set", + external_deps = [ + "absl/container:flat_hash_set", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/wait_set.h", + ], + deps = [ + "activity", + "gpr_platform", + ], +) + +grpc_cc_library( + name = "intra_activity_waiter", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/intra_activity_waiter.h", + ], + deps = [ + "activity", + "gpr_platform", + ], +) + +grpc_cc_library( + name = "latch", + external_deps = [ + "absl/status", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/latch.h", + ], + deps = [ + "activity", + "gpr_platform", + "intra_activity_waiter", + ], +) + +grpc_cc_library( + name = "observable", + language = "c++", + public_hdrs = [ + "src/core/lib/promise/observable.h", + ], + deps = [ + "activity", + "gpr_platform", + "wait_set", + ], +) + +grpc_cc_library( + name = "pipe", + external_deps = [ + "absl/status", + ], + language = "c++", + public_hdrs = [ + "src/core/lib/promise/pipe.h", + ], + deps = [ + "activity", + "gpr_platform", + "intra_activity_waiter", + ], +) + +grpc_cc_library( + name = "for_each", + external_deps = [ + "absl/status", + "absl/types:variant", + ], + language = "c++", + public_hdrs = ["src/core/lib/promise/for_each.h"], + deps = [ + "gpr_platform", + "poll", + "promise_factory", + ], +) + grpc_cc_library( name = "ref_counted", language = "c++", @@ -969,18 +1304,18 @@ grpc_cc_library( "src/core/lib/resource_quota/memory_quota.h", ], deps = [ + "activity", "dual_ref_counted", + "exec_ctx_wakeup_scheduler", "gpr_base", + "loop", "orphanable", + "poll", + "race", "ref_counted_ptr", + "seq", "slice_refcount", "useful", - "//src/core/lib/promise:activity", - "//src/core/lib/promise:exec_ctx_wakeup_scheduler", - "//src/core/lib/promise:loop", - "//src/core/lib/promise:poll", - "//src/core/lib/promise:race", - "//src/core/lib/promise:seq", ], ) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index afa9dbcf8e7..ddfb8e36e7c 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -350,8 +350,6 @@ def grpc_package(name, visibility = "private", features = []): visibility = ["//visibility:public"] elif visibility == "private": visibility = [] - elif visibility == "grpc": - visibility = ["//:__subpackages__"] else: fail("Unknown visibility " + visibility) diff --git a/src/core/lib/promise/BUILD b/src/core/lib/promise/BUILD deleted file mode 100644 index 074671e7ed8..00000000000 --- a/src/core/lib/promise/BUILD +++ /dev/null @@ -1,355 +0,0 @@ -# Copyright 2021 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_package") - -licenses(["notice"]) - -grpc_package( - name = "test/core/promise", - visibility = "grpc", -) - -grpc_cc_library( - name = "poll", - external_deps = [ - "absl/types:variant", - ], - language = "c++", - public_hdrs = [ - "poll.h", - ], - deps = ["//:gpr_platform"], -) - -grpc_cc_library( - name = "context", - language = "c++", - public_hdrs = [ - "context.h", - ], - deps = [ - "//:gpr_platform", - "//:gpr_tls", - ], -) - -grpc_cc_library( - name = "map", - language = "c++", - public_hdrs = ["map.h"], - deps = [ - "poll", - "promise_like", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "promise", - external_deps = [ - "absl/types:optional", - ], - language = "c++", - public_hdrs = [ - "promise.h", - ], - deps = [ - "poll", - "promise_like", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "promise_like", - language = "c++", - public_hdrs = [ - "detail/promise_like.h", - ], - deps = [ - "poll", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "promise_factory", - language = "c++", - public_hdrs = [ - "detail/promise_factory.h", - ], - deps = [ - "poll", - "promise_like", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "if", - external_deps = [ - "absl/status:statusor", - ], - language = "c++", - public_hdrs = ["if.h"], - deps = [ - "poll", - "promise_factory", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "promise_status", - external_deps = [ - "absl/status", - "absl/status:statusor", - ], - language = "c++", - public_hdrs = [ - "detail/status.h", - ], - deps = ["//:gpr_platform"], -) - -grpc_cc_library( - name = "race", - language = "c++", - public_hdrs = ["race.h"], - deps = [ - "poll", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "loop", - language = "c++", - public_hdrs = [ - "loop.h", - ], - deps = [ - "poll", - "promise_factory", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "switch", - language = "c++", - public_hdrs = [ - "detail/switch.h", - ], - deps = ["//:gpr_platform"], -) - -grpc_cc_library( - name = "basic_join", - language = "c++", - public_hdrs = [ - "detail/basic_join.h", - ], - deps = [ - "poll", - "promise_factory", - "//:bitset", - "//:construct_destruct", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "join", - language = "c++", - public_hdrs = [ - "join.h", - ], - deps = [ - "basic_join", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "try_join", - language = "c++", - public_hdrs = [ - "try_join.h", - ], - deps = [ - "basic_join", - "promise_status", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "basic_seq", - language = "c++", - public_hdrs = [ - "detail/basic_seq.h", - ], - deps = [ - "poll", - "promise_factory", - "switch", - "//:construct_destruct", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "seq", - language = "c++", - public_hdrs = [ - "seq.h", - ], - deps = [ - "basic_seq", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "try_seq", - language = "c++", - public_hdrs = [ - "try_seq.h", - ], - deps = [ - "basic_seq", - "promise_status", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "activity", - srcs = [ - "activity.cc", - ], - language = "c++", - public_hdrs = [ - "activity.h", - ], - deps = [ - "context", - "poll", - "promise_factory", - "promise_status", - "//:atomic_utils", - "//:construct_destruct", - "//:gpr_base", - "//:gpr_codegen", - ], -) - -grpc_cc_library( - name = "wait_set", - external_deps = [ - "absl/container:flat_hash_set", - ], - language = "c++", - public_hdrs = [ - "wait_set.h", - ], - deps = [ - "activity", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "intra_activity_waiter", - language = "c++", - public_hdrs = [ - "intra_activity_waiter.h", - ], - deps = [ - "activity", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "latch", - external_deps = [ - "absl/status", - ], - language = "c++", - public_hdrs = [ - "latch.h", - ], - deps = [ - "activity", - "intra_activity_waiter", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "observable", - language = "c++", - public_hdrs = [ - "observable.h", - ], - deps = [ - "activity", - "wait_set", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "pipe", - external_deps = [ - "absl/status", - ], - language = "c++", - public_hdrs = [ - "pipe.h", - ], - deps = [ - "activity", - "intra_activity_waiter", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "for_each", - external_deps = [ - "absl/status", - "absl/types:variant", - ], - language = "c++", - public_hdrs = ["for_each.h"], - deps = [ - "poll", - "promise_factory", - "//:gpr_platform", - ], -) - -grpc_cc_library( - name = "exec_ctx_wakeup_scheduler", - language = "c++", - public_hdrs = ["exec_ctx_wakeup_scheduler.h"], - deps = [ - "//:exec_ctx", - "//:gpr_platform", - ], -) diff --git a/test/core/promise/BUILD b/test/core/promise/BUILD index e022ddab37e..838f21ad1b1 100644 --- a/test/core/promise/BUILD +++ b/test/core/promise/BUILD @@ -39,7 +39,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:poll", + "//:poll", "//test/core/util:grpc_suppressions", ], ) @@ -51,7 +51,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:context", + "//:context", "//test/core/util:grpc_suppressions", ], ) @@ -63,7 +63,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise", + "//:promise", "//test/core/util:grpc_suppressions", ], ) @@ -80,8 +80,8 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise", - "//src/core/lib/promise:map", + "//:map", + "//:promise", "//test/core/util:grpc_suppressions", ], ) @@ -93,7 +93,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:race", + "//:race", "//test/core/util:grpc_suppressions", ], ) @@ -109,8 +109,8 @@ grpc_cc_test( uses_polling = False, deps = [ "//:capture", - "//src/core/lib/promise", - "//src/core/lib/promise:promise_factory", + "//:promise", + "//:promise_factory", "//test/core/util:grpc_suppressions", ], ) @@ -122,7 +122,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:if", + "//:if", "//test/core/util:grpc_suppressions", ], ) @@ -134,8 +134,8 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:loop", - "//src/core/lib/promise:seq", + "//:loop", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -147,7 +147,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:join", + "//:join", "//test/core/util:grpc_suppressions", ], ) @@ -159,7 +159,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:try_join", + "//:try_join", "//test/core/util:grpc_suppressions", ], ) @@ -171,7 +171,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:seq", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -183,7 +183,7 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:try_seq", + "//:try_seq", "//test/core/util:grpc_suppressions", ], ) @@ -196,11 +196,11 @@ grpc_cc_test( uses_polling = False, deps = [ "test_wakeup_schedulers", - "//src/core/lib/promise", - "//src/core/lib/promise:activity", - "//src/core/lib/promise:join", - "//src/core/lib/promise:seq", - "//src/core/lib/promise:wait_set", + "//:activity", + "//:join", + "//:promise", + "//:seq", + "//:wait_set", "//test/core/util:grpc_suppressions", ], ) @@ -213,9 +213,9 @@ grpc_cc_test( uses_polling = False, deps = [ "test_wakeup_schedulers", - "//src/core/lib/promise:join", - "//src/core/lib/promise:latch", - "//src/core/lib/promise:seq", + "//:join", + "//:latch", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -228,9 +228,9 @@ grpc_cc_test( uses_polling = False, deps = [ "test_wakeup_schedulers", - "//src/core/lib/promise", - "//src/core/lib/promise:observable", - "//src/core/lib/promise:seq", + "//:observable", + "//:promise", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -243,12 +243,12 @@ grpc_cc_test( uses_polling = False, deps = [ "test_wakeup_schedulers", - "//src/core/lib/promise:for_each", - "//src/core/lib/promise:join", - "//src/core/lib/promise:map", - "//src/core/lib/promise:observable", - "//src/core/lib/promise:pipe", - "//src/core/lib/promise:seq", + "//:for_each", + "//:join", + "//:map", + "//:observable", + "//:pipe", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -261,10 +261,10 @@ grpc_cc_test( uses_polling = False, deps = [ "test_wakeup_schedulers", - "//src/core/lib/promise", - "//src/core/lib/promise:join", - "//src/core/lib/promise:pipe", - "//src/core/lib/promise:seq", + "//:join", + "//:pipe", + "//:promise", + "//:seq", "//test/core/util:grpc_suppressions", ], ) @@ -278,12 +278,12 @@ grpc_proto_fuzzer( tags = ["no_windows"], uses_polling = False, deps = [ - "//src/core/lib/promise", - "//src/core/lib/promise:activity", - "//src/core/lib/promise:join", - "//src/core/lib/promise:map", - "//src/core/lib/promise:race", - "//src/core/lib/promise:seq", + "//:activity", + "//:join", + "//:map", + "//:promise", + "//:race", + "//:seq", "//test/core/util:grpc_test_util", ], ) @@ -295,8 +295,8 @@ grpc_cc_test( language = "c++", uses_polling = False, deps = [ - "//src/core/lib/promise:activity", - "//src/core/lib/promise:exec_ctx_wakeup_scheduler", + "//:activity", + "//:exec_ctx_wakeup_scheduler", "//test/core/util:grpc_suppressions", ], ) diff --git a/test/core/promise/benchmark/BUILD b/test/core/promise/benchmark/BUILD index 202ae676e49..ad34a1f4091 100644 --- a/test/core/promise/benchmark/BUILD +++ b/test/core/promise/benchmark/BUILD @@ -38,14 +38,14 @@ grpc_cc_test( ], uses_polling = False, deps = [ - "//src/core/lib/promise:activity", - "//src/core/lib/promise:for_each", - "//src/core/lib/promise:join", - "//src/core/lib/promise:latch", - "//src/core/lib/promise:pipe", - "//src/core/lib/promise:seq", - "//src/core/lib/promise:try_join", - "//src/core/lib/promise:try_seq", + "//:activity", + "//:for_each", + "//:join", + "//:latch", + "//:pipe", + "//:seq", + "//:try_join", + "//:try_seq", "//test/core/promise:test_wakeup_schedulers", "//test/core/util:grpc_suppressions", ],