Fix .bzl files with buildifier

This CL fixes .bzl files to make them compatible with the next versions of Bazel. This is done by running the following command on all the .bzl files:

    buildifier --lint=fix --warnings=attr-non-empty,attr-single-file,ctx-actions,output-group

More information: []

Tested:
    tap_presubmit
    Some tests failed; test failures are believed to be unrelated to this CL

BEGIN_PUBLIC
Internal cleanup
END_PUBLIC

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=235192309
This commit is contained in:
jianglai 2019-02-22 07:59:37 -08:00
parent 26490e607e
commit 8fac22f0f3
2 changed files with 6 additions and 6 deletions

View file

@ -178,11 +178,11 @@ def _zip_file(ctx):
else: else:
# TODO(kchodorow): remove this once Bazel 4.0+ is required. # TODO(kchodorow): remove this once Bazel 4.0+ is required.
script = ctx.new_file(ctx.configuration.bin_dir, "%s.sh" % ctx.label.name) script = ctx.new_file(ctx.configuration.bin_dir, "%s.sh" % ctx.label.name)
ctx.file_action(output = script, content = "\n".join(cmd), executable = True) ctx.actions.write(output = script, content = "\n".join(cmd), is_executable = True)
inputs = [ctx.file._zipper] inputs = [ctx.file._zipper]
inputs += [dep.zip_file for dep in ctx.attr.deps] inputs += [dep.zip_file for dep in ctx.attr.deps]
inputs += srcs.to_list() inputs += srcs.to_list()
ctx.action( ctx.actions.run(
inputs = inputs, inputs = inputs,
outputs = [ctx.outputs.out], outputs = [ctx.outputs.out],
executable = script, executable = script,
@ -251,6 +251,6 @@ zip_file = rule(
"deps": attr.label_list(providers = ["zip_file"]), "deps": attr.label_list(providers = ["zip_file"]),
"exclude": attr.string_list(), "exclude": attr.string_list(),
"mappings": attr.string_dict(), "mappings": attr.string_dict(),
"_zipper": attr.label(default = Label(ZIPPER), single_file = True), "_zipper": attr.label(default = Label(ZIPPER), allow_single_file = True),
}, },
) )

View file

@ -48,10 +48,10 @@ def _impl(ctx):
'cd "${repo}"', 'cd "${repo}"',
'rm -rf "${tmp}"', 'rm -rf "${tmp}"',
] ]
ctx.file_action( ctx.actions.write(
output = ctx.outputs.executable, output = ctx.outputs.executable,
content = "\n".join(cmd), content = "\n".join(cmd),
executable = True, is_executable = True,
) )
return struct(runfiles = ctx.runfiles([ctx.file.src, ctx.file._zipper])) return struct(runfiles = ctx.runfiles([ctx.file.src, ctx.file._zipper]))
@ -61,6 +61,6 @@ zip_contents_test = rule(
attrs = { attrs = {
"src": attr.label(allow_single_file = True), "src": attr.label(allow_single_file = True),
"contents": attr.string_dict(), "contents": attr.string_dict(),
"_zipper": attr.label(default = Label(ZIPPER), single_file = True), "_zipper": attr.label(default = Label(ZIPPER), allow_single_file = True),
}, },
) )