summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2019-01-10 21:44:13 +0900
committerDavid Pursehouse <dpursehouse@collab.net>2019-01-10 21:44:13 +0900
commit1d53668145adcefef5f3aa3529d92c416671cb2f (patch)
tree4af20dec36b4beedff9dd122018b171fee14753d /tools
parent34a8bdc881221902d1072cf282a9eb677af4a8bf (diff)
parentd51236b5966f4f91b4215864b24d1d36b5bec3db (diff)
Merge branch 'stable-2.15' into stable-2.16
* stable-2.15: Bazel: Automatically fix lint errors with buildifier 0.20.0 Bazel: Fix more buildifier warnings Bazel: Automatically fix lint errors with buildifier 0.20.0 Fix typo in documentation of edit preferences Bazel: Automatically fix lint errors with buildifier Change-Id: I3400928e4dca65264715dca3c29729237934f042
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.bzl4
-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, 69 insertions, 69 deletions
diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl
index 97d68d6dc1..825ac98def 100644
--- a/tools/bzl/asciidoc.bzl
+++ b/tools/bzl/asciidoc.bzl
@@ -41,17 +41,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,
)
@@ -108,23 +108,23 @@ def _asciidoc_impl(ctx):
)
_asciidoc_attrs = {
- "_exe": attr.label(
- default = Label("//java/com/google/gerrit/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("//java/com/google/gerrit/asciidoctor:asciidoc"),
+ cfg = "host",
+ allow_files = True,
+ executable = True,
+ ),
}
_asciidoc = rule(
@@ -279,11 +279,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 b60e4e4c5e..f997fcf8ea 100644
--- a/tools/bzl/classpath.bzl
+++ b/tools/bzl/classpath.bzl
@@ -8,8 +8,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 b1852141f3..d6a0464fca 100644
--- a/tools/bzl/gwt.bzl
+++ b/tools/bzl/gwt.bzl
@@ -31,9 +31,9 @@ BROWSERS = [
ALIASES = {
"chrome": "safari",
+ "edge": "gecko1_8",
"firefox": "gecko1_8",
"msie": "ie10",
- "edge": "gecko1_8",
}
MODULE = "com.google.gerrit.GerritGwtUI"
@@ -111,14 +111,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("@bazel_tools//tools/jdk:current_java_runtime"),
cfg = "host",
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 23d1ccd516..19d4436d42 100644
--- a/tools/bzl/js.bzl
+++ b/tools/bzl/js.bzl
@@ -1,10 +1,10 @@
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library")
+load("//lib/js:npm.bzl", "NPM_SHA1S", "NPM_VERSIONS")
+
NPMJS = "NPMJS"
GERRIT = "GERRIT:"
-load("//lib/js:npm.bzl", "NPM_SHA1S", "NPM_VERSIONS")
-load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library")
-
def _npm_tarball(name):
return "%s@%s.npm_binary.tgz" % (name, NPM_VERSIONS[name])
@@ -37,9 +37,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,
@@ -120,13 +120,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")),
},
)
@@ -207,12 +207,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()),
)
@@ -247,7 +247,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",
@@ -256,7 +256,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,
@@ -265,10 +265,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(
@@ -281,8 +281,8 @@ bower_component_bundle = rule(
_bower_component_bundle_impl,
attrs = _common_attrs,
outputs = {
- "zip": "%{name}.zip",
"version_json": "%{name}-versions.json",
+ "zip": "%{name}.zip",
},
)
@@ -394,11 +394,6 @@ def _bundle_output_func(name, split):
_bundle_rule = rule(
_bundle_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",
@@ -406,12 +401,13 @@ _bundle_rule = rule(
".css",
".ico",
]),
- "pkg": attr.string(mandatory = True),
- "split": attr.bool(default = True),
- "_run_npm": attr.label(
- default = Label("//tools/js:run_npm_binary.py"),
+ "app": attr.label(
+ mandatory = True,
allow_single_file = True,
),
+ "pkg": attr.string(mandatory = True),
+ "split": attr.bool(default = True),
+ "deps": attr.label_list(providers = ["transitive_zipfiles"]),
"_bundler_archive": attr.label(
default = Label("@polymer-bundler//:%s" % _npm_tarball("polymer-bundler")),
allow_single_file = True,
@@ -420,13 +416,17 @@ _bundle_rule = rule(
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,
+ ),
},
outputs = _bundle_output_func,
)
def bundle_assets(*args, **kwargs):
"""Combine html, js, css files and optionally split into js and html bundles."""
- _bundle_rule(*args, pkg = native.package_name(), **kwargs)
+ _bundle_rule(pkg = native.package_name(), *args, **kwargs)
def polygerrit_plugin(name, app, srcs = [], assets = None, plugin_name = None, **kwargs):
"""Bundles plugin dependencies for deployment.
diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl
index 08d50457f9..1246669455 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,
))
@@ -81,8 +81,8 @@ def junit_tests(name, srcs, **kwargs):
)
jvm_flags = kwargs.get("jvm_flags", [])
jvm_flags = jvm_flags + select({
- "//:java9": POST_JDK8_OPTS,
"//:java10": POST_JDK8_OPTS,
+ "//:java9": POST_JDK8_OPTS,
"//conditions:default": [],
})
native.java_test(
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 40dd769a4a..645d4156bb 100644
--- a/tools/bzl/pkg_war.bzl
+++ b/tools/bzl/pkg_war.bzl
@@ -83,7 +83,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)
@@ -92,7 +92,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)
@@ -105,7 +105,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 5ac3a362b0..5d27c472de 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",