diff --git a/scala_proto/private/proto_to_scala_src.bzl b/scala_proto/private/proto_to_scala_src.bzl index 58d565fe3..b3f7727de 100644 --- a/scala_proto/private/proto_to_scala_src.bzl +++ b/scala_proto/private/proto_to_scala_src.bzl @@ -4,24 +4,20 @@ load( ) load("//scala/private:rule_impls.bzl", "compile_scala") - def _root_path(f): if f.is_source: return f.owner.workspace_root return "/".join([f.root.path, f.owner.workspace_root]) - def _colon_paths(data): return ":".join([ f.path for f in sorted(data) ]) - def encode_named_generators(named_generators): return ",".join([k + "=" + v for (k, v) in sorted(named_generators.items())]) - def proto_to_scala_src(ctx, label, code_generator, compile_proto, include_proto, transitive_proto_paths, flags, jar_output, named_generators, extra_generator_jars): worker_content = "{output}\n{included_proto}\n{flags_arg}\n{transitive_proto_paths}\n{inputs}\n{protoc}\n{extra_generator_pairs}\n{extra_cp_entries}".format( output = jar_output.path, @@ -33,8 +29,8 @@ def proto_to_scala_src(ctx, label, code_generator, compile_proto, include_proto, # Pass inputs seprately because they doesn't always match to imports (ie blacklisted protos are excluded) inputs = _colon_paths(compile_proto), protoc = ctx.executable._protoc.path, - extra_generator_pairs= "-" + encode_named_generators(named_generators), - extra_cp_entries = "-" + _colon_paths(extra_generator_jars) + extra_generator_pairs = "-" + encode_named_generators(named_generators), + extra_cp_entries = "-" + _colon_paths(extra_generator_jars), ) argfile = ctx.actions.declare_file( "%s_worker_input" % label.name, @@ -44,11 +40,10 @@ def proto_to_scala_src(ctx, label, code_generator, compile_proto, include_proto, ctx.actions.run( executable = code_generator.files_to_run, inputs = compile_proto + include_proto + [argfile, ctx.executable._protoc] + extra_generator_jars, + tools = compile_proto, outputs = [jar_output], mnemonic = "ProtoScalaPBRule", progress_message = "creating scalapb files %s" % ctx.label, execution_requirements = {"supports-workers": "1"}, arguments = ["@" + argfile.path], ) - -