diff options
author | David Ostrovsky <david@ostrovsky.org> | 2019-01-08 23:11:59 +0100 |
---|---|---|
committer | David Ostrovsky <david@ostrovsky.org> | 2019-01-08 23:11:59 +0100 |
commit | 930f29e2fde16e546cbf4f895ad304d1318f2cb2 (patch) | |
tree | fe79cac8b3fcf502cd8484ac4e71dc5a429b4bf5 /tools | |
parent | 428f1cc8aec15f20816224fa6c32b223ad4f2e03 (diff) |
Bazel: Automatically fix lint errors with buildifier
In recent buildifier versions, lint errors can be fixed automatically:
$ find . \( -name BUILD -o -name "*.bzl" \) -print \
| xargs buildifier --lint=fix
This commit was created with Buildifier version 0.19.2:
$ buildifier --version
buildifier version: 0.19.2
buildifier scm revision: d39e4d5c25111527369142f16cdb49aa67707313
Change-Id: I1f06cd4596e794981ccc2d9fc2d1da9b17f3973a
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bzl/asciidoc.bzl | 8 | ||||
-rw-r--r-- | tools/bzl/classpath.bzl | 4 | ||||
-rw-r--r-- | tools/bzl/gwt.bzl | 10 | ||||
-rw-r--r-- | tools/bzl/javadoc.bzl | 8 | ||||
-rw-r--r-- | tools/bzl/js.bzl | 20 | ||||
-rw-r--r-- | tools/bzl/junit.bzl | 2 | ||||
-rw-r--r-- | tools/bzl/pkg_war.bzl | 8 | ||||
-rw-r--r-- | tools/eclipse/BUILD | 2 |
8 files changed, 31 insertions, 31 deletions
diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl index ab452c574d..61774720a6 100644 --- a/tools/bzl/asciidoc.bzl +++ b/tools/bzl/asciidoc.bzl @@ -46,7 +46,7 @@ def _replace_macros_impl(ctx): cmd.append("--searchbox") else: cmd.append("--no-searchbox") - ctx.action( + ctx.actions.run_shell( inputs = [ctx.file._exe, ctx.file.src], outputs = [ctx.outputs.out], command = cmd, @@ -114,7 +114,7 @@ def _asciidoc_impl(ctx): ".html", ] args.extend(_generate_asciidoc_args(ctx)) - ctx.action( + ctx.actions.run( inputs = ctx.files.srcs + [ctx.executable._exe, ctx.file.version], outputs = ctx.outputs.outs, executable = ctx.executable._exe, @@ -221,7 +221,7 @@ def _asciidoc_html_zip_impl(ctx): ".html", ] args.extend(_generate_asciidoc_args(ctx)) - ctx.action( + ctx.actions.run( inputs = ctx.files.srcs + [ctx.executable._exe, ctx.file.version], outputs = [ctx.outputs.out], executable = ctx.executable._exe, @@ -279,7 +279,7 @@ def _asciidoc_zip_impl(ctx): "cd %s" % tmpdir, "zip -qr $p/%s *" % ctx.outputs.out.path, ]) - ctx.action( + ctx.actions.run_shell( inputs = [ctx.file.src] + ctx.files.resources, outputs = [ctx.outputs.out], command = " && ".join(cmd), diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl index afdd907e6b..9ec5f156c5 100644 --- a/tools/bzl/classpath.bzl +++ b/tools/bzl/classpath.bzl @@ -7,8 +7,8 @@ def _classpath_collector(ctx): elif hasattr(d, "files"): all += d.files - as_strs = [c.path for c in all] - ctx.file_action( + as_strs = [c.path for c in all.to_list()] + ctx.actions.write( output = ctx.outputs.runtime, content = "\n".join(sorted(as_strs)), ) diff --git a/tools/bzl/gwt.bzl b/tools/bzl/gwt.bzl index c51e914269..a0500bdb66 100644 --- a/tools/bzl/gwt.bzl +++ b/tools/bzl/gwt.bzl @@ -117,14 +117,14 @@ def _gwt_user_agent_module(ctx): impl = ALIASES[ua] # intermediate artifact: user agent speific GWT xml file - gwt_user_agent_xml = ctx.new_file(ctx.label.name + "_gwt.xml") - ctx.file_action( + gwt_user_agent_xml = ctx.actions.declare_file(ctx.label.name + "_gwt.xml") + ctx.actions.write( output = gwt_user_agent_xml, content = USER_AGENT_XML % (MODULE, impl), ) # intermediate artifact: user agent specific zip with GWT module - gwt_user_agent_zip = ctx.new_file(ctx.label.name + "_gwt.zip") + gwt_user_agent_zip = ctx.actions.declare_file(ctx.label.name + "_gwt.zip") gwt = "%s_%s.gwt.xml" % (MODULE.replace(".", "/"), ua) dir = gwt_user_agent_zip.path + ".dir" cmd = " && ".join([ @@ -135,7 +135,7 @@ def _gwt_user_agent_module(ctx): "cp $p/%s %s" % (gwt_user_agent_xml.path, gwt), "$p/%s cC $p/%s $(find . | sed 's|^./||')" % (ctx.executable._zip.path, gwt_user_agent_zip.path), ]) - ctx.action( + ctx.actions.run_shell( inputs = [gwt_user_agent_xml] + ctx.files._zip, outputs = [gwt_user_agent_zip], command = cmd, @@ -190,7 +190,7 @@ def _gwt_binary_impl(ctx): ), ]) - ctx.action( + ctx.actions.run_shell( inputs = list(deps) + ctx.files._jdk + ctx.files._zip + gwt_user_agent_modules, outputs = [output_zip], mnemonic = "GwtBinary", diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl index e17a031429..b304db9bb1 100644 --- a/tools/bzl/javadoc.bzl +++ b/tools/bzl/javadoc.bzl @@ -23,7 +23,7 @@ def _impl(ctx): source_jars += l.java.source_jars transitive_jar_set += l.java.transitive_deps - transitive_jar_paths = [j.path for j in transitive_jar_set] + transitive_jar_paths = [j.path for j in transitive_jar_set.to_list()] dir = ctx.outputs.zip.path + ".dir" source = ctx.outputs.zip.path + ".source" external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs @@ -32,7 +32,7 @@ def _impl(ctx): "export TZ", "rm -rf %s" % source, "mkdir %s" % source, - " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars]), + " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars.to_list()]), "rm -rf %s" % dir, "mkdir %s" % dir, " ".join([ @@ -55,8 +55,8 @@ def _impl(ctx): "find %s -exec touch -t 198001010000 '{}' ';'" % dir, "(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename), ] - ctx.action( - inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk, + ctx.actions.run_shell( + inputs = transitive_jar_set.to_list() + source_jars.to_list() + ctx.files._jdk, outputs = [zip_output], command = " && ".join(cmd), ) diff --git a/tools/bzl/js.bzl b/tools/bzl/js.bzl index e4563a69c0..28bc0a9624 100644 --- a/tools/bzl/js.bzl +++ b/tools/bzl/js.bzl @@ -186,7 +186,7 @@ def _js_component(ctx): "zip -Xqr ../%s *" % ctx.outputs.zip.basename, ]) - ctx.action( + ctx.actions.run_shell( inputs = ctx.files.srcs, outputs = [ctx.outputs.zip], command = cmd, @@ -256,8 +256,8 @@ def _bower_component_bundle_impl(ctx): out_zip = ctx.outputs.zip out_versions = ctx.outputs.version_json - ctx.action( - inputs = list(zips), + ctx.actions.run_shell( + inputs = zips.to_list(), outputs = [out_zip], command = " && ".join([ "p=$PWD", @@ -266,7 +266,7 @@ def _bower_component_bundle_impl(ctx): "rm -rf %s.dir" % out_zip.path, "mkdir -p %s.dir/bower_components" % out_zip.path, "cd %s.dir/bower_components" % out_zip.path, - "for z in %s; do unzip -q $p/$z ; done" % " ".join(sorted([z.path for z in zips])), + "for z in %s; do unzip -q $p/$z ; done" % " ".join(sorted([z.path for z in zips.to_list()])), "cd ..", "find . -exec touch -t 198001010000 '{}' ';'", "zip -Xqr $p/%s bower_components/*" % out_zip.path, @@ -274,11 +274,11 @@ def _bower_component_bundle_impl(ctx): mnemonic = "BowerCombine", ) - ctx.action( - inputs = list(versions), + ctx.actions.run_shell( + inputs = versions.to_list(), outputs = [out_versions], mnemonic = "BowerVersions", - command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions]), out_versions.path), + command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions.to_list()]), out_versions.path), ) return struct( @@ -351,7 +351,7 @@ def _vulcanize_impl(ctx): use_default_shell_env = True, execution_requirements = {"local": "1"}, ) - ctx.action( + ctx.actions.run_shell( mnemonic = "Vulcanize", inputs = [ ctx.file._run_npm, @@ -376,7 +376,7 @@ def _vulcanize_impl(ctx): ctx.outputs.js.path, ]) - ctx.action( + ctx.actions.run_shell( mnemonic = "Crisper", inputs = [ ctx.file._run_npm, @@ -426,4 +426,4 @@ _vulcanize_rule = rule( def vulcanize(*args, **kwargs): """Vulcanize runs vulcanize and crisper on a set of sources.""" - _vulcanize_rule(*args, pkg = native.package_name(), **kwargs) + _vulcanize_rule(pkg = native.package_name(), *args, **kwargs) diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl index ba3b966ed9..f816889ed8 100644 --- a/tools/bzl/junit.bzl +++ b/tools/bzl/junit.bzl @@ -50,7 +50,7 @@ def _impl(ctx): classes = ",".join( [_AsClassName(x) for x in ctx.attr.srcs], ) - ctx.file_action(output = ctx.outputs.out, content = _OUTPUT % ( + ctx.actions.write(output = ctx.outputs.out, content = _OUTPUT % ( classes, ctx.attr.outname, )) diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl index 3bf56af553..1142a551ca 100644 --- a/tools/bzl/pkg_war.bzl +++ b/tools/bzl/pkg_war.bzl @@ -82,7 +82,7 @@ def _war_impl(ctx): elif hasattr(l, "files"): transitive_lib_deps += l.files - for dep in transitive_lib_deps: + for dep in transitive_lib_deps.to_list(): cmd += _add_file(dep, build_output + "/WEB-INF/lib/") inputs.append(dep) @@ -91,7 +91,7 @@ def _war_impl(ctx): for l in ctx.attr.pgmlibs: transitive_pgmlib_deps += l.java.transitive_runtime_deps - for dep in transitive_pgmlib_deps: + for dep in transitive_pgmlib_deps.to_list(): if dep not in inputs: cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/") inputs.append(dep) @@ -104,14 +104,14 @@ def _war_impl(ctx): transitive_context_deps += jar.java.transitive_runtime_deps elif hasattr(jar, "files"): transitive_context_deps += jar.files - for dep in transitive_context_deps: + for dep in transitive_context_deps.to_list(): cmd += _add_context(dep, build_output) inputs.append(dep) # Add zip war cmd.append(_make_war(build_output, war)) - ctx.action( + ctx.actions.run_shell( inputs = inputs, outputs = [war], mnemonic = "WAR", diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD index 7e48c7fcb5..e9eb1c7d13 100644 --- a/tools/eclipse/BUILD +++ b/tools/eclipse/BUILD @@ -1,5 +1,5 @@ -load("//tools/bzl:pkg_war.bzl", "LIBS", "PGMLIBS") load("//tools/bzl:classpath.bzl", "classpath_collector") +load("//tools/bzl:pkg_war.bzl", "LIBS", "PGMLIBS") load( "//tools/bzl:plugins.bzl", "CORE_PLUGINS", |