Many changes to support stricter deps
* Split pw_assert targets as in pwrev/9000.
* Add many missing dependencies (mostly on //pw_unit_test)
* Added visibility and licenses to pw_minimal_cpp_stdlib/BUILD
* Used explicit template params in pw_result/result_test.cc
* Added missing #include of pw_kvs/pw_kvs_private/macros.h
Change-Id: I9bdc875b585e47792ca926f7c75cfe055b02fa48
Bug: 101
diff --git a/pw_assert/BUILD b/pw_assert/BUILD
index 4dca3ec..23b25d6 100644
--- a/pw_assert/BUILD
+++ b/pw_assert/BUILD
@@ -32,6 +32,7 @@
],
includes = ["public"],
deps = [
+ PW_ASSERT_BACKEND + ":headers",
"//pw_preprocessor",
],
)
@@ -40,6 +41,13 @@
name = "pw_assert",
deps = [
":facade",
+ PW_ASSERT_BACKEND + ":headers",
+ ],
+)
+
+pw_cc_library(
+ name = "backend",
+ deps = [
PW_ASSERT_BACKEND,
],
)
@@ -47,8 +55,13 @@
pw_cc_test(
name = "test",
srcs = [
- "assert_test.cc",
"assert_test.c",
+ "assert_test.cc",
],
- deps = [":pw_assert"],
+ deps = [
+ ":backend",
+ ":facade",
+ ":pw_assert",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_assert_basic/BUILD b/pw_assert_basic/BUILD
index 418de24..22d063c 100644
--- a/pw_assert_basic/BUILD
+++ b/pw_assert_basic/BUILD
@@ -22,10 +22,7 @@
licenses(["notice"]) # Apache License 2.0
pw_cc_library(
- name = "pw_assert_basic",
- srcs = [
- "assert_basic.cc",
- ],
+ name = "headers",
hdrs = [
"public/pw_assert_basic/assert_basic.h",
"public_overrides/pw_assert_backend/assert_backend.h",
@@ -35,7 +32,19 @@
"public_overrides",
],
deps = [
+ "//pw_preprocessor",
+ ],
+)
+
+pw_cc_library(
+ name = "pw_assert_basic",
+ srcs = [
+ "assert_basic.cc",
+ ],
+ deps = [
+ ":headers",
"//pw_assert:facade",
+ "//pw_preprocessor",
"//pw_string",
"//pw_sys_io",
],
diff --git a/pw_base64/BUILD b/pw_base64/BUILD
index 062556c..67bdfb4 100644
--- a/pw_base64/BUILD
+++ b/pw_base64/BUILD
@@ -44,5 +44,6 @@
],
deps = [
":pw_base64",
+ "//pw_unit_test",
],
)
diff --git a/pw_build/pigweed.bzl b/pw_build/pigweed.bzl
index d68d930..f707063 100644
--- a/pw_build/pigweed.bzl
+++ b/pw_build/pigweed.bzl
@@ -43,10 +43,15 @@
"-Wno-register",
]
+DISABLE_PENDING_WORKAROUND_OPTS = [
+ "-Wno-private-header",
+]
+
PW_DEFAULT_COPTS = (
DEBUGGING +
REDUCED_SIZE_COPTS +
- STRICT_WARNINGS_COPTS
+ STRICT_WARNINGS_COPTS +
+ DISABLE_PENDING_WORKAROUND_OPTS
)
PW_DEFAULT_LINKOPTS = []
diff --git a/pw_checksum/BUILD b/pw_checksum/BUILD
index e2170e4..63c1e2f 100644
--- a/pw_checksum/BUILD
+++ b/pw_checksum/BUILD
@@ -40,5 +40,8 @@
"ccitt_crc16_test.c",
"ccitt_crc16_test.cc",
],
- deps = [":pw_checksum"],
+ deps = [
+ ":pw_checksum",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_containers/BUILD b/pw_containers/BUILD
index ee0f194..3252a5f 100644
--- a/pw_containers/BUILD
+++ b/pw_containers/BUILD
@@ -35,5 +35,8 @@
srcs = [
"vector_test.cc",
],
- deps = ["//pw_containers"],
+ deps = [
+ ":pw_containers",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_kvs/BUILD b/pw_kvs/BUILD
index 3720f93..fd17d66 100644
--- a/pw_kvs/BUILD
+++ b/pw_kvs/BUILD
@@ -55,6 +55,8 @@
"//pw_checksum",
"//pw_containers",
"//pw_log",
+ "//pw_log:facade",
+ "//pw_span",
"//pw_status",
],
)
@@ -67,6 +69,7 @@
deps = [
":pw_kvs",
"//pw_checksum",
+ "//pw_span",
],
)
@@ -82,8 +85,11 @@
includes = ["public"],
visibility = ["//visibility:private"],
deps = [
+ "//pw_containers",
"//pw_kvs",
"//pw_log",
+ "//pw_log:facade",
+ "//pw_span",
"//pw_status",
],
)
@@ -99,8 +105,10 @@
includes = ["public"],
visibility = ["//visibility:private"],
deps = [
+ "//pw_containers",
"//pw_kvs",
"//pw_log",
+ "//pw_log:facade",
"//pw_status",
],
)
@@ -112,6 +120,8 @@
],
deps = [
":pw_kvs",
+ "//pw_status",
+ "//pw_unit_test",
],
)
@@ -123,6 +133,7 @@
":pw_kvs",
"//pw_checksum",
"//pw_log",
+ "//pw_unit_test",
],
)
@@ -135,6 +146,8 @@
":pw_kvs",
":test_utils",
"//pw_log:backend",
+ "//pw_span",
+ "//pw_unit_test",
],
)
@@ -145,6 +158,7 @@
":pw_kvs",
":test_utils",
"//pw_log:backend",
+ "//pw_unit_test",
],
)
@@ -155,7 +169,13 @@
":crc16",
":pw_kvs",
":test_utils",
+ "//pw_checksum",
"//pw_log:backend",
+ "//pw_log:facade",
+ "//pw_span",
+ "//pw_status",
+ "//pw_string",
+ "//pw_unit_test",
],
)
@@ -169,6 +189,7 @@
":pw_kvs",
":test_utils",
"//pw_log:backend",
+ "//pw_unit_test",
],
)
@@ -182,6 +203,7 @@
":test_utils",
"//pw_checksum",
"//pw_log:backend",
+ "//pw_unit_test",
],
)
@@ -195,6 +217,9 @@
":test_utils",
"//pw_checksum",
"//pw_log:backend",
+ "//pw_log:facade",
+ "//pw_span",
+ "//pw_unit_test",
],
)
@@ -205,6 +230,7 @@
":pw_kvs",
":test_utils",
"//pw_log:backend",
+ "//pw_unit_test",
],
)
diff --git a/pw_kvs/pw_kvs_private/macros.h b/pw_kvs/pw_kvs_private/macros.h
index a7f331c..cf4e673 100644
--- a/pw_kvs/pw_kvs_private/macros.h
+++ b/pw_kvs/pw_kvs_private/macros.h
@@ -14,6 +14,7 @@
#pragma once
#include "pw_status/status.h"
+#include "pw_status/status_with_size.h"
// Macros for cleanly working with Status or StatusWithSize objects in functions
// that return Status.
diff --git a/pw_log/BUILD b/pw_log/BUILD
index 0261a6c..312c202 100644
--- a/pw_log/BUILD
+++ b/pw_log/BUILD
@@ -33,6 +33,7 @@
],
includes = ["public"],
deps = [
+ PW_LOG_BACKEND + ":headers",
"//pw_preprocessor",
],
)
@@ -60,6 +61,9 @@
],
deps = [
":backend",
+ ":facade",
":pw_log",
+ "//pw_preprocessor",
+ "//pw_unit_test",
],
)
diff --git a/pw_minimal_cpp_stdlib/BUILD b/pw_minimal_cpp_stdlib/BUILD
index 906ac44..592cab7 100644
--- a/pw_minimal_cpp_stdlib/BUILD
+++ b/pw_minimal_cpp_stdlib/BUILD
@@ -18,6 +18,10 @@
"pw_cc_test",
)
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache License 2.0
+
pw_cc_library(
name = "pw_minimal_cpp_stdlib",
srcs = [
@@ -68,5 +72,6 @@
copts = ["-nostdinc++"],
deps = [
":pw_minimal_cpp_stdlib",
+ "//pw_unit_test",
],
)
diff --git a/pw_polyfill/BUILD b/pw_polyfill/BUILD
index 3c9669d..3e77f6d 100644
--- a/pw_polyfill/BUILD
+++ b/pw_polyfill/BUILD
@@ -63,5 +63,6 @@
],
deps = [
":pw_polyfill",
+ "//pw_unit_test",
],
)
diff --git a/pw_preprocessor/BUILD b/pw_preprocessor/BUILD
index 22c433a..1b937ce 100644
--- a/pw_preprocessor/BUILD
+++ b/pw_preprocessor/BUILD
@@ -39,7 +39,10 @@
pw_cc_test(
name = t,
srcs = [t + ".cc"],
- deps = ["//pw_preprocessor"],
+ deps = [
+ ":pw_preprocessor",
+ "//pw_unit_test",
+ ],
)
for t in TESTS
]
diff --git a/pw_protobuf/BUILD b/pw_protobuf/BUILD
index b0d0902..9935c01 100644
--- a/pw_protobuf/BUILD
+++ b/pw_protobuf/BUILD
@@ -47,19 +47,29 @@
pw_cc_test(
name = "decoder_test",
srcs = ["decoder_test.cc"],
- deps = ["//pw_protobuf"],
+ deps = [
+ ":pw_protobuf",
+ "//pw_preprocessor",
+ "//pw_unit_test",
+ ],
)
pw_cc_test(
name = "encoder_test",
srcs = ["encoder_test.cc"],
- deps = ["//pw_protobuf"],
+ deps = [
+ ":pw_protobuf",
+ "//pw_unit_test",
+ ],
)
pw_cc_test(
name = "find_test",
srcs = ["find_test.cc"],
- deps = ["//pw_protobuf"],
+ deps = [
+ ":pw_protobuf",
+ "//pw_unit_test",
+ ],
)
# TODO(frolv): Figure out how to integrate pw_protobuf codegen into Bazel.
diff --git a/pw_result/BUILD b/pw_result/BUILD
index b296313..d4d0750 100644
--- a/pw_result/BUILD
+++ b/pw_result/BUILD
@@ -28,10 +28,16 @@
"public/pw_result/result.h",
],
includes = ["public"],
+ deps = [
+ "//pw_status",
+ ],
)
pw_cc_test(
name = "result_test",
- srcs = [ "result_test.cc" ],
- deps = ["//pw_result"],
+ srcs = ["result_test.cc"],
+ deps = [
+ ":pw_result",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_result/result_test.cc b/pw_result/result_test.cc
index cad7ae4..b29c240 100644
--- a/pw_result/result_test.cc
+++ b/pw_result/result_test.cc
@@ -61,13 +61,13 @@
}
TEST(Divide, ReturnOk) {
- Result res = Divide(10, 5);
+ Result<float> res = Divide(10, 5);
ASSERT_TRUE(res.ok());
EXPECT_EQ(res.value(), 2.0f);
}
TEST(Divide, ReturnNotOk) {
- Result res = Divide(10, 0);
+ Result<float> res = Divide(10, 0);
EXPECT_FALSE(res.ok());
EXPECT_EQ(res.status(), Status::INVALID_ARGUMENT);
}
diff --git a/pw_span/BUILD b/pw_span/BUILD
index 4aa744e..47129f2 100644
--- a/pw_span/BUILD
+++ b/pw_span/BUILD
@@ -32,5 +32,8 @@
pw_cc_test(
name = "span_test",
srcs = ["span_test.cc"],
- deps = ["//pw_span"],
+ deps = [
+ ":pw_span",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_status/BUILD b/pw_status/BUILD
index 0dd9e6b..1ffb738 100644
--- a/pw_status/BUILD
+++ b/pw_status/BUILD
@@ -38,11 +38,17 @@
"status_test.c",
"status_test.cc",
],
- deps = ["//pw_status"],
+ deps = [
+ ":pw_status",
+ "//pw_unit_test",
+ ],
)
pw_cc_test(
name = "status_with_size_test",
srcs = ["status_with_size_test.cc"],
- deps = ["//pw_status"],
+ deps = [
+ ":pw_status",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_string/BUILD b/pw_string/BUILD
index 72cbcaf..0347936 100644
--- a/pw_string/BUILD
+++ b/pw_string/BUILD
@@ -48,22 +48,27 @@
name = "format_test",
srcs = ["format_test.cc"],
deps = [
+ ":pw_string",
"//pw_span",
- "//pw_string",
+ "//pw_unit_test",
],
)
pw_cc_test(
name = "type_to_string_test",
srcs = ["type_to_string_test.cc"],
- deps = ["//pw_string"],
+ deps = [
+ ":pw_string",
+ "//pw_unit_test",
+ ],
)
pw_cc_test(
name = "string_builder_test",
srcs = ["string_builder_test.cc"],
deps = [
- "//pw_string",
+ ":pw_string",
+ "//pw_unit_test",
],
)
@@ -71,13 +76,17 @@
name = "to_string_test",
srcs = ["to_string_test.cc"],
deps = [
+ ":pw_string",
"//pw_status",
- "//pw_string",
+ "//pw_unit_test",
],
)
pw_cc_test(
name = "util_test",
srcs = ["util_test.cc"],
- deps = ["//pw_string"],
+ deps = [
+ ":pw_string",
+ "//pw_unit_test",
+ ],
)
diff --git a/pw_tokenizer/BUILD b/pw_tokenizer/BUILD
index e03fdee..a83c6ce 100644
--- a/pw_tokenizer/BUILD
+++ b/pw_tokenizer/BUILD
@@ -42,6 +42,7 @@
],
includes = ["public"],
deps = [
+ "//pw_polyfill",
"//pw_preprocessor",
"//pw_span",
"//pw_varint",
@@ -94,6 +95,7 @@
":decoder",
":pw_tokenizer",
"//pw_preprocessor",
+ "//pw_span",
"//pw_varint",
],
)
@@ -121,6 +123,8 @@
],
deps = [
":pw_tokenizer",
+ "//pw_preprocessor",
+ "//pw_unit_test",
],
)
@@ -131,6 +135,8 @@
],
deps = [
":base64",
+ "//pw_span",
+ "//pw_unit_test",
],
)
@@ -143,6 +149,7 @@
],
deps = [
":decoder",
+ "//pw_unit_test",
"//pw_varint",
],
)
@@ -154,6 +161,7 @@
],
deps = [
":decoder",
+ "//pw_unit_test",
],
)
@@ -165,6 +173,8 @@
],
deps = [
":pw_tokenizer",
+ "//pw_preprocessor",
+ "//pw_unit_test",
],
)
@@ -175,6 +185,7 @@
],
deps = [
":pw_tokenizer",
+ "//pw_unit_test",
],
)
@@ -185,6 +196,7 @@
],
deps = [
":decoder",
+ "//pw_unit_test",
],
)
@@ -197,6 +209,8 @@
],
deps = [
":pw_tokenizer",
+ "//pw_preprocessor",
+ "//pw_unit_test",
"//pw_varint",
],
)
diff --git a/pw_unit_test/BUILD b/pw_unit_test/BUILD
index 053653c..ccc8e49 100644
--- a/pw_unit_test/BUILD
+++ b/pw_unit_test/BUILD
@@ -81,6 +81,7 @@
deps = [
":pw_unit_test",
":simple_printing_event_handler",
+ "//pw_span",
"//pw_sys_io",
],
)
@@ -88,4 +89,7 @@
pw_cc_test(
name = "framework_test",
srcs = ["framework_test.cc"],
+ deps = [
+ ":pw_unit_test",
+ ],
)
diff --git a/pw_varint/BUILD b/pw_varint/BUILD
index 78bc286..6efb177 100644
--- a/pw_varint/BUILD
+++ b/pw_varint/BUILD
@@ -32,6 +32,7 @@
],
includes = ["public"],
deps = [
+ "//pw_polyfill",
"//pw_span",
],
)
@@ -42,5 +43,8 @@
"varint_test.c",
"varint_test.cc",
],
- deps = ["//pw_varint"],
+ deps = [
+ ":pw_varint",
+ "//pw_unit_test",
+ ],
)