1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors 2*61c4878aSAndroid Build Coastguard Worker# 3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of 5*61c4878aSAndroid Build Coastguard Worker# the License at 6*61c4878aSAndroid Build Coastguard Worker# 7*61c4878aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*61c4878aSAndroid Build Coastguard Worker# 9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 13*61c4878aSAndroid Build Coastguard Worker# the License. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Workerload("//pw_build:compatibility.bzl", "boolean_constraint_value", "incompatible_with_mcu") 16*61c4878aSAndroid Build Coastguard Workerload("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 17*61c4878aSAndroid Build Coastguard Worker 18*61c4878aSAndroid Build Coastguard Workerpackage(default_visibility = ["//visibility:public"]) 19*61c4878aSAndroid Build Coastguard Worker 20*61c4878aSAndroid Build Coastguard Workerlicenses(["notice"]) 21*61c4878aSAndroid Build Coastguard Worker 22*61c4878aSAndroid Build Coastguard Workercc_library( 23*61c4878aSAndroid Build Coastguard Worker name = "pw_stream", 24*61c4878aSAndroid Build Coastguard Worker srcs = [ 25*61c4878aSAndroid Build Coastguard Worker "memory_stream.cc", 26*61c4878aSAndroid Build Coastguard Worker ], 27*61c4878aSAndroid Build Coastguard Worker hdrs = [ 28*61c4878aSAndroid Build Coastguard Worker "public/pw_stream/memory_stream.h", 29*61c4878aSAndroid Build Coastguard Worker "public/pw_stream/null_stream.h", 30*61c4878aSAndroid Build Coastguard Worker "public/pw_stream/seek.h", 31*61c4878aSAndroid Build Coastguard Worker "public/pw_stream/stream.h", 32*61c4878aSAndroid Build Coastguard Worker ], 33*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 34*61c4878aSAndroid Build Coastguard Worker deps = [ 35*61c4878aSAndroid Build Coastguard Worker "//pw_assert", 36*61c4878aSAndroid Build Coastguard Worker "//pw_bytes", 37*61c4878aSAndroid Build Coastguard Worker "//pw_polyfill", 38*61c4878aSAndroid Build Coastguard Worker "//pw_result", 39*61c4878aSAndroid Build Coastguard Worker "//pw_span", 40*61c4878aSAndroid Build Coastguard Worker "//pw_status", 41*61c4878aSAndroid Build Coastguard Worker "//pw_toolchain:sibling_cast", 42*61c4878aSAndroid Build Coastguard Worker ], 43*61c4878aSAndroid Build Coastguard Worker) 44*61c4878aSAndroid Build Coastguard Worker 45*61c4878aSAndroid Build Coastguard Workerboolean_constraint_value(name = "socket_stream_compatible") 46*61c4878aSAndroid Build Coastguard Worker 47*61c4878aSAndroid Build Coastguard Workercc_library( 48*61c4878aSAndroid Build Coastguard Worker name = "socket_stream", 49*61c4878aSAndroid Build Coastguard Worker srcs = ["socket_stream.cc"], 50*61c4878aSAndroid Build Coastguard Worker hdrs = ["public/pw_stream/socket_stream.h"], 51*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 52*61c4878aSAndroid Build Coastguard Worker target_compatible_with = incompatible_with_mcu(unless_platform_has = ":socket_stream_compatible"), 53*61c4878aSAndroid Build Coastguard Worker deps = [ 54*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 55*61c4878aSAndroid Build Coastguard Worker "//pw_log", 56*61c4878aSAndroid Build Coastguard Worker "//pw_string", 57*61c4878aSAndroid Build Coastguard Worker "//pw_sync:mutex", 58*61c4878aSAndroid Build Coastguard Worker "//pw_sys_io", 59*61c4878aSAndroid Build Coastguard Worker ], 60*61c4878aSAndroid Build Coastguard Worker) 61*61c4878aSAndroid Build Coastguard Worker 62*61c4878aSAndroid Build Coastguard Workercc_library( 63*61c4878aSAndroid Build Coastguard Worker name = "sys_io_stream", 64*61c4878aSAndroid Build Coastguard Worker hdrs = ["public/pw_stream/sys_io_stream.h"], 65*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 66*61c4878aSAndroid Build Coastguard Worker deps = [ 67*61c4878aSAndroid Build Coastguard Worker "//pw_stream", 68*61c4878aSAndroid Build Coastguard Worker "//pw_sys_io", 69*61c4878aSAndroid Build Coastguard Worker ], 70*61c4878aSAndroid Build Coastguard Worker) 71*61c4878aSAndroid Build Coastguard Worker 72*61c4878aSAndroid Build Coastguard Workercc_library( 73*61c4878aSAndroid Build Coastguard Worker name = "std_file_stream", 74*61c4878aSAndroid Build Coastguard Worker srcs = ["std_file_stream.cc"], 75*61c4878aSAndroid Build Coastguard Worker hdrs = ["public/pw_stream/std_file_stream.h"], 76*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 77*61c4878aSAndroid Build Coastguard Worker target_compatible_with = incompatible_with_mcu(), 78*61c4878aSAndroid Build Coastguard Worker deps = [ 79*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 80*61c4878aSAndroid Build Coastguard Worker "//pw_assert", 81*61c4878aSAndroid Build Coastguard Worker ], 82*61c4878aSAndroid Build Coastguard Worker) 83*61c4878aSAndroid Build Coastguard Worker 84*61c4878aSAndroid Build Coastguard Workercc_library( 85*61c4878aSAndroid Build Coastguard Worker name = "interval_reader", 86*61c4878aSAndroid Build Coastguard Worker srcs = ["interval_reader.cc"], 87*61c4878aSAndroid Build Coastguard Worker hdrs = ["public/pw_stream/interval_reader.h"], 88*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 89*61c4878aSAndroid Build Coastguard Worker deps = [":pw_stream"], 90*61c4878aSAndroid Build Coastguard Worker) 91*61c4878aSAndroid Build Coastguard Worker 92*61c4878aSAndroid Build Coastguard Workercc_library( 93*61c4878aSAndroid Build Coastguard Worker name = "mpsc_stream", 94*61c4878aSAndroid Build Coastguard Worker srcs = ["mpsc_stream.cc"], 95*61c4878aSAndroid Build Coastguard Worker hdrs = ["public/pw_stream/mpsc_stream.h"], 96*61c4878aSAndroid Build Coastguard Worker strip_include_prefix = "public", 97*61c4878aSAndroid Build Coastguard Worker deps = [ 98*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 99*61c4878aSAndroid Build Coastguard Worker "//pw_assert", 100*61c4878aSAndroid Build Coastguard Worker "//pw_bytes", 101*61c4878aSAndroid Build Coastguard Worker "//pw_chrono:system_clock.facade", 102*61c4878aSAndroid Build Coastguard Worker "//pw_containers:intrusive_list", 103*61c4878aSAndroid Build Coastguard Worker "//pw_function", 104*61c4878aSAndroid Build Coastguard Worker "//pw_status", 105*61c4878aSAndroid Build Coastguard Worker "//pw_sync:lock_annotations", 106*61c4878aSAndroid Build Coastguard Worker "//pw_sync:mutex", 107*61c4878aSAndroid Build Coastguard Worker "//pw_sync:timed_thread_notification", 108*61c4878aSAndroid Build Coastguard Worker ], 109*61c4878aSAndroid Build Coastguard Worker) 110*61c4878aSAndroid Build Coastguard Worker 111*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 112*61c4878aSAndroid Build Coastguard Worker name = "memory_stream_test", 113*61c4878aSAndroid Build Coastguard Worker srcs = ["memory_stream_test.cc"], 114*61c4878aSAndroid Build Coastguard Worker deps = [ 115*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 116*61c4878aSAndroid Build Coastguard Worker "//pw_assert", 117*61c4878aSAndroid Build Coastguard Worker "//pw_status", 118*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 119*61c4878aSAndroid Build Coastguard Worker ], 120*61c4878aSAndroid Build Coastguard Worker) 121*61c4878aSAndroid Build Coastguard Worker 122*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 123*61c4878aSAndroid Build Coastguard Worker name = "null_stream_test", 124*61c4878aSAndroid Build Coastguard Worker srcs = ["null_stream_test.cc"], 125*61c4878aSAndroid Build Coastguard Worker deps = [ 126*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 127*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 128*61c4878aSAndroid Build Coastguard Worker ], 129*61c4878aSAndroid Build Coastguard Worker) 130*61c4878aSAndroid Build Coastguard Worker 131*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 132*61c4878aSAndroid Build Coastguard Worker name = "std_file_stream_test", 133*61c4878aSAndroid Build Coastguard Worker srcs = ["std_file_stream_test.cc"], 134*61c4878aSAndroid Build Coastguard Worker target_compatible_with = incompatible_with_mcu(), 135*61c4878aSAndroid Build Coastguard Worker deps = [ 136*61c4878aSAndroid Build Coastguard Worker ":std_file_stream", 137*61c4878aSAndroid Build Coastguard Worker "//pw_assert", 138*61c4878aSAndroid Build Coastguard Worker "//pw_bytes", 139*61c4878aSAndroid Build Coastguard Worker "//pw_containers", 140*61c4878aSAndroid Build Coastguard Worker "//pw_random", 141*61c4878aSAndroid Build Coastguard Worker "//pw_result", 142*61c4878aSAndroid Build Coastguard Worker "//pw_status", 143*61c4878aSAndroid Build Coastguard Worker "//pw_string", 144*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 145*61c4878aSAndroid Build Coastguard Worker ], 146*61c4878aSAndroid Build Coastguard Worker) 147*61c4878aSAndroid Build Coastguard Worker 148*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 149*61c4878aSAndroid Build Coastguard Worker name = "seek_test", 150*61c4878aSAndroid Build Coastguard Worker srcs = ["seek_test.cc"], 151*61c4878aSAndroid Build Coastguard Worker deps = [ 152*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 153*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 154*61c4878aSAndroid Build Coastguard Worker ], 155*61c4878aSAndroid Build Coastguard Worker) 156*61c4878aSAndroid Build Coastguard Worker 157*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 158*61c4878aSAndroid Build Coastguard Worker name = "stream_test", 159*61c4878aSAndroid Build Coastguard Worker srcs = ["stream_test.cc"], 160*61c4878aSAndroid Build Coastguard Worker deps = [ 161*61c4878aSAndroid Build Coastguard Worker ":pw_stream", 162*61c4878aSAndroid Build Coastguard Worker "//pw_bytes", 163*61c4878aSAndroid Build Coastguard Worker "//pw_containers:to_array", 164*61c4878aSAndroid Build Coastguard Worker "//pw_span", 165*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 166*61c4878aSAndroid Build Coastguard Worker ], 167*61c4878aSAndroid Build Coastguard Worker) 168*61c4878aSAndroid Build Coastguard Worker 169*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 170*61c4878aSAndroid Build Coastguard Worker name = "interval_reader_test", 171*61c4878aSAndroid Build Coastguard Worker srcs = ["interval_reader_test.cc"], 172*61c4878aSAndroid Build Coastguard Worker deps = [ 173*61c4878aSAndroid Build Coastguard Worker ":interval_reader", 174*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 175*61c4878aSAndroid Build Coastguard Worker ], 176*61c4878aSAndroid Build Coastguard Worker) 177*61c4878aSAndroid Build Coastguard Worker 178*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 179*61c4878aSAndroid Build Coastguard Worker name = "socket_stream_test", 180*61c4878aSAndroid Build Coastguard Worker srcs = ["socket_stream_test.cc"], 181*61c4878aSAndroid Build Coastguard Worker deps = [ 182*61c4878aSAndroid Build Coastguard Worker ":socket_stream", 183*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 184*61c4878aSAndroid Build Coastguard Worker ], 185*61c4878aSAndroid Build Coastguard Worker) 186*61c4878aSAndroid Build Coastguard Worker 187*61c4878aSAndroid Build Coastguard Workerpw_cc_test( 188*61c4878aSAndroid Build Coastguard Worker name = "mpsc_stream_test", 189*61c4878aSAndroid Build Coastguard Worker srcs = ["mpsc_stream_test.cc"], 190*61c4878aSAndroid Build Coastguard Worker # TODO: b/361369435 - This test crashes on rp2. 191*61c4878aSAndroid Build Coastguard Worker target_compatible_with = select({ 192*61c4878aSAndroid Build Coastguard Worker "@pico-sdk//bazel/constraint:rp2040": ["@platforms//:incompatible"], 193*61c4878aSAndroid Build Coastguard Worker "@pico-sdk//bazel/constraint:rp2350": ["@platforms//:incompatible"], 194*61c4878aSAndroid Build Coastguard Worker "//conditions:default": [], 195*61c4878aSAndroid Build Coastguard Worker }), 196*61c4878aSAndroid Build Coastguard Worker deps = [ 197*61c4878aSAndroid Build Coastguard Worker ":mpsc_stream", 198*61c4878aSAndroid Build Coastguard Worker "//pw_containers:vector", 199*61c4878aSAndroid Build Coastguard Worker "//pw_fuzzer:fuzztest", 200*61c4878aSAndroid Build Coastguard Worker "//pw_random", 201*61c4878aSAndroid Build Coastguard Worker "//pw_thread:test_thread_context", 202*61c4878aSAndroid Build Coastguard Worker "//pw_thread:thread", 203*61c4878aSAndroid Build Coastguard Worker "//pw_unit_test", 204*61c4878aSAndroid Build Coastguard Worker ], 205*61c4878aSAndroid Build Coastguard Worker) 206*61c4878aSAndroid Build Coastguard Worker 207*61c4878aSAndroid Build Coastguard Workerfilegroup( 208*61c4878aSAndroid Build Coastguard Worker name = "doxygen", 209*61c4878aSAndroid Build Coastguard Worker srcs = [ 210*61c4878aSAndroid Build Coastguard Worker "public/pw_stream/stream.h", 211*61c4878aSAndroid Build Coastguard Worker ], 212*61c4878aSAndroid Build Coastguard Worker) 213