Skip to content

Commit

Permalink
rp2040: Support bazel wildcard build on rp2040
Browse files Browse the repository at this point in the history
- adds bazel wildcard build support for rp2040
- adds bazel wildcard build support for stm32f429i

Bug: b/343467774,
Fixes: b/342635817, b/343531849, b/343480404
Change-Id: I2cbb3c214760ab7dad81bcfc1ae648f6aaf8d253
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/213071
Presubmit-Verified: CQ Bot Account <[email protected]>
Reviewed-by: Ted Pudlik <[email protected]>
Lint: Lint 🤖 <[email protected]>
Reviewed-by: Keir Mierle <[email protected]>
Commit-Queue: Dave Roth <[email protected]>
  • Loading branch information
davexroth authored and CQ Bot Account committed Jun 4, 2024
1 parent dea891a commit 76902e6
Show file tree
Hide file tree
Showing 42 changed files with 225 additions and 34 deletions.
5 changes: 5 additions & 0 deletions pw_analog/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -54,6 +55,8 @@ cc_library(
"public/pw_analog/microvolt_input_gmock.h",
],
includes = ["public"],
# TODO: b/310957361 - gtest not supported on device
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":microvolt_input",
"@com_google_googletest//:gtest",
Expand All @@ -67,6 +70,8 @@ cc_library(
"public/pw_analog/analog_input_gmock.h",
],
includes = ["public"],
# TODO: b/310957361 - gtest not supported on device
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":analog_input",
"@com_google_googletest//:gtest",
Expand Down
3 changes: 3 additions & 0 deletions pw_async2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -105,6 +106,8 @@ pw_cc_test(
pw_cc_test(
name = "dispatcher_thread_test",
srcs = ["dispatcher_thread_test.cc"],
# TODO: b/343776738 - update to run on all compatible devices
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":dispatcher",
"@pigweed//pw_function",
Expand Down
3 changes: 3 additions & 0 deletions pw_async_basic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -81,6 +82,8 @@ cc_library(
pw_cc_test(
name = "dispatcher_test",
srcs = ["dispatcher_test.cc"],
# TODO: b/343776800 - update to run on all compatible devices
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":dispatcher",
"//pw_log",
Expand Down
4 changes: 4 additions & 0 deletions pw_base64/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# the License.

load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -41,9 +42,12 @@ rust_test(
"@rust_crates//:std": ["std"],
"//conditions:default": [""],
}),
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_doc_test(
name = "pw_base64_doc_test",
crate = ":pw_base64",
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)
3 changes: 3 additions & 0 deletions pw_bloat/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_binary",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(default_visibility = ["//visibility:public"])

Expand All @@ -28,6 +29,7 @@ cc_library(
srcs = ["bloat_this_binary.cc"],
hdrs = ["public/pw_bloat/bloat_this_binary.h"],
includes = ["public"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
"//pw_assert",
"//pw_log",
Expand All @@ -38,5 +40,6 @@ cc_library(
pw_cc_binary(
name = "bloat_base",
srcs = ["base_main.cc"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [":bloat_this_binary"],
)
3 changes: 3 additions & 0 deletions pw_bluetooth_sapphire/fuchsia/bt_host/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ load(
"fuchsia_licenses_collection",
"fuchsia_licenses_spdx",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

package(
default_applicable_licenses = ["//pw_bluetooth_sapphire/fuchsia:license_fuchsia"],
Expand Down Expand Up @@ -67,6 +68,8 @@ fuchsia_cc_test(
name = "hello_gtest",
size = "small",
srcs = ["hello_gtest.cc"],
# TODO: b/310957361 - gtest not supported on device
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
"@com_google_googletest//:gtest_main",
"@fuchsia_sdk//pkg/fdio",
Expand Down
10 changes: 4 additions & 6 deletions pw_build_info/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,10 @@ cc_library(
pw_cc_test(
name = "build_id_test",
srcs = ["build_id_test.cc"],
# Only compatible with platforms that support linker scripts.
target_compatible_with = select({
"@platforms//os:macos": ["@platforms//:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
# This test is only compatible with linux. macOS and Windows are not
# supported, and embedded targets must manually add the snippet to their
# linker scripts
target_compatible_with = ["@platforms//os:linux"],
deps = [
":build_id",
"//pw_span",
Expand Down
4 changes: 4 additions & 0 deletions pw_bytes/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# the License.

load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

rust_library(
name = "pw_bytes",
Expand All @@ -25,9 +26,12 @@ rust_library(
rust_test(
name = "pw_bytes_test",
crate = ":pw_bytes",
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_doc_test(
name = "pw_bytes_doc_test",
crate = ":pw_bytes",
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)
7 changes: 7 additions & 0 deletions pw_cpu_exception_cortex_m/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ pw_cc_test(
srcs = [
"crash_test.cc",
],
target_compatible_with = select({
"@platforms//cpu:armv7-m": [],
"@platforms//cpu:armv7e-m": [],
"@platforms//cpu:armv7e-mf": [],
"@platforms//cpu:armv8-m": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
":config",
":cortex_m_constants",
Expand Down
11 changes: 11 additions & 0 deletions pw_format/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# the License.

load("@rules_rust//rust:defs.bzl", "rust_doc", "rust_doc_test", "rust_library", "rust_proc_macro", "rust_test")
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

rust_library(
name = "pw_format_core",
Expand Down Expand Up @@ -50,6 +51,8 @@ rust_library(
rust_test(
name = "pw_format_test",
crate = ":pw_format",
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_doc_test(
Expand All @@ -61,6 +64,7 @@ rust_doc_test(
rust_doc(
name = "pw_format_doc",
crate = ":pw_format",
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_proc_macro(
Expand All @@ -86,12 +90,15 @@ rust_library(
proc_macro_deps = [
":pw_format_example_macro",
],
tags = ["manual"],
visibility = ["//visibility:public"],
)

rust_test(
name = "pw_format_example_macro_test_test",
crate = ":pw_format_example_macro_test",
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_proc_macro(
Expand Down Expand Up @@ -128,6 +135,8 @@ rust_library(
rust_test(
name = "pw_format_test_macros_printf_test_test",
crate = ":pw_format_test_macros_printf_test",
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)

rust_library(
Expand All @@ -149,4 +158,6 @@ rust_library(
rust_test(
name = "pw_format_test_macros_core_fmt_test_test",
crate = ":pw_format_test_macros_core_fmt_test",
# TODO: b/343726867 - support on-device rust tests
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
)
6 changes: 6 additions & 0 deletions pw_grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")
load(
"//pw_protobuf_compiler:pw_proto_library.bzl",
"pw_proto_filegroup",
Expand All @@ -35,6 +36,10 @@ cc_library(
"public/pw_grpc/connection.h",
],
includes = ["public"],
target_compatible_with = select({
":pw_rpc_config_setting": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
":hpack",
":send_queue",
Expand Down Expand Up @@ -218,6 +223,7 @@ go_test(
data = [
":test_pw_rpc_server",
],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//codes",
Expand Down
1 change: 1 addition & 0 deletions pw_hdlc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ cc_library(
":pw_hdlc",
":rpc_channel_output",
"//pw_log",
"//pw_log_basic:headers",
"//pw_rpc/system_server:facade",
"//pw_stream:sys_io_stream",
],
Expand Down
2 changes: 1 addition & 1 deletion pw_hdlc/hdlc_sys_io_system_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "pw_hdlc/default_addresses.h"
#include "pw_hdlc/encoded_size.h"
#include "pw_hdlc/rpc_channel.h"
#include "pw_log/log.h"
#include "pw_log_basic/log_basic.h"
#include "pw_rpc_system_server/rpc_server.h"
#include "pw_stream/sys_io_stream.h"

Expand Down
5 changes: 5 additions & 0 deletions pw_hdlc/java/test/dev/pigweed/pw_hdlc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
# License for the specific language governing permissions and limitations under
# the License.

load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")

licenses(["notice"])

java_test(
name = "DecoderTest",
size = "small",
srcs = ["DecoderTest.java"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
test_class = "dev.pigweed.pw_hdlc.DecoderTest",
visibility = ["//visibility:public"],
deps = [
Expand All @@ -34,6 +37,7 @@ java_test(
name = "EncoderTest",
size = "small",
srcs = ["EncoderTest.java"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
test_class = "dev.pigweed.pw_hdlc.EncoderTest",
visibility = ["//visibility:public"],
deps = [
Expand All @@ -50,6 +54,7 @@ java_test(
name = "FrameTest",
size = "small",
srcs = ["FrameTest.java"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
test_class = "dev.pigweed.pw_hdlc.FrameTest",
visibility = ["//visibility:public"],
deps = [
Expand Down
3 changes: 3 additions & 0 deletions pw_i2c/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT")
load(
"//pw_protobuf_compiler:pw_proto_library.bzl",
"pw_proto_filegroup",
Expand Down Expand Up @@ -122,6 +123,8 @@ cc_library(
"public/pw_i2c/initiator_gmock.h",
],
includes = ["public"],
# TODO: b/310957361 - gtest not supported on device
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":initiator",
"@com_google_googletest//:gtest",
Expand Down
10 changes: 10 additions & 0 deletions pw_intrusive_ptr/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ pw_cc_test(
srcs = [
"intrusive_ptr_test.cc",
],
# TODO: b/260624583 - Fix this for rp2040
target_compatible_with = select({
"//pw_build/constraints/chipset:rp2040": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [":pw_intrusive_ptr"],
)

Expand All @@ -56,5 +61,10 @@ pw_cc_test(
srcs = [
"recyclable_test.cc",
],
# TODO: b/260624583 - Fix this for rp2040
target_compatible_with = select({
"//pw_build/constraints/chipset:rp2040": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [":pw_intrusive_ptr"],
)
Loading

0 comments on commit 76902e6

Please sign in to comment.