summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2019-01-09 22:31:03 +0100
committerDavid Ostrovsky <david@ostrovsky.org>2019-01-09 23:10:35 +0100
commita7056ec1dd063666b3b5c3f94694dae4906f7bbf (patch)
tree7e3d2f6064e4fe240c1c75dca2c84751b54a4d9f /tools
parent8c6e35d908acf0970e15359c7e1c08971b91635e (diff)
parentaeaa73e68cef2e1bb2d1e6cd51dc8f2023afb221 (diff)
Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: Bazel: Fix more buildifier warnings Bazel: Automatically fix lint errors with buildifier 0.20.0 Bazel: Automatically fix lint errors with buildifier Change-Id: I02ba30185683a54dca09e6e200b90fe0e86e1f83
Diffstat (limited to 'tools')
-rw-r--r--tools/bzl/asciidoc.bzl32
-rw-r--r--tools/bzl/classpath.bzl4
-rw-r--r--tools/bzl/gwt.bzl20
-rw-r--r--tools/bzl/javadoc.bzl8
-rw-r--r--tools/bzl/js.bzl52
-rw-r--r--tools/bzl/junit.bzl2
-rw-r--r--tools/bzl/maven_jar.bzl10
-rw-r--r--tools/bzl/pkg_war.bzl6
-rw-r--r--tools/eclipse/BUILD2
9 files changed, 67 insertions, 69 deletions
diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl
index 90bfe2059a..9a3e38fc21 100644
--- a/tools/bzl/asciidoc.bzl
+++ b/tools/bzl/asciidoc.bzl
@@ -56,17 +56,17 @@ def _replace_macros_impl(ctx):
_replace_macros = rule(
attrs = {
- "_exe": attr.label(
- default = Label("//Documentation:replace_macros.py"),
- allow_single_file = True,
- ),
"src": attr.label(
mandatory = True,
allow_single_file = [".txt"],
),
- "suffix": attr.string(mandatory = True),
- "searchbox": attr.bool(default = True),
"out": attr.output(mandatory = True),
+ "searchbox": attr.bool(default = True),
+ "suffix": attr.string(mandatory = True),
+ "_exe": attr.label(
+ default = Label("//Documentation:replace_macros.py"),
+ allow_single_file = True,
+ ),
},
implementation = _replace_macros_impl,
)
@@ -123,23 +123,23 @@ def _asciidoc_impl(ctx):
)
_asciidoc_attrs = {
- "_exe": attr.label(
- default = Label("//lib/asciidoctor:asciidoc"),
- cfg = "host",
- allow_files = True,
- executable = True,
- ),
"srcs": attr.label_list(
mandatory = True,
allow_files = True,
),
+ "attributes": attr.string_list(),
+ "backend": attr.string(),
+ "suffix": attr.string(mandatory = True),
"version": attr.label(
default = Label("//:version.txt"),
allow_single_file = True,
),
- "suffix": attr.string(mandatory = True),
- "backend": attr.string(),
- "attributes": attr.string_list(),
+ "_exe": attr.label(
+ default = Label("//lib/asciidoctor:asciidoc"),
+ cfg = "host",
+ allow_files = True,
+ executable = True,
+ ),
}
_asciidoc = rule(
@@ -293,11 +293,11 @@ _asciidoc_zip = rule(
mandatory = True,
allow_single_file = [".zip"],
),
+ "directory": attr.string(mandatory = True),
"resources": attr.label_list(
mandatory = True,
allow_files = True,
),
- "directory": attr.string(mandatory = True),
},
outputs = {
"out": "%{name}.zip",
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 ecb301af90..b0e5697cd7 100644
--- a/tools/bzl/gwt.bzl
+++ b/tools/bzl/gwt.bzl
@@ -33,9 +33,9 @@ BROWSERS = [
ALIASES = {
"chrome": "safari",
+ "edge": "gecko1_8",
"firefox": "gecko1_8",
"msie": "ie10",
- "edge": "gecko1_8",
}
MODULE = "com.google.gerrit.GerritGwtUI"
@@ -113,14 +113,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([
@@ -209,14 +209,14 @@ def _get_transitive_closure(ctx):
gwt_binary = rule(
attrs = {
- "user_agent": attr.string(),
- "style": attr.string(default = "OBF"),
- "optimize": attr.string(default = "9"),
- "deps": attr.label_list(allow_files = jar_filetype),
- "module": attr.string_list(default = [MODULE]),
- "module_deps": attr.label_list(allow_files = jar_filetype),
"compiler_args": attr.string_list(),
"jvm_args": attr.string_list(),
+ "module": attr.string_list(default = [MODULE]),
+ "module_deps": attr.label_list(allow_files = jar_filetype),
+ "optimize": attr.string(default = "9"),
+ "style": attr.string(default = "OBF"),
+ "user_agent": attr.string(),
+ "deps": attr.label_list(allow_files = jar_filetype),
"_jdk": attr.label(
default = Label("//tools/defaults:jdk"),
),
diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl
index 8f2316c696..d315f8f6f6 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([
@@ -56,17 +56,17 @@ def _impl(ctx):
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
]
ctx.actions.run_shell(
- inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk,
+ inputs = transitive_jar_set.to_list() + source_jars.to_list() + ctx.files._jdk,
outputs = [zip_output],
command = " && ".join(cmd),
)
java_doc = rule(
attrs = {
+ "external_docs": attr.string_list(),
"libs": attr.label_list(allow_files = False),
"pkgs": attr.string_list(),
"title": attr.string(),
- "external_docs": attr.string_list(),
"_jdk": attr.label(
default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
allow_files = True,
diff --git a/tools/bzl/js.bzl b/tools/bzl/js.bzl
index 1421caa8f2..2d865d6490 100644
--- a/tools/bzl/js.bzl
+++ b/tools/bzl/js.bzl
@@ -36,9 +36,9 @@ def _npm_binary_impl(ctx):
npm_binary = repository_rule(
attrs = {
+ "repository": attr.string(default = NPMJS),
# Label resolves within repo of the .bzl file.
"_download_script": attr.label(default = Label("//tools:download_file.py")),
- "repository": attr.string(default = NPMJS),
},
local = True,
implementation = _npm_binary_impl,
@@ -119,13 +119,13 @@ def _bash(ctx, cmd):
bower_archive = repository_rule(
_bower_archive,
attrs = {
- "_bower_archive": attr.label(default = Label("@bower//:%s" % _npm_tarball("bower"))),
- "_run_npm": attr.label(default = Label("//tools/js:run_npm_binary.py")),
- "_download_bower": attr.label(default = Label("//tools/js:download_bower.py")),
- "sha1": attr.string(mandatory = True),
- "version": attr.string(mandatory = True),
"package": attr.string(mandatory = True),
"semver": attr.string(),
+ "sha1": attr.string(mandatory = True),
+ "version": attr.string(mandatory = True),
+ "_bower_archive": attr.label(default = Label("@bower//:%s" % _npm_tarball("bower"))),
+ "_download_bower": attr.label(default = Label("//tools/js:download_bower.py")),
+ "_run_npm": attr.label(default = Label("//tools/js:run_npm_binary.py")),
},
)
@@ -206,12 +206,12 @@ js_component = rule(
_bower_component = rule(
_bower_component_impl,
attrs = dict(_common_attrs.items() + {
- "zipfile": attr.label(allow_single_file = [".zip"]),
"license": attr.label(allow_single_file = True),
- "version_json": attr.label(allow_files = [".json"]),
# If set, define by hand, and don't regenerate this entry in bower2bazel.
"seed": attr.bool(default = False),
+ "version_json": attr.label(allow_files = [".json"]),
+ "zipfile": attr.label(allow_single_file = [".zip"]),
}.items()),
)
@@ -246,7 +246,7 @@ def _bower_component_bundle_impl(ctx):
out_versions = ctx.outputs.version_json
ctx.actions.run_shell(
- inputs = list(zips),
+ inputs = zips.to_list(),
outputs = [out_zip],
command = " && ".join([
"p=$PWD",
@@ -255,7 +255,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,
@@ -264,10 +264,10 @@ def _bower_component_bundle_impl(ctx):
)
ctx.actions.run_shell(
- inputs = list(versions),
+ 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(
@@ -280,8 +280,8 @@ bower_component_bundle = rule(
_bower_component_bundle_impl,
attrs = _common_attrs,
outputs = {
- "zip": "%{name}.zip",
"version_json": "%{name}-versions.json",
+ "zip": "%{name}.zip",
},
)
"""Groups a set of bower components together in a zip file.
@@ -296,10 +296,8 @@ Outputs:
def _vulcanize_impl(ctx):
# intermediate artifact.
- vulcanized = ctx.new_file(
- ctx.configuration.genfiles_dir,
- ctx.outputs.html,
- ".vulcanized.html",
+ vulcanized = ctx.actions.declare_file(
+ ctx.outputs.html.path + ".vulcanized.html",
)
destdir = ctx.outputs.html.path + ".dir"
zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles]
@@ -381,11 +379,6 @@ def _vulcanize_impl(ctx):
_vulcanize_rule = rule(
_vulcanize_impl,
attrs = {
- "deps": attr.label_list(providers = ["transitive_zipfiles"]),
- "app": attr.label(
- mandatory = True,
- allow_single_file = True,
- ),
"srcs": attr.label_list(allow_files = [
".js",
".html",
@@ -393,7 +386,16 @@ _vulcanize_rule = rule(
".css",
".ico",
]),
+ "app": attr.label(
+ mandatory = True,
+ allow_single_file = True,
+ ),
"pkg": attr.string(mandatory = True),
+ "deps": attr.label_list(providers = ["transitive_zipfiles"]),
+ "_crisper_archive": attr.label(
+ default = Label("@crisper//:%s" % _npm_tarball("crisper")),
+ allow_single_file = True,
+ ),
"_run_npm": attr.label(
default = Label("//tools/js:run_npm_binary.py"),
allow_single_file = True,
@@ -402,10 +404,6 @@ _vulcanize_rule = rule(
default = Label("@vulcanize//:%s" % _npm_tarball("vulcanize")),
allow_single_file = True,
),
- "_crisper_archive": attr.label(
- default = Label("@crisper//:%s" % _npm_tarball("crisper")),
- allow_single_file = True,
- ),
},
outputs = {
"html": "%{name}.html",
@@ -415,4 +413,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/maven_jar.bzl b/tools/bzl/maven_jar.bzl
index 2ebb2c248b..05f18bd14a 100644
--- a/tools/bzl/maven_jar.bzl
+++ b/tools/bzl/maven_jar.bzl
@@ -164,15 +164,15 @@ def _maven_jar_impl(ctx):
maven_jar = repository_rule(
attrs = {
"artifact": attr.string(mandatory = True),
+ "attach_source": attr.bool(default = True),
+ "exclude": attr.string_list(),
+ "repository": attr.string(default = MAVEN_CENTRAL),
"sha1": attr.string(),
"src_sha1": attr.string(),
- "_download_script": attr.label(default = Label("//tools:download_file.py")),
- "repository": attr.string(default = MAVEN_CENTRAL),
- "attach_source": attr.bool(default = True),
"unsign": attr.bool(default = False),
- "deps": attr.string_list(),
"exports": attr.string_list(),
- "exclude": attr.string_list(),
+ "deps": attr.string_list(),
+ "_download_script": attr.label(default = Label("//tools:download_file.py")),
},
local = True,
implementation = _maven_jar_impl,
diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl
index 839c537b48..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,7 +104,7 @@ 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)
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
index fa4c56b559..356dfbba3c 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",