Skip to content

Fix code for Bazel change --incompatible_no_support_tools_in_action_inputs #758

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

Merged
merged 1 commit into from
May 24, 2019
Merged
Changes from all commits
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
11 changes: 3 additions & 8 deletions scala_proto/private/proto_to_scala_src.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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],
)