Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
Bazel: Fix genrule2 to clean up temporary folder content
Change-Id: I282f371595d01e7d36f5245c53a47c8ce4f93a11
diff --git a/README.md b/README.md
index 25fd058..2d2d339 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,6 @@
gerrit_plugin(
name = "reviewers",
srcs = glob(["src/main/java/**/*.java"]),
- gwt_module = "com.googlesource.gerrit.plugins.reviewers.ReviewersForm",
manifest_entries = [
"Gerrit-PluginName: reviewers",
"Gerrit-Module: com.googlesource.gerrit.plugins.reviewers.Module",
@@ -81,7 +80,7 @@
## gerrit_plugin
```python
-gerrit_plugin(name, srcs, resources, gwt_module, deps, manifest_entries):
+gerrit_plugin(name, srcs, resources, deps, manifest_entries):
```
### Implicit output target
@@ -126,15 +125,6 @@
</td>
</tr>
<tr>
- <td><code>gwt_module</code></td>
- <td>
- <code>String, optional</code>
- <p>
- Name of GWT UI module.
- </p>
- </td>
- </tr>
- <tr>
<td><code>deps</code></td>
<td>
<code>List of labels, optional</code>
diff --git a/gerrit_api.bzl b/gerrit_api.bzl
index aad4bd0..15efe1d 100644
--- a/gerrit_api.bzl
+++ b/gerrit_api.bzl
@@ -6,7 +6,7 @@
gerrit_api is rule for fetching Gerrit plugin API using Bazel.
"""
-VER = "2.16.12"
+VER = "3.0.3"
def gerrit_api():
bouncycastle_repos()
@@ -15,28 +15,18 @@
maven_jar(
name = "gerrit_plugin_api",
artifact = "com.google.gerrit:gerrit-plugin-api:" + VER,
- sha1 = "1e7dfc2685a8ac24a1ab755fa75d4c789e339b57",
- )
- maven_jar(
- name = "gerrit_plugin_gwtui",
- artifact = "com.google.gerrit:gerrit-plugin-gwtui:" + VER,
- sha1 = "32250869418789081a70bddead1b268fe3e6c179",
- exclude = ["com/google/gwt/*"],
+ sha1 = "d52314ea1245d31e67dd7de5731cb2db854ef3e3",
)
maven_jar(
name = "gerrit_acceptance_framework",
artifact = "com.google.gerrit:gerrit-acceptance-framework:" + VER,
- sha1 = "c99449905a6d56dafaa8362b0d9770d160535a8f",
+ sha1 = "ae2cdc1bdf8922e5bd9fb3fef0810d060e4ec5c8",
)
native.bind(
name = "gerrit-plugin-api",
actual = "@gerrit_plugin_api//jar",
)
native.bind(
- name = "gerrit-plugin-gwtui",
- actual = "@gerrit_plugin_gwtui//jar",
- )
- native.bind(
name = "gerrit-acceptance-framework",
actual = "@gerrit_acceptance_framework//jar",
)
@@ -45,10 +35,6 @@
actual = "@gerrit_plugin_api//jar:neverlink",
)
native.bind(
- name = "gerrit-plugin-gwtui-neverlink",
- actual = "@gerrit_plugin_gwtui//jar:neverlink",
- )
- native.bind(
name = "gerrit-acceptance-framework-neverlink",
actual = "@gerrit_acceptance_framework//jar:neverlink",
)
diff --git a/gerrit_api_maven_local.bzl b/gerrit_api_maven_local.bzl
index a052e85..bdeb4ba 100644
--- a/gerrit_api_maven_local.bzl
+++ b/gerrit_api_maven_local.bzl
@@ -6,7 +6,7 @@
gerrit_api is rule for fetching Gerrit plugin API using Bazel.
"""
-VER = "2.16.5-SNAPSHOT"
+VER = "3.0.2-SNAPSHOT"
def gerrit_api_maven_local():
bouncycastle_repos()
@@ -18,11 +18,6 @@
repository = MAVEN_LOCAL,
)
maven_jar(
- name = "gerrit_plugin_gwtui",
- artifact = "com.google.gerrit:gerrit-plugin-gwtui:" + VER,
- repository = MAVEN_LOCAL,
- )
- maven_jar(
name = "gerrit_acceptance_framework",
artifact = "com.google.gerrit:gerrit-acceptance-framework:" + VER,
repository = MAVEN_LOCAL,
@@ -32,10 +27,6 @@
actual = "@gerrit_plugin_api//jar",
)
native.bind(
- name = "gerrit-plugin-gwtui",
- actual = "@gerrit_plugin_gwtui//jar",
- )
- native.bind(
name = "gerrit-acceptance-framework",
actual = "@gerrit_acceptance_framework//jar",
)
@@ -44,10 +35,6 @@
actual = "@gerrit_plugin_api//jar:neverlink",
)
native.bind(
- name = "gerrit-plugin-gwtui-neverlink",
- actual = "@gerrit_plugin_gwtui//jar:neverlink",
- )
- native.bind(
name = "gerrit-acceptance-framework-neverlink",
actual = "@gerrit_acceptance_framework//jar:neverlink",
)
diff --git a/gerrit_gwt.bzl b/gerrit_gwt.bzl
deleted file mode 100644
index c1980cf..0000000
--- a/gerrit_gwt.bzl
+++ /dev/null
@@ -1,158 +0,0 @@
-load("//tools:maven_jar.bzl", "maven_jar")
-
-GWT_VER = "2.8.2"
-
-OW2_VER = "5.1"
-
-def gerrit_gwt():
- maven_jar(
- name = "gwt_user",
- artifact = "com.google.gwt:gwt-user:" + GWT_VER,
- sha1 = "a2b9be2c996a658c4e009ba652a9c6a81c88a797",
- attach_source = False,
- )
- maven_jar(
- name = "gwt_dev",
- artifact = "com.google.gwt:gwt-dev:" + GWT_VER,
- sha1 = "7a87e060bbf129386b7ae772459fb9f87297c332",
- attach_source = False,
- )
- maven_jar(
- name = "javax_validation",
- artifact = "javax.validation:validation-api:1.0.0.GA",
- sha1 = "b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e",
- src_sha1 = "7a561191db2203550fbfa40d534d4997624cd369",
- )
- maven_jar(
- name = "jsinterop_annotations",
- artifact = "com.google.jsinterop:jsinterop-annotations:1.0.2",
- sha1 = "abd7319f53d018e11108a88f599bd16492448dd2",
- src_sha1 = "33716f8aef043f2f02b78ab4a1acda6cd90a7602",
- )
- maven_jar(
- name = "findbugs_jsr305",
- artifact = "com.google.code.findbugs:jsr305:3.0.1",
- sha1 = "f7be08ec23c21485b9b5a1cf1654c2ec8c58168d",
- attach_source = False,
- )
- maven_jar(
- name = "ant_artifact",
- artifact = "ant:ant:1.6.5",
- sha1 = "7d18faf23df1a5c3a43613952e0e8a182664564b",
- src_sha1 = "9e0a847494563f35f9b02846a1c1eb4aa2ee5a9a",
- )
- maven_jar(
- name = "colt_artifact",
- artifact = "colt:colt:1.2.0",
- attach_source = False,
- sha1 = "0abc984f3adc760684d49e0f11ddf167ba516d4f",
- )
- maven_jar(
- name = "tapestry_artifact",
- artifact = "tapestry:tapestry:4.0.2",
- attach_source = False,
- sha1 = "e855a807425d522e958cbce8697f21e9d679b1f7",
- )
- maven_jar(
- name = "w3c_css_sac",
- artifact = "org.w3c.css:sac:1.3",
- attach_source = False,
- sha1 = "cdb2dcb4e22b83d6b32b93095f644c3462739e82",
- )
- maven_jar(
- name = "ow2_asm",
- artifact = "org.ow2.asm:asm:" + OW2_VER,
- sha1 = "5ef31c4fe953b1fd00b8a88fa1d6820e8785bb45",
- )
- maven_jar(
- name = "ow2_asm_analysis",
- artifact = "org.ow2.asm:asm-analysis:" + OW2_VER,
- sha1 = "6d1bf8989fc7901f868bee3863c44f21aa63d110",
- )
- maven_jar(
- name = "ow2_asm_commons",
- artifact = "org.ow2.asm:asm-commons:" + OW2_VER,
- sha1 = "25d8a575034dd9cfcb375a39b5334f0ba9c8474e",
- )
- maven_jar(
- name = "ow2_asm_tree",
- artifact = "org.ow2.asm:asm-tree:" + OW2_VER,
- sha1 = "87b38c12a0ea645791ead9d3e74ae5268d1d6c34",
- )
- maven_jar(
- name = "ow2_asm_util",
- artifact = "org.ow2.asm:asm-util:" + OW2_VER,
- sha1 = "b60e33a6bd0d71831e0c249816d01e6c1dd90a47",
- )
- native.bind(
- name = "gwt-user",
- actual = "@gwt_user//jar",
- )
- native.bind(
- name = "gwt-dev",
- actual = "@gwt_dev//jar",
- )
- native.bind(
- name = "gwt-user-neverlink",
- actual = "@gwt_user//jar:neverlink",
- )
- native.bind(
- name = "gwt-dev-neverlink",
- actual = "@gwt_dev//jar:neverlink",
- )
- native.bind(
- name = "javax-validation",
- actual = "@javax_validation//jar",
- )
- native.bind(
- name = "javax-validation-src",
- actual = "@javax_validation//src",
- )
- native.bind(
- name = "jsinterop-annotations",
- actual = "@jsinterop_annotations//jar",
- )
- native.bind(
- name = "jsinterop-annotations-src",
- actual = "@jsinterop_annotations//src",
- )
- native.bind(
- name = "jsr305",
- actual = "@findbugs_jsr305//jar",
- )
- native.bind(
- name = "ant",
- actual = "@ant_artifact//jar",
- )
- native.bind(
- name = "colt",
- actual = "@colt_artifact//jar",
- )
- native.bind(
- name = "tapestry",
- actual = "@tapestry_artifact//jar",
- )
- native.bind(
- name = "w3c-css-sac",
- actual = "@w3c_css_sac//jar",
- )
- native.bind(
- name = "ow2-asm",
- actual = "@ow2_asm//jar",
- )
- native.bind(
- name = "ow2-asm-analysis",
- actual = "@ow2_asm_analysis//jar",
- )
- native.bind(
- name = "ow2-asm-commons",
- actual = "@ow2_asm_commons//jar",
- )
- native.bind(
- name = "ow2-asm-tree",
- actual = "@ow2_asm_tree//jar",
- )
- native.bind(
- name = "ow2-asm-util",
- actual = "@ow2_asm_util//jar",
- )
diff --git a/gerrit_plugin.bzl b/gerrit_plugin.bzl
index 301c817..9df7560 100644
--- a/gerrit_plugin.bzl
+++ b/gerrit_plugin.bzl
@@ -6,21 +6,11 @@
_plugin_test_deps = "PLUGIN_TEST_DEPS",
)
load("//tools:genrule2.bzl", "genrule2")
-load(
- "//tools:gwt.bzl",
- "GWT_COMPILER_ARGS",
- "GWT_JVM_ARGS",
- "GWT_PLUGIN_DEPS_NEVERLINK",
- "GWT_TRANSITIVE_DEPS",
- "gwt_binary",
- _gwt_plugin_deps = "GWT_PLUGIN_DEPS",
-)
"""Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)
gerrit_plugin is rule for building Gerrit plugins using Bazel.
"""
-GWT_PLUGIN_DEPS = _gwt_plugin_deps
PLUGIN_DEPS = _plugin_deps
PLUGIN_DEPS_NEVERLINK = _plugin_deps_neverlink
PLUGIN_TEST_DEPS = _plugin_test_deps
@@ -30,17 +20,12 @@
deps = [],
provided_deps = [],
srcs = [],
- gwt_module = [],
resources = [],
manifest_entries = [],
dir_name = None,
target_suffix = "",
**kwargs):
- gwt_deps = []
static_jars = []
- if gwt_module:
- static_jars = [":%s-static" % name]
- gwt_deps = GWT_PLUGIN_DEPS_NEVERLINK
if not dir_name:
dir_name = name
@@ -49,7 +34,7 @@
name = name + "__plugin",
srcs = srcs,
resources = resources,
- deps = provided_deps + deps + gwt_deps + PLUGIN_DEPS_NEVERLINK,
+ deps = provided_deps + deps + PLUGIN_DEPS_NEVERLINK,
visibility = ["//visibility:public"],
**kwargs
)
@@ -63,36 +48,6 @@
visibility = ["//visibility:public"],
)
- if gwt_module:
- java_library(
- name = name + "__gwt_module",
- resources = depset(srcs + resources).to_list(),
- runtime_deps = deps + GWT_PLUGIN_DEPS,
- visibility = ["//visibility:public"],
- )
- genrule2(
- name = "%s-static" % name,
- cmd = " && ".join([
- "mkdir -p $$TMP/static",
- "unzip -qd $$TMP/static $(location %s__gwt_application)" % name,
- "cd $$TMP",
- "zip -qr $$ROOT/$@ .",
- ]),
- tools = [":%s__gwt_application" % name],
- outs = ["%s-static.jar" % name],
- )
- gwt_binary(
- name = name + "__gwt_application",
- module = [gwt_module],
- deps = GWT_PLUGIN_DEPS + GWT_TRANSITIVE_DEPS + [
- "//external:gwt-dev",
- "//external:gwt-user",
- ],
- module_deps = [":%s__gwt_module" % name],
- compiler_args = GWT_COMPILER_ARGS,
- jvm_args = GWT_JVM_ARGS,
- )
-
native.genrule(
name = name + "__gen_stamp_info",
stamp = 1,
diff --git a/tools/gwt.bzl b/tools/gwt.bzl
deleted file mode 100644
index aada689..0000000
--- a/tools/gwt.bzl
+++ /dev/null
@@ -1,287 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Port of Buck native gwt_binary() rule. See discussion in context of
-# https://github.com/facebook/buck/issues/109
-load("//tools:genrule2.bzl", "genrule2")
-load("//tools:java.bzl", "java_library2")
-
-BROWSERS = [
- "chrome",
- "firefox",
- "gecko1_8",
- "safari",
- "msie",
- "ie8",
- "ie9",
- "ie10",
- "edge",
-]
-
-ALIASES = {
- "chrome": "safari",
- "edge": "gecko1_8",
- "firefox": "gecko1_8",
- "msie": "ie10",
-}
-
-MODULE = "com.google.gerrit.GerritGwtUI"
-
-GWT_COMPILER = "com.google.gwt.dev.Compiler"
-
-GWT_JVM_ARGS = ["-Xmx512m"]
-
-GWT_COMPILER_ARGS = [
- "-XdisableClassMetadata",
-]
-
-GWT_COMPILER_ARGS_RELEASE_MODE = GWT_COMPILER_ARGS + [
- "-XdisableCastChecking",
-]
-
-GWT_PLUGIN_DEPS_NEVERLINK = [
- "//external:gerrit-plugin-gwtui-neverlink",
- "//external:gwt-user-neverlink",
-]
-
-GWT_PLUGIN_DEPS = [
- "//external:gerrit-plugin-gwtui",
-]
-
-GWT_TRANSITIVE_DEPS = [
- "//external:ant",
- "//external:colt",
- "//external:javax-validation",
- "//external:javax-validation-src",
- "//external:jsinterop-annotations",
- "//external:jsinterop-annotations-src",
- "//external:jsr305",
- "//external:tapestry",
- "//external:w3c-css-sac",
- "//external:ow2-asm",
- "//external:ow2-asm-analysis",
- "//external:ow2-asm-commons",
- "//external:ow2-asm-tree",
- "//external:ow2-asm-util",
-]
-
-DEPS = GWT_TRANSITIVE_DEPS + [
- "//:gwt-dev",
-]
-
-USER_AGENT_XML = """<module rename-to='gerrit_ui'>
-<inherits name='%s'/>
-<set-property name='user.agent' value='%s'/>
-<set-property name='locale' value='default'/>
-</module>
-"""
-
-def gwt_module(gwt_xml = None, resources = [], srcs = [], **kwargs):
- if gwt_xml:
- resources = resources + [gwt_xml]
-
- java_library2(
- srcs = srcs,
- resources = resources,
- **kwargs
- )
-
-def _gwt_user_agent_module(ctx):
- """Generate user agent specific GWT module."""
- if not ctx.attr.user_agent:
- return None
-
- ua = ctx.attr.user_agent
- impl = ua
- if ua in ALIASES:
- impl = ALIASES[ua]
-
- # intermediate artifact: user agent speific GWT xml file
- 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.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([
- "p=$PWD",
- "mkdir -p %s" % dir,
- "cd %s" % dir,
- "mkdir -p $(dirname %s)" % gwt,
- "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.actions.run_shell(
- inputs = [gwt_user_agent_xml] + ctx.files._zip,
- outputs = [gwt_user_agent_zip],
- command = cmd,
- mnemonic = "GenerateUserAgentGWTModule",
- )
-
- return struct(
- zip = gwt_user_agent_zip,
- module = MODULE + "_" + ua,
- )
-
-def _gwt_binary_impl(ctx):
- module = ctx.attr.module[0]
- output_zip = ctx.outputs.output
- output_dir = output_zip.path + ".gwt_output"
- deploy_dir = output_zip.path + ".gwt_deploy"
-
- deps = _get_transitive_closure(ctx)
-
- paths = [dep.path for dep in deps.to_list()]
-
- gwt_user_agent_modules = []
- ua = _gwt_user_agent_module(ctx)
- if ua:
- paths.append(ua.zip.path)
- gwt_user_agent_modules.append(ua.zip)
- module = ua.module
-
- cmd = "%s %s -Dgwt.normalizeTimestamps=true -cp %s %s -war %s -deploy %s " % (
- ctx.attr._jdk[java_common.JavaRuntimeInfo].java_executable_exec_path,
- " ".join(ctx.attr.jvm_args),
- ":".join(paths),
- GWT_COMPILER,
- output_dir,
- deploy_dir,
- )
-
- # TODO(davido): clean up command concatenation
- cmd = cmd + " ".join([
- "-style %s" % ctx.attr.style,
- "-optimize %s" % ctx.attr.optimize,
- "-strict",
- " ".join(ctx.attr.compiler_args),
- module + "\n",
- "rm -rf %s/gwt-unitCache\n" % output_dir,
- "root=`pwd`\n",
- "cd %s; $root/%s Cc ../%s $(find .)\n" % (
- output_dir,
- ctx.executable._zip.path,
- output_zip.basename,
- ),
- ])
-
- ctx.actions.run_shell(
- inputs = depset(direct = gwt_user_agent_modules, transitive = [deps]),
- outputs = [output_zip],
- tools = ctx.files._jdk + ctx.files._zip,
- mnemonic = "GwtBinary",
- progress_message = "GWT compiling " + output_zip.short_path,
- command = "set -e\n" + cmd,
- )
-
-def _get_transitive_closure(ctx):
- deps = []
- for dep in ctx.attr.module_deps:
- deps.append(dep[JavaInfo].transitive_runtime_deps)
- deps.append(dep[JavaInfo].transitive_source_jars)
- for dep in ctx.attr.deps:
- if JavaInfo in dep:
- deps.append(dep[JavaInfo].transitive_runtime_deps)
- elif hasattr(dep, "files"):
- deps.append(dep.files)
-
- return depset(transitive = deps)
-
-gwt_binary = rule(
- attrs = {
- "compiler_args": attr.string_list(),
- "jvm_args": attr.string_list(),
- "module": attr.string_list(default = [MODULE]),
- "module_deps": attr.label_list(allow_files = [".jar"]),
- "optimize": attr.string(default = "9"),
- "style": attr.string(default = "OBF"),
- "user_agent": attr.string(),
- "deps": attr.label_list(allow_files = [".jar"]),
- "_jdk": attr.label(
- default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
- cfg = "host",
- ),
- "_zip": attr.label(
- default = Label("@bazel_tools//tools/zip:zipper"),
- cfg = "host",
- executable = True,
- allow_single_file = True,
- ),
- },
- outputs = {
- "output": "%{name}.zip",
- },
- implementation = _gwt_binary_impl,
-)
-
-def gwt_genrule(suffix = ""):
- dbg = "ui_dbg" + suffix
- opt = "ui_opt" + suffix
- module_dep = ":ui_module" + suffix
- args = GWT_COMPILER_ARGS_RELEASE_MODE if suffix == "_r" else GWT_COMPILER_ARGS
-
- genrule2(
- name = "ui_optdbg" + suffix,
- srcs = [
- ":" + dbg,
- ":" + opt,
- ],
- cmd = "cd $$TMP;" +
- "unzip -q $$ROOT/$(location :%s);" % dbg +
- "mv" +
- " gerrit_ui/gerrit_ui.nocache.js" +
- " gerrit_ui/dbg_gerrit_ui.nocache.js;" +
- "unzip -qo $$ROOT/$(location :%s);" % opt +
- "mkdir -p $$(dirname $@);" +
- "zip -qr $$ROOT/$@ .",
- outs = ["ui_optdbg" + suffix + ".zip"],
- visibility = ["//visibility:public"],
- )
-
- gwt_binary(
- name = opt,
- module = [MODULE],
- module_deps = [module_dep],
- deps = DEPS,
- compiler_args = args,
- jvm_args = GWT_JVM_ARGS,
- )
-
- gwt_binary(
- name = dbg,
- style = "PRETTY",
- optimize = "0",
- module_deps = [module_dep],
- deps = DEPS,
- compiler_args = GWT_COMPILER_ARGS,
- jvm_args = GWT_JVM_ARGS,
- )
-
-def gwt_user_agent_permutations():
- for ua in BROWSERS:
- gwt_binary(
- name = "ui_%s" % ua,
- user_agent = ua,
- style = "PRETTY",
- optimize = "0",
- module = [MODULE],
- module_deps = [":ui_module"],
- deps = DEPS,
- compiler_args = GWT_COMPILER_ARGS,
- jvm_args = GWT_JVM_ARGS,
- )