File tree 2 files changed +30
-0
lines changed
main/starlark/builtins_bzl/common/cc
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ _cc_proto_aspect = aspect(
267
267
),
268
268
"_cc_toolchain" : attr .label (default = "@bazel_tools//tools/cpp:current_cc_toolchain" ),
269
269
},
270
+ toolchains = cc_helper .use_cpp_toolchain (),
270
271
)
271
272
272
273
def _impl (ctx ):
Original file line number Diff line number Diff line change 565
565
bazel build //a:c || fail " build failed"
566
566
}
567
567
568
+ function test_cc_proto_library_with_toolchain_resolution() {
569
+ write_workspace " "
570
+ mkdir -p a
571
+ cat > a/BUILD << EOF
572
+ load("@rules_proto//proto:defs.bzl", "proto_library")
573
+ proto_library(name='p', srcs=['p.proto'])
574
+ cc_proto_library(name='cp', deps=[':p'])
575
+ cc_library(name='c', srcs=['c.cc'], deps=[':cp'])
576
+ EOF
577
+
578
+ cat > a/p.proto << EOF
579
+ syntax = "proto2";
580
+ package a;
581
+ message A {
582
+ optional int32 a = 1;
583
+ }
584
+ EOF
585
+
586
+ cat > a/c.cc << EOF
587
+ #include "a/p.pb.h"
588
+
589
+ void f() {
590
+ a::A a;
591
+ }
592
+ EOF
593
+
594
+ bazel build --incompatible_enable_cc_toolchain_resolution //a:c || fail " build failed"
595
+ }
596
+
568
597
function test_cc_proto_library_import_prefix_stripping() {
569
598
write_workspace " "
570
599
mkdir -p a/dir
You can’t perform that action at this time.
0 commit comments