Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cc] Add cc toolchain to starlark cc_proto_library #16585

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,5 @@ cc_proto_library = rule(
allow_files = False,
),
},
toolchains = cc_helper.use_cpp_toolchain(),
Yannic marked this conversation as resolved.
Show resolved Hide resolved
)
29 changes: 29 additions & 0 deletions src/test/shell/bazel/bazel_proto_library_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,35 @@ EOF
bazel build //a:c || fail "build failed"
}

function test_cc_proto_library_with_toolchain_resolution() {
write_workspace ""
mkdir -p a
cat > a/BUILD <<EOF
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(name='p', srcs=['p.proto'])
cc_proto_library(name='cp', deps=[':p'])
cc_library(name='c', srcs=['c.cc'], deps=[':cp'])
EOF

cat > a/p.proto <<EOF
syntax = "proto2";
package a;
message A {
optional int32 a = 1;
}
EOF

cat > a/c.cc <<EOF
#include "a/p.pb.h"

void f() {
a::A a;
}
EOF

bazel build --incompatible_enable_cc_toolchain_resolution //a:c || fail "build failed"
}

function test_cc_proto_library_import_prefix_stripping() {
write_workspace ""
mkdir -p a/dir
Expand Down