@@ -55,7 +55,6 @@ def protoc_genrule(name,
5555 "gendir" : outdir ,
5656 "outdir" : outdir ,
5757 "protos" : protos ,
58- "paths" : paths ,
5958 "protoc" : protoc ,
6059 "protobuf_plugin" : protobuf_plugin ,
6160 "protobuf_plugin_options" : protobuf_plugin_options ,
@@ -81,7 +80,7 @@ def protoc_genrule(name,
8180
8281 invoke ("build_generated_filenames" , lang , self )
8382 invoke ("build_tools" , lang , self )
84- invoke ("build_paths " , lang , self )
83+ invoke ("build_imports " , lang , self )
8584 invoke ("build_protobuf_invocation" , lang , self )
8685 invoke ("build_protobuf_out" , lang , self )
8786 if with_grpc :
@@ -119,7 +118,7 @@ def _execute_rule(self):
119118 #self["args"] += ["--descriptor_set_out=%s" % (descriptor_set_file.path)]
120119
121120 arglist = list (set (self ["args" ]))
122- pathlist = ["--proto_path=" + i for i in set (self ["paths " ])]
121+ pathlist = ["--proto_path=" + i for i in set (self ["imports " ])]
123122
124123 arguments = arglist + pathlist + srcfiles
125124 inputs = list (set (self ["requires" ]))
@@ -171,9 +170,9 @@ def _build_source_files(ctx, self):
171170 self ["srcs" ] += [srcfile ]
172171 self ["srcfilenames" ] += [srcfile .short_path ]
173172
174- # This is the key to enable imports: protoc can see the entire
175- # source tree from the workspace root.
176- self ["paths " ] += ["." ]
173+ # This is the key for protoc to see the entire source tree from the
174+ # workspace root.
175+ self ["imports " ] += ["." ]
177176
178177def _protoc_rule_impl (ctx ):
179178
@@ -189,7 +188,6 @@ def _protoc_rule_impl(ctx):
189188 "gendir" : gendir ,
190189 "outdir" : outdir ,
191190 "imports" : [],
192- "paths" : [],
193191 "args" : [],
194192 "srcs" : [],
195193 "srcfilenames" : [],
@@ -200,7 +198,6 @@ def _protoc_rule_impl(ctx):
200198 "with_grpc" : getattr (ctx .attr , "with_grpc" , False ),
201199 #"descriptor_set_file": descriptor_set_file,
202200 "transitive_imports" : [],
203- "transitive_paths" : [],
204201 "transitive_packages" : {},
205202 "transitive_requires" : [],
206203 "transitive_srcs" : [],
@@ -209,7 +206,6 @@ def _protoc_rule_impl(ctx):
209206 # Propogate proto deps:
210207 for dep in ctx .attr .deps :
211208 self ["transitive_imports" ] += dep .proto .transitive_imports
212- self ["transitive_paths" ] += dep .proto .transitive_paths
213209 self ["transitive_packages" ] += dep .proto .transitive_packages
214210 self ["transitive_requires" ] += dep .proto .transitive_requires
215211 self ["transitive_srcs" ] += dep .proto .transitive_srcs
@@ -230,7 +226,6 @@ def _protoc_rule_impl(ctx):
230226
231227 invoke ("build_generated_files" , lang , self )
232228 invoke ("build_imports" , lang , self )
233- invoke ("build_paths" , lang , self )
234229 invoke ("build_protobuf_invocation" , lang , self )
235230 invoke ("build_protobuf_out" , lang , self )
236231 if self ["with_grpc" ]:
@@ -254,14 +249,12 @@ def _protoc_rule_impl(ctx):
254249 proto = struct (
255250
256251 imports = self ["imports" ],
257- paths = self ["paths" ],
258252 packages = self ["packages" ],
259253 srcs = set (self ["srcs" ]),
260254 requires = self ["requires" ],
261255
262256 transitive_requires = self ["requires" ] + self ["transitive_requires" ],
263257 transitive_imports = self ["imports" ] + self ["transitive_imports" ],
264- transitive_paths = self ["paths" ] + self ["transitive_paths" ],
265258 transitive_packages = self ["packages" ] + self ["transitive_packages" ],
266259 transitive_srcs = self ["srcs" ] + self ["transitive_srcs" ],
267260 ),
@@ -289,18 +282,8 @@ def implement(spec):
289282
290283 attrs ["deps" ] = attr .label_list (providers = ["proto" ])
291284
292- # Options to be passed to protoc as --proto_path. Differs from
293- # imports in that these are raw strings rather than labels.
294- attrs ["paths" ] = attr .string_list ()
295-
296- # Protos that should be made available for proto imports. These are
297- # not added as options but rather copied over to the sandbox where
298- # protoc is run, making them available for import. TODO: is this
299- # really needed? Test it by using the descriptor protos from
300- # google/protobuf.
301- attrs ["imports" ] = attr .label_list (
302- allow_files = FileType ([".proto" ]),
303- )
285+ # Options to be passed to protoc as --proto_path.
286+ attrs ["imports" ] = attr .string_list ()
304287
305288 # The list of files the rule generates. How is this actually being
306289 # used?
0 commit comments