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("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 19 20package(default_visibility = ["//visibility:public"]) 21 22licenses(["notice"]) 23 24cc_library( 25 name = "pw_result", 26 hdrs = [ 27 "public/pw_result/internal/result_internal.h", 28 "public/pw_result/result.h", 29 ], 30 strip_include_prefix = "public", 31 deps = [ 32 "//pw_assert:assert", 33 "//pw_preprocessor", 34 "//pw_status", 35 ], 36) 37 38cc_library( 39 name = "expected", 40 hdrs = [ 41 "public/pw_result/expected.h", 42 "public/pw_result/internal/expected_impl.h", 43 ], 44 strip_include_prefix = "public", 45) 46 47pw_cc_test( 48 name = "result_test", 49 srcs = ["result_test.cc"], 50 deps = [ 51 ":pw_result", 52 "//pw_status", 53 ], 54) 55 56pw_cc_test( 57 name = "expected_test", 58 srcs = ["expected_test.cc"], 59 deps = [":expected"], 60) 61 62pw_cc_test( 63 name = "statusor_test", 64 srcs = ["statusor_test.cc"], 65 deps = [ 66 ":pw_result", 67 "//pw_status", 68 ], 69) 70 71sphinx_docs_library( 72 name = "docs", 73 srcs = [ 74 "Kconfig", 75 "docs.rst", 76 ], 77 prefix = "pw_result/", 78 target_compatible_with = incompatible_with_mcu(), 79) 80