File tree Expand file tree Collapse file tree 3 files changed +52
-2
lines changed
tests/generated_proto_file Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -331,17 +331,26 @@ def _build_protobuf_out(run, builder):
331331 """Build the --{lang}_out option"""
332332 lang = run .lang
333333 name = lang .pb_plugin_name or lang .name
334- outdir = builder .get (lang .name + "_outdir" , run .outdir )
335334 options = builder .get (lang .name + "_pb_options" , [])
336335
336+ if run .data .protos [0 ].path .startswith (run .ctx .var ["GENDIR" ]):
337+ outdir = "."
338+ else :
339+ outdir = builder .get (lang .name + "_outdir" , run .outdir )
340+
337341 _build_plugin_out (name , outdir , options , builder )
338342
339343
340344def _build_grpc_out (run , builder ):
341345 """Build the --{lang}_out grpc option"""
342346 lang = run .lang
343347 name = lang .grpc_plugin_name or "grpc-" + lang .name
344- outdir = builder .get (lang .name + "_outdir" , run .outdir )
348+
349+ if run .data .protos [0 ].path .startswith (run .ctx .var ["GENDIR" ]):
350+ outdir = "."
351+ else :
352+ outdir = builder .get (lang .name + "_outdir" , run .outdir )
353+
345354 options = builder .get (lang .name + "_grpc_options" , [])
346355
347356 _build_plugin_out (name , outdir , options , builder )
Original file line number Diff line number Diff line change 1+ package (default_visibility = ["//visibility:public" ])
2+
3+ load ("//cpp:rules.bzl" , "cpp_proto_library" )
4+ load ("//go:rules.bzl" , "go_proto_library" )
5+
6+ genrule (
7+ name = "copy_file" ,
8+ srcs = ["simple.proto" ],
9+ outs = ["copy.proto" ],
10+ cmd = "cat $(location simple.proto) > $@" ,
11+ message = "copy" ,
12+ )
13+
14+ cpp_proto_library (
15+ name = "default_library" ,
16+ protos = ["simple.proto" ],
17+ )
18+
19+ cpp_proto_library (
20+ name = "copy_library" ,
21+ protos = ["copy.proto" ],
22+ with_grpc = True ,
23+ )
24+
25+ go_proto_library (
26+ name = "go_default_library" ,
27+ protos = ["simple.proto" ],
28+ )
29+
30+ go_proto_library (
31+ name = "go_copy_library" ,
32+ protos = ["copy.proto" ],
33+ with_grpc = True ,
34+ )
Original file line number Diff line number Diff line change 1+ syntax = "proto3" ;
2+
3+ package simple ;
4+
5+ message Test {
6+ string value = 1 ;
7+ }
You can’t perform that action at this time.
0 commit comments