Skip to content

Commit

Permalink
Mark some Bazel targets as "manual." (#7932)
Browse files Browse the repository at this point in the history
The Python C++ extension targets are not used unless
`--@:use_fast_cpp_protos=true`, and may not even be able to build
if the Python headers are missing (note that
`//util/python:python_headers`, bound to `@python_headers//` in
`//:WORKSPACE`, is not currently sufficient). This change adds the
`"manual"` tag to these targets, so that they do not cause
`bazel test ...` to fail when Python headers are missing. Without
the manual tag, the targets are always selected, even if
`--@:use_fast_cpp_protos=false`.

The `:cc_proto_blacklist_test` target is metastable, depending on
whether the `--proto_toolchain_for_cc=` flag names a target with
or without the `@com_google_protobuf//` prefix. We use the correct
prefix for Bazel's default in `kokoro/linux/bazel/build.sh`, but
the `bazel test :cc_proto_blacklist_test` (with or without `//`)
fails consistently. Hopefully, this will be fixed when
bazelbuild/bazel#10590 is addressed.
  • Loading branch information
dlj-NaN committed Oct 1, 2020
1 parent b774da0 commit 54bfa17
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,15 @@ cc_library(

cc_proto_blacklist_test(
name = "cc_proto_blacklist_test",
deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()]
deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
tags = [
# Exclude this target from wildcard expansion (//...). Due to
# https://github.com/bazelbuild/bazel/issues/10590, this test has to
# be nominated using the `@com_google_protobuf//` prefix. We do that,
# e.g., in kokoro/linux/bazel/build.sh.
# See also https://github.com/protocolbuffers/protobuf/pull/7096.
"manual",
],
)

################################################################################
Expand Down Expand Up @@ -756,6 +764,13 @@ cc_binary(
copts = COPTS + [
"-DPYTHON_PROTO2_CPP_IMPL_V2",
],
tags = [
# Exclude this target from wildcard expansion (//...) because it may
# not even be buildable. It will be built if it is needed according
# to :use_fast_cpp_protos.
# https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes
"manual",
],
linkshared = 1,
linkstatic = 1,
deps = select({
Expand All @@ -780,6 +795,13 @@ cc_binary(
"python/",
"src/",
],
tags = [
# Exclude this target from wildcard expansion (//...) because it may
# not even be buildable. It will be built if it is needed according
# to :use_fast_cpp_protos.
# https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes
"manual",
],
linkshared = 1,
linkstatic = 1,
deps = [
Expand Down

0 comments on commit 54bfa17

Please sign in to comment.