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