1# Copyright 2023 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_rust//rust:defs.bzl", "rust_doc", "rust_doc_test", "rust_library", "rust_proc_macro", "rust_test") 16load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 17 18rust_library( 19 name = "pw_format_core", 20 srcs = [ 21 "pw_format_core.rs", 22 ], 23 visibility = ["//visibility:public"], 24 deps = [ 25 "//pw_status/rust:pw_status", 26 ], 27) 28 29rust_library( 30 name = "pw_format", 31 srcs = [ 32 "pw_format/core_fmt.rs", 33 "pw_format/lib.rs", 34 "pw_format/macros.rs", 35 "pw_format/printf.rs", 36 "pw_format/tests/core_fmt.rs", 37 "pw_format/tests/mod.rs", 38 "pw_format/tests/printf.rs", 39 ], 40 visibility = ["//visibility:public"], 41 deps = [ 42 ":pw_format_core", 43 "//pw_status/rust:pw_status", 44 "@rust_crates//:nom", 45 "@rust_crates//:proc-macro2", 46 "@rust_crates//:quote", 47 "@rust_crates//:syn", 48 ], 49) 50 51rust_test( 52 name = "pw_format_test", 53 crate = ":pw_format", 54 # TODO: b/343726867 - support on-device rust tests 55 target_compatible_with = incompatible_with_mcu(), 56) 57 58rust_doc_test( 59 name = "pw_format_doc_test", 60 crate = ":pw_format", 61 deps = ["//pw_bytes/rust:pw_bytes"], 62) 63 64rust_doc( 65 name = "pw_format_doc", 66 crate = ":pw_format", 67 target_compatible_with = incompatible_with_mcu(), 68) 69 70rust_proc_macro( 71 name = "pw_format_example_macro", 72 srcs = [ 73 "pw_format_example_macro.rs", 74 ], 75 visibility = ["//visibility:public"], 76 deps = [ 77 ":pw_format", 78 "//pw_status/rust:pw_status", 79 "@rust_crates//:proc-macro2", 80 "@rust_crates//:quote", 81 "@rust_crates//:syn", 82 ], 83) 84 85rust_library( 86 name = "pw_format_example_macro_test", 87 srcs = [ 88 "pw_format_example_macro_test.rs", 89 ], 90 proc_macro_deps = [ 91 ":pw_format_example_macro", 92 ], 93 tags = ["manual"], 94 visibility = ["//visibility:public"], 95) 96 97rust_test( 98 name = "pw_format_example_macro_test_test", 99 crate = ":pw_format_example_macro_test", 100 # TODO: b/343726867 - support on-device rust tests 101 target_compatible_with = incompatible_with_mcu(), 102) 103 104rust_proc_macro( 105 name = "pw_format_test_macros", 106 srcs = [ 107 "pw_format_test_macros.rs", 108 ], 109 visibility = ["//visibility:public"], 110 deps = [ 111 ":pw_format", 112 "//pw_status/rust:pw_status", 113 "@rust_crates//:proc-macro2", 114 "@rust_crates//:quote", 115 "@rust_crates//:syn", 116 ], 117) 118 119rust_library( 120 name = "pw_format_test_macros_printf_test", 121 srcs = [ 122 "pw_format_test_macros_printf_test.rs", 123 ], 124 proc_macro_deps = [ 125 ":pw_format_test_macros", 126 ], 127 visibility = ["//visibility:public"], 128 deps = [ 129 ":pw_format", 130 ":pw_format_core", 131 "//pw_bytes/rust:pw_bytes", 132 ], 133) 134 135rust_test( 136 name = "pw_format_test_macros_printf_test_test", 137 crate = ":pw_format_test_macros_printf_test", 138 # TODO: b/343726867 - support on-device rust tests 139 target_compatible_with = incompatible_with_mcu(), 140) 141 142rust_library( 143 name = "pw_format_test_macros_core_fmt_test", 144 srcs = [ 145 "pw_format_test_macros_core_fmt_test.rs", 146 ], 147 proc_macro_deps = [ 148 ":pw_format_test_macros", 149 ], 150 visibility = ["//visibility:public"], 151 deps = [ 152 ":pw_format", 153 ":pw_format_core", 154 "//pw_bytes/rust:pw_bytes", 155 ], 156) 157 158rust_test( 159 name = "pw_format_test_macros_core_fmt_test_test", 160 crate = ":pw_format_test_macros_core_fmt_test", 161 # TODO: b/343726867 - support on-device rust tests 162 target_compatible_with = incompatible_with_mcu(), 163) 164