Run "buildifier --lint=fix" on bzl files

RELNOTES: None.
PiperOrigin-RevId: 221432526
diff --git a/scripts/docs/jekyll.bzl b/scripts/docs/jekyll.bzl
index 0ca0c3e..9c0025a 100644
--- a/scripts/docs/jekyll.bzl
+++ b/scripts/docs/jekyll.bzl
@@ -82,8 +82,7 @@
         "bucket": attr.string(),
         "_jekyll_build_tpl": attr.label(
             default = ":jekyll_build.sh.tpl",
-            allow_files = True,
-            single_file = True,
+            allow_single_file = True,
         ),
     },
     outputs = {"out": "%{name}.tar"},
diff --git a/scripts/packages/self_extract_binary.bzl b/scripts/packages/self_extract_binary.bzl
index 24e3ddf..3dc3d8d 100644
--- a/scripts/packages/self_extract_binary.bzl
+++ b/scripts/packages/self_extract_binary.bzl
@@ -36,7 +36,7 @@
     """Implementation for the self_extract_binary rule."""
 
     # This is a bit complex for stripping out timestamps
-    zip_artifact = ctx.new_file(ctx.label.name + ".zip")
+    zip_artifact = ctx.actions.declare_file(ctx.label.name + ".zip")
     touch_empty_files = [
         "mkdir -p $(dirname ${tmpdir}/%s); touch ${tmpdir}/%s" % (f, f)
         for f in ctx.attr.empty_files
@@ -50,7 +50,7 @@
         "cp %s ${tmpdir}/%s" % (r.path, r.basename)
         for r in ctx.files.flatten_resources
     ]
