From 8fac22f0f36983b079a13e55c921f448118ca571 Mon Sep 17 00:00:00 2001 From: jianglai Date: Fri, 22 Feb 2019 07:59:37 -0800 Subject: [PATCH] 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 --- java/google/registry/builddefs/zip_file.bzl | 6 +++--- javatests/google/registry/builddefs/zip_contents_test.bzl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/google/registry/builddefs/zip_file.bzl b/java/google/registry/builddefs/zip_file.bzl index 07c42691e..625027e26 100644 --- a/java/google/registry/builddefs/zip_file.bzl +++ b/java/google/registry/builddefs/zip_file.bzl @@ -178,11 +178,11 @@ def _zip_file(ctx): else: # TODO(kchodorow): remove this once Bazel 4.0+ is required. 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 += [dep.zip_file for dep in ctx.attr.deps] inputs += srcs.to_list() - ctx.action( + ctx.actions.run( inputs = inputs, outputs = [ctx.outputs.out], executable = script, @@ -251,6 +251,6 @@ zip_file = rule( "deps": attr.label_list(providers = ["zip_file"]), "exclude": attr.string_list(), "mappings": attr.string_dict(), - "_zipper": attr.label(default = Label(ZIPPER), single_file = True), + "_zipper": attr.label(default = Label(ZIPPER), allow_single_file = True), }, ) diff --git a/javatests/google/registry/builddefs/zip_contents_test.bzl b/javatests/google/registry/builddefs/zip_contents_test.bzl index fe06d28ec..4feb336e1 100644 --- a/javatests/google/registry/builddefs/zip_contents_test.bzl +++ b/javatests/google/registry/builddefs/zip_contents_test.bzl @@ -48,10 +48,10 @@ def _impl(ctx): 'cd "${repo}"', 'rm -rf "${tmp}"', ] - ctx.file_action( + ctx.actions.write( output = ctx.outputs.executable, content = "\n".join(cmd), - executable = True, + is_executable = True, ) return struct(runfiles = ctx.runfiles([ctx.file.src, ctx.file._zipper])) @@ -61,6 +61,6 @@ zip_contents_test = rule( attrs = { "src": attr.label(allow_single_file = True), "contents": attr.string_dict(), - "_zipper": attr.label(default = Label(ZIPPER), single_file = True), + "_zipper": attr.label(default = Label(ZIPPER), allow_single_file = True), }, )