| # Copyright 2025 The Pigweed 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 |
| # |
| # https://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("@sphinxdocs//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") |
| load("//pw_build:compatibility.bzl", "incompatible_with_mcu", "minimum_cxx_20") |
| load("//pw_build:pw_cc_binary.bzl", "pw_cc_binary") |
| load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") |
| |
| package( |
| default_visibility = ["//visibility:public"], |
| features = ["-layering_check"], |
| ) |
| |
| licenses(["notice"]) |
| |
| pw_cc_test( |
| name = "basic", |
| srcs = [ |
| "basic_coro.cc", |
| "basic_manual.cc", |
| ], |
| deps = [ |
| "//pw_allocator:testing", |
| "//pw_async2", |
| "//pw_async2:channel", |
| "//pw_async2:coro", |
| "//pw_async2:testing", |
| ], |
| ) |
| |
| # count-example-start |
| pw_cc_binary( |
| name = "count", |
| srcs = ["count.cc"], |
| target_compatible_with = incompatible_with_mcu(), |
| deps = [ |
| "//pw_allocator:libc_allocator", |
| "//pw_assert:check", |
| "//pw_async2", |
| "//pw_async2:basic_dispatcher", |
| "//pw_async2:coro", |
| "//pw_async2:system_time_provider", |
| "//pw_chrono:system_clock", |
| "//pw_log", |
| ], |
| ) |
| # count-example-end |
| |
| pw_cc_test( |
| name = "channel", |
| srcs = ["channel.cc"], |
| target_compatible_with = minimum_cxx_20(), |
| deps = [ |
| "//pw_allocator:testing", |
| "//pw_async2", |
| "//pw_async2:channel", |
| "//pw_async2:coro", |
| "//pw_async2:testing", |
| "//pw_containers:vector", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "coro_blinky_loop", |
| srcs = ["coro_blinky_loop.cc"], |
| deps = [ |
| "//pw_allocator:testing", |
| "//pw_async2", |
| "//pw_async2:coro", |
| "//pw_async2:simulated_time_provider", |
| "//pw_async2:testing", |
| "//pw_async2:time_provider", |
| "//pw_chrono:system_clock", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "task_helpers", |
| srcs = ["task_helpers.cc"], |
| deps = [ |
| "//pw_allocator:synchronized_allocator", |
| "//pw_allocator:testing", |
| "//pw_assert:check", |
| "//pw_async2", |
| "//pw_async2:testing", |
| "//pw_async2:value_future", |
| "//pw_sync:mutex", |
| "//pw_thread:test_thread_context", |
| "//pw_thread:thread", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "timeout_test", |
| srcs = ["timeout_test.cc"], |
| target_compatible_with = incompatible_with_mcu(), |
| deps = [ |
| "//pw_allocator:libc_allocator", |
| "//pw_assert:check", |
| "//pw_async2", |
| "//pw_async2:basic_dispatcher", |
| "//pw_async2:coro", |
| "//pw_async2:future_timeout", |
| "//pw_async2:select", |
| "//pw_async2:system_time_provider", |
| "//pw_containers:vector", |
| "//pw_log", |
| "//pw_result", |
| "//pw_status", |
| "//pw_string", |
| ], |
| ) |
| |
| pw_cc_binary( |
| name = "interrupt", |
| srcs = ["interrupt.cc"], |
| target_compatible_with = select({ |
| "@platforms//os:linux": [], |
| "@platforms//os:macos": [], |
| "//conditions:default": ["@platforms//:incompatible"], |
| }), |
| deps = [ |
| "//pw_async2:basic_dispatcher", |
| "//pw_async2:value_future", |
| "//pw_containers:inline_queue", |
| "//pw_log", |
| "//pw_sync:interrupt_spin_lock", |
| "//pw_sync:mutex", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "unit_test", |
| srcs = ["unit_test.cc"], |
| deps = [ |
| "//pw_allocator:testing", |
| "//pw_async2", |
| "//pw_async2:testing", |
| "//pw_async2:value_future", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "custom_future", |
| srcs = ["custom_future.cc"], |
| deps = [ |
| "//pw_assert:check", |
| "//pw_async2", |
| "//pw_async2:basic_dispatcher", |
| "//pw_digital_io", |
| "//pw_sync:interrupt_spin_lock", |
| "//pw_sync:lock_annotations", |
| "//pw_unit_test", |
| ], |
| ) |
| |
| # DOCSTAG: [quickstart] |
| pw_cc_test( |
| name = "quickstart", |
| srcs = ["quickstart.cc"], |
| deps = [ |
| "//pw_async2", |
| "//pw_async2:basic_dispatcher", |
| "//pw_async2:system_time_provider", |
| "//pw_log", |
| "//pw_unit_test", |
| ], |
| ) |
| # DOCSTAG: [quickstart] |
| |
| pw_cc_test( |
| name = "futures", |
| srcs = ["futures.cc"], |
| deps = [ |
| "//pw_allocator:testing", |
| "//pw_async2", |
| "//pw_async2:coro", |
| "//pw_async2:future_timeout", |
| "//pw_async2:join", |
| "//pw_async2:select", |
| "//pw_async2:testing", |
| "//pw_async2:value_future", |
| "//pw_log", |
| "//pw_status", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "motivation", |
| srcs = ["motivation.cc"], |
| target_compatible_with = incompatible_with_mcu() + minimum_cxx_20(), |
| deps = [ |
| "//pw_async2", |
| "//pw_async2:channel", |
| "//pw_async2:coro", |
| "//pw_async2:join", |
| "//pw_async2:notification", |
| "//pw_async2:select", |
| "//pw_async2:system_time_provider", |
| "//pw_async2:time_provider", |
| "//pw_async2:value_future", |
| "//pw_chrono:system_clock", |
| "//pw_function", |
| "//pw_result", |
| "//pw_status", |
| "//pw_sync:mutex", |
| "//pw_thread:sleep", |
| "//pw_thread:thread", |
| "//pw_unit_test", |
| "//pw_work_queue", |
| ], |
| ) |
| |
| sphinx_docs_library( |
| name = "docs", |
| srcs = [ |
| "BUILD.bazel", |
| "basic_coro.cc", |
| "basic_manual.cc", |
| "channel.cc", |
| "coro_blinky_loop.cc", |
| "count.cc", |
| "custom_future.cc", |
| "futures.cc", |
| "interrupt.cc", |
| "motivation.cc", |
| "quickstart.cc", |
| "unit_test.cc", |
| ], |
| target_compatible_with = incompatible_with_mcu(), |
| ) |
| |
| exports_files([ |
| "channel.cc", |
| "custom_future.cc", |
| ]) |