-    ctx.action(
+    ctx.actions.run_shell(
         inputs = ctx.files.resources + ctx.files.flatten_resources,
         outputs = [zip_artifact],
         command = "\n".join([
@@ -62,7 +62,7 @@
         ]),
         mnemonic = "ZipBin",
     )
-    ctx.action(
+    ctx.actions.run_shell(
         inputs = [ctx.file.launcher, zip_artifact],
         outputs = [ctx.outputs.executable],
         command = "\n".join([
@@ -81,8 +81,7 @@
     attrs = {
         "launcher": attr.label(
             mandatory = True,
-            allow_files = True,
-            single_file = True,
+            allow_single_file = True,
         ),
         "empty_files": attr.string_list(default = []),
         "resources": attr.label_list(
diff --git a/src/embedded_tools.bzl b/src/embedded_tools.bzl
index 5646656..fefa792 100644
--- a/src/embedded_tools.bzl
+++ b/src/embedded_tools.bzl
@@ -17,10 +17,10 @@
 def _embedded_tools(ctx):
     # The list of arguments we pass to the script.
     args_file = ctx.actions.declare_file(ctx.label.name + ".params")
-    ctx.file_action(output = args_file, content = "\n".join([f.path for f in ctx.files.srcs]))
+    ctx.actions.write(output = args_file, content = "\n".join([f.path for f in ctx.files.srcs]))
 
     # Action to call the script.
-    ctx.action(
+    ctx.actions.run(
         inputs = ctx.files.srcs,
         outputs = [ctx.outputs.out],
         arguments = [ctx.outputs.out.path, args_file.path],
diff --git a/tools/build_defs/hash/hash.bzl b/tools/build_defs/hash/hash.bzl
index 5d9430d..6092730 100644
--- a/tools/build_defs/hash/hash.bzl
+++ b/tools/build_defs/hash/hash.bzl
@@ -15,8 +15,8 @@
 
 def sha256(ctx, artifact):
     """Create an action to compute the SHA-256 of an artifact."""
-    out = ctx.new_file(artifact.basename + ".sha256")
-    ctx.action(
+    out = ctx.actions.declare_file(artifact.basename + ".sha256")
+    ctx.actions.run(
         executable = ctx.executable.sha256,
         arguments = [artifact.path, out.path],
         inputs = [artifact],
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl
index b06bb65..93ff5da 100644
--- a/tools/build_defs/pkg/pkg.bzl
+++ b/tools/build_defs/pkg/pkg.bzl
@@ -188,14 +188,14 @@
     args += ["--pre_depends=" + d for d in ctx.attr.predepends]
     args += ["--recommends=" + d for d in ctx.attr.recommends]
 
-    ctx.action(
+    ctx.actions.run(
         executable = ctx.executable.make_deb,
         arguments = args,
         inputs = files,
         outputs = [ctx.outputs.deb, ctx.outputs.changes],
         mnemonic = "MakeDeb",
     )
-    ctx.action(
+    ctx.actions.run_shell(
         command = "ln -s %s %s" % (ctx.outputs.deb.basename, ctx.outputs.out.path),
         inputs = [ctx.outputs.deb],
         outputs = [ctx.outputs.out],
diff --git a/tools/build_defs/pkg/rpm.bzl b/tools/build_defs/pkg/rpm.bzl
index 38f8b26..6f9a0ef 100644
--- a/tools/build_defs/pkg/rpm.bzl
+++ b/tools/build_defs/pkg/rpm.bzl
@@ -132,24 +132,21 @@
     attrs = {
         "spec_file": attr.label(
             mandatory = True,
-            allow_files = spec_filetype,
-            single_file = True,
+            allow_single_file = spec_filetype,
         ),
         "architecture": attr.string(default = "all"),
         "version_file": attr.label(
-            allow_files = True,
-            single_file = True,
+            allow_single_file = True,
         ),
         "version": attr.string(),
         "changelog": attr.label(
-            allow_files = True,
-            single_file = True,
+            allow_single_file = True,
         ),
         "data": attr.label_list(
             mandatory = True,
             allow_files = True,
         ),
-        "release_file": attr.label(allow_files = True, single_file = True),
+        "release_file": attr.label(allow_single_file = True),
         "release": attr.string(),
         "debug": attr.bool(default = False),
 
diff --git a/tools/build_rules/java_rules_skylark.bzl b/tools/build_rules/java_rules_skylark.bzl
index b196d2d..350fbad 100644
--- a/tools/build_rules/java_rules_skylark.bzl
+++ b/tools/build_rules/java_rules_skylark.bzl
@@ -39,11 +39,11 @@
     javalist_output = class_jar.path + ".build_java_list"
     sources = ctx.files.srcs
 
-    sources_param_file = ctx.new_file(ctx.bin_dir, class_jar, "-2.params")
-    ctx.file_action(
+    sources_param_file = ctx.actions.declare_file(class_jar.basename + "-2.params")
+    ctx.actions.write(
         output = sources_param_file,
         content = cmd_helper.join_paths("\n", depset(sources)),
-        executable = False,
+        is_executable = False,
     )
 
     # Cleaning build output directory
@@ -72,7 +72,7 @@
         cmd += "cp %s %s\n" % (r.path, build_output)
     cmd += (jar_path + " cf " + class_jar.path + " -C " + build_output + " .\n" +
             "touch " + build_output + "\n")
-    ctx.action(
+    ctx.actions.run_shell(
         inputs = (sources + compile_time_jars_list + [sources_param_file] +
                   ctx.files._jdk + ctx.files.resources + ctx.files.srcjars),
         outputs = [class_jar],
@@ -99,10 +99,10 @@
     main_class = ctx.attr.main_class
     java_runtime = ctx.attr._jdk[java_common.JavaRuntimeInfo]
     jar_path = "%s/bin/jar" % java_runtime.java_home
-    ctx.file_action(
+    ctx.actions.write(
         output = manifest,
         content = "Main-Class: " + main_class + "\n",
-        executable = False,
+        is_executable = False,
     )
 
     # Cleaning build output directory
@@ -113,7 +113,7 @@
             deploy_jar.path + " -C " + build_output + " .\n" +
             "touch " + build_output + "\n")
 
-    ctx.action(
+    ctx.actions.run_shell(
         inputs = list(library_result.runtime_jars) + [manifest] + ctx.files._jdk,
         outputs = [deploy_jar],
         mnemonic = "Deployjar",
@@ -123,7 +123,7 @@
 
     # Write the wrapper.
     executable = ctx.outputs.executable
-    ctx.file_action(
+    ctx.actions.write(
         output = executable,
         content = "\n".join([
             "#!/bin/bash",
@@ -163,7 +163,7 @@
              " ".join(ctx.attr.jvm_flags)),
             "",
         ]),
-        executable = True,
+        is_executable = True,
     )
 
     runfiles = ctx.runfiles(files = [deploy_jar, executable] + ctx.files._jdk, collect_data = True)
diff --git a/tools/build_rules/test_rules.bzl b/tools/build_rules/test_rules.bzl
index c365021..675b0e3 100644
--- a/tools/build_rules/test_rules.bzl
+++ b/tools/build_rules/test_rules.bzl
@@ -31,7 +31,7 @@
       with actions that always succeed at execution time.
     """
     exe = ctx.outputs.executable
-    dat = ctx.new_file(ctx.genfiles_dir, exe, ".dat")
+    dat = ctx.actions.declare_file(exe.basename + ".dat")
     ctx.actions.write(
         output = dat,
         content = msg,
@@ -69,12 +69,12 @@
 
     ### fail(msg) ### <--- This would fail at analysis time.
     exe = ctx.outputs.executable
-    dat = ctx.new_file(ctx.genfiles_dir, exe, ".dat")
-    ctx.file_action(
+    dat = ctx.actions.declare_file(exe.basename + ".dat")
+    ctx.actions.write(
         output = dat,
         content = msg,
     )
-    ctx.file_action(
+    ctx.actions.write(
         output = exe,
         content = "(cat " + dat.short_path + " ; echo ) >&2 ; exit 1",
         executable = True,
@@ -240,16 +240,16 @@
                 fail(("rule %s doesn't provide attribute %s. " +
                       "Its list of attributes is: %s") %
                      (rule_name, k, dir(rule_)))
-            file_ = ctx.new_file(ctx.genfiles_dir, exe, "." + k)
+            file_ = ctx.actions.declare_file(exe.basename + "." + k)
             files += [file_]
             regexp = provides[k]
             commands += [
                 "if ! grep %s %s ; then echo 'bad %s:' ; cat %s ; echo ; exit 1 ; fi" %
                 (repr(regexp), file_.short_path, k, file_.short_path),
             ]
-            ctx.file_action(output = file_, content = v)
+            ctx.actions.write(output = file_, content = v)
         script = "\n".join(commands + ["true"])
-        ctx.file_action(output = exe, content = script, executable = True)
+        ctx.actions.write(output = exe, content = script, executable = True)
         return struct(runfiles = ctx.runfiles([exe] + files))
     else:
         return success_target(ctx, "success")
@@ -277,15 +277,15 @@
     if content and matches != -1:
         fail("matches only makes sense with regexp")
     if content:
-        dat = ctx.new_file(ctx.genfiles_dir, exe, ".dat")
-        ctx.file_action(
+        dat = ctx.actions.declare_file(exe.basename + ".dat")
+        ctx.actions.write(
             output = dat,
             content = content,
         )
-        ctx.file_action(
+        ctx.actions.write(
             output = exe,
             content = "diff -u %s %s" % (dat.short_path, file_.short_path),
-            executable = True,
+            is_executable = True,
         )
         return struct(runfiles = ctx.runfiles([exe, dat, file_]))
     if matches != -1:
@@ -296,10 +296,10 @@
         )
     else:
         script = "grep %s %s" % (repr(regexp), file_.short_path)
-    ctx.file_action(
+    ctx.actions.write(
         output = exe,
         content = script,
-        executable = True,
+        is_executable = True,
     )
     return struct(runfiles = ctx.runfiles([exe, file_]))
 
@@ -307,8 +307,7 @@
     attrs = {
         "file": attr.label(
             mandatory = True,
-            allow_files = True,
-            single_file = True,
+            allow_single_file = True,
         ),
         "content": attr.string(default = ""),
         "regexp": attr.string(default = ""),
diff --git a/tools/build_rules/utilities.bzl b/tools/build_rules/utilities.bzl
index 2dc290c..bead355 100644
--- a/tools/build_rules/utilities.bzl
+++ b/tools/build_rules/utilities.bzl
@@ -26,7 +26,7 @@
     attrs = {
         "deps": attr.label_list(
             mandatory = True,
-            non_empty = True,
+            allow_empty = False,
             providers = ["java"],
         ),
     },