Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: Remove unnecessary annotations from reindex test classes AbstractReindexTests: Assert account index and group index AbstractElasticIndex: Rename getActions to getDeleteActions dev-bazel: Improve documentation of build caches Hoist declaration of TestName up to GerritBaseTests Bazel: Replace native {http,git}_archive with Skylark rules Bazel: Bump rules_closure to 0.7.0 dev-contributing: Update link to buildifier tool dev-contributing: Update buildifier to latest released version Bump minimum Bazel version to 0.14.0 and activate caches Change-Id: I27a88f0887b0d1e3af92fe2934d9e54222012e0f
This commit is contained in:
commit
efe7493467
|
@ -0,0 +1,133 @@
|
|||
Date: Wed, 30 May 2018 21:22:18 +0200
|
||||
Subject: [PATCH] Replace native {http,git}_archive with Skylark rules
|
||||
|
||||
See [1] for more details.
|
||||
|
||||
Test Plan:
|
||||
|
||||
* Apply this CL on Bazel master: [2] and build bazel
|
||||
* Run with this custom built bazel version:
|
||||
|
||||
$ bazel test //javatests/...
|
||||
$ bazel test //closure/...
|
||||
|
||||
[1] https://groups.google.com/d/topic/bazel-discuss/dO2MHQLwJF0/discussion
|
||||
[2] https://bazel-review.googlesource.com/#/c/bazel/+/55932/
|
||||
---
|
||||
closure/repositories.bzl | 23 ++++++++++++-----------
|
||||
1 file changed, 12 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/closure/repositories.bzl b/closure/repositories.bzl
|
||||
index 9b84a72..2816fb6 100644
|
||||
--- closure/repositories.bzl
|
||||
+++ closure/repositories.bzl
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
"""External dependencies for Closure Rules."""
|
||||
|
||||
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
|
||||
load("//closure/private:java_import_external.bzl", "java_import_external")
|
||||
load("//closure/private:platform_http_file.bzl", "platform_http_file")
|
||||
load("//closure:filegroup_external.bzl", "filegroup_external")
|
||||
@@ -405,7 +406,7 @@ def com_google_common_html_types():
|
||||
)
|
||||
|
||||
def com_google_common_html_types_html_proto():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "com_google_common_html_types_html_proto",
|
||||
sha256 = "6ece202f11574e37d0c31d9cf2e9e11a0dbc9218766d50d211059ebd495b49c3",
|
||||
urls = [
|
||||
@@ -633,7 +634,7 @@ def com_google_javascript_closure_compiler():
|
||||
|
||||
def com_google_javascript_closure_library():
|
||||
# After updating: bazel run //closure/library:regenerate -- "$PWD"
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_javascript_closure_library",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/google/closure-library/archive/v20180405.tar.gz",
|
||||
@@ -658,7 +659,7 @@ def com_google_jsinterop_annotations():
|
||||
|
||||
def com_google_protobuf():
|
||||
# Note: Protobuf 3.6.0+ is going to use C++11
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_protobuf",
|
||||
strip_prefix = "protobuf-3.5.1",
|
||||
sha256 = "826425182ee43990731217b917c5c3ea7190cfda141af4869e6d4ad9085a740f",
|
||||
@@ -669,7 +670,7 @@ def com_google_protobuf():
|
||||
)
|
||||
|
||||
def com_google_protobuf_js():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_protobuf_js",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.5.1.tar.gz",
|
||||
@@ -722,7 +723,7 @@ def com_google_template_soy():
|
||||
)
|
||||
|
||||
def com_google_template_soy_jssrc():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_template_soy_jssrc",
|
||||
sha256 = "c76ab4cb6e46a7c76336640b3c40d6897b420209a6c0905cdcd32533dda8126a",
|
||||
urls = [
|
||||
@@ -757,7 +758,7 @@ def com_squareup_javapoet():
|
||||
)
|
||||
|
||||
def fonts_noto_hinted_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "fonts_noto_hinted_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/f/fonts-noto/fonts-noto-hinted_20161116-1_all.deb",
|
||||
@@ -767,7 +768,7 @@ def fonts_noto_hinted_deb():
|
||||
)
|
||||
|
||||
def fonts_noto_mono_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "fonts_noto_mono_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/f/fonts-noto/fonts-noto-mono_20161116-1_all.deb",
|
||||
@@ -801,7 +802,7 @@ def javax_inject():
|
||||
)
|
||||
|
||||
def libexpat_amd64_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "libexpat_amd64_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/e/expat/libexpat1_2.1.0-6+deb8u3_amd64.deb",
|
||||
@@ -811,7 +812,7 @@ def libexpat_amd64_deb():
|
||||
)
|
||||
|
||||
def libfontconfig_amd64_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "libfontconfig_amd64_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/f/fontconfig/libfontconfig1_2.11.0-6.3+deb8u1_amd64.deb",
|
||||
@@ -821,7 +822,7 @@ def libfontconfig_amd64_deb():
|
||||
)
|
||||
|
||||
def libfreetype_amd64_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "libfreetype_amd64_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/f/freetype/libfreetype6_2.5.2-3+deb8u1_amd64.deb",
|
||||
@@ -831,7 +832,7 @@ def libfreetype_amd64_deb():
|
||||
)
|
||||
|
||||
def libpng_amd64_deb():
|
||||
- native.http_file(
|
||||
+ http_file(
|
||||
name = "libpng_amd64_deb",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/http.us.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.50-2+deb8u2_amd64.deb",
|
||||
--
|
||||
2.16.3
|
||||
|
|
@ -364,6 +364,29 @@ To consume the JGit dependency from the development tree, edit
|
|||
`lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a
|
||||
JGit repository.
|
||||
|
||||
[[bazel-local-caches]]
|
||||
|
||||
To accelerate builds, several caches are activated per default:
|
||||
|
||||
* ~/.gerritcodereview/bazel-cache/downloaded-artifacts
|
||||
* ~/.gerritcodereview/bazel-cache/repository
|
||||
* ~/.gerritcodereview/bazel-cache/cas
|
||||
|
||||
Currently none of these caches have a maximum size limit. See
|
||||
link:https://github.com/bazelbuild/bazel/issues/5139[this bazel issue] for
|
||||
details. Users should watch the cache sizes and clean them manually if
|
||||
necessary.
|
||||
|
||||
Due to the `--experimental_strict_action_env` option used in `bazelrc`
|
||||
it is possible that some commands required by the build are not found
|
||||
on the PATH, causing the build to fail. In this case the PATH used in
|
||||
the build can be overridden with the `--action_env=PATH` directive in
|
||||
the user's `~/.bazelrc` file, for example:
|
||||
|
||||
----
|
||||
build --action_env=PATH=/usr/local/opt/coreutils/libexec/gnubin/:/usr/local/bin/:/usr/bin/
|
||||
----
|
||||
|
||||
GERRIT
|
||||
------
|
||||
Part of link:index.html[Gerrit Code Review]
|
||||
|
|
|
@ -165,7 +165,8 @@ Guide].
|
|||
To format Java source code, Gerrit uses the
|
||||
link:https://github.com/google/google-java-format[`google-java-format`]
|
||||
tool (version 1.5), and to format Bazel BUILD and WORKSPACE files the
|
||||
link:https://github.com/bazelbuild/buildifier[`buildifier`] tool (version 0.6.0).
|
||||
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
|
||||
tool (version 0.11.1).
|
||||
These tools automatically apply format according to the style guides; this
|
||||
streamlines code review by reducing the need for time-consuming, tedious,
|
||||
and contentious discussions about trivial issues like whitespace.
|
||||
|
|
13
WORKSPACE
13
WORKSPACE
|
@ -1,5 +1,6 @@
|
|||
workspace(name = "gerrit")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
|
||||
load("//tools/bzl:maven_jar.bzl", "maven_jar", "GERRIT", "MAVEN_LOCAL")
|
||||
load("//lib/codemirror:cm.bzl", "CM_VERSION", "DIFF_MATCH_PATCH_VERSION")
|
||||
load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
|
||||
|
@ -13,9 +14,11 @@ http_archive(
|
|||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_closure",
|
||||
sha256 = "6691c58a2cd30a86776dd9bb34898b041e37136f2dc7e24cadaeaf599c95c657",
|
||||
strip_prefix = "rules_closure-08039ba8ca59f64248bb3b6ae016460fe9c9914f",
|
||||
url = "https://github.com/bazelbuild/rules_closure/archive/08039ba8ca59f64248bb3b6ae016460fe9c9914f.tar.gz",
|
||||
build_file_content = "exports_files([\"0001-Replace-native-http-git-_archive-with-Skylark-rules.patch\"])",
|
||||
patches = ["//:0001-Replace-native-http-git-_archive-with-Skylark-rules.patch"],
|
||||
sha256 = "a80acb69c63d5f6437b099c111480a4493bad4592015af2127a2f49fb7512d8d",
|
||||
strip_prefix = "rules_closure-0.7.0",
|
||||
url = "https://github.com/bazelbuild/rules_closure/archive/0.7.0.tar.gz",
|
||||
)
|
||||
|
||||
# File is specific to Polymer and copied from the Closure Github -- should be
|
||||
|
@ -24,12 +27,12 @@ http_archive(
|
|||
http_file(
|
||||
name = "polymer_closure",
|
||||
sha256 = "5a589bdba674e1fec7188e9251c8624ebf2d4d969beb6635f9148f420d1e08b1",
|
||||
url = "https://raw.githubusercontent.com/google/closure-compiler/775609aad61e14aef289ebec4bfc09ad88877f9e/contrib/externs/polymer-1.0.js",
|
||||
urls = ["https://raw.githubusercontent.com/google/closure-compiler/775609aad61e14aef289ebec4bfc09ad88877f9e/contrib/externs/polymer-1.0.js"],
|
||||
)
|
||||
|
||||
load("@bazel_skylib//:lib.bzl", "versions")
|
||||
|
||||
versions.check(minimum_bazel_version = "0.7.0")
|
||||
versions.check(minimum_bazel_version = "0.14.0")
|
||||
|
||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
|
||||
|
||||
|
|
|
@ -39,11 +39,9 @@ import java.nio.file.Files;
|
|||
import java.util.Set;
|
||||
import org.eclipse.jgit.storage.file.FileBasedConfig;
|
||||
import org.eclipse.jgit.util.FS;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@NoHttpd
|
||||
@Ignore
|
||||
public abstract class AbstractReindexTests extends StandaloneSiteTest {
|
||||
/** @param injector injector */
|
||||
public abstract void configureIndex(Injector injector) throws Exception;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
package com.google.gerrit.acceptance.pgm;
|
||||
|
||||
import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.gerrit.elasticsearch.ElasticContainer;
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils;
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
|
@ -23,10 +22,7 @@ import com.google.inject.Injector;
|
|||
import java.util.UUID;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@NoHttpd
|
||||
@Ignore
|
||||
public class ElasticReindexIT extends AbstractReindexTests {
|
||||
private static ElasticContainer<?> container;
|
||||
|
||||
|
|
|
@ -14,12 +14,9 @@
|
|||
|
||||
package com.google.gerrit.acceptance.pgm;
|
||||
|
||||
import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
@NoHttpd
|
||||
public class ReindexIT extends AbstractReindexTests {
|
||||
|
||||
@Override
|
||||
public void configureIndex(Injector injector) throws Exception {}
|
||||
}
|
||||
|
|
|
@ -116,13 +116,13 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void delete(K c) throws IOException {
|
||||
public void delete(K id) throws IOException {
|
||||
String uri = getURI(indexNameRaw, BULK);
|
||||
Response response = postRequest(addActions(c), uri, getRefreshParam());
|
||||
Response response = postRequest(getDeleteActions(id), uri, getRefreshParam());
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode != HttpStatus.SC_OK) {
|
||||
throw new IOException(
|
||||
String.format("Failed to delete %s from index %s: %s", c, indexName, statusCode));
|
||||
String.format("Failed to delete %s from index %s: %s", id, indexName, statusCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,15 +150,14 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract String addActions(K c);
|
||||
protected abstract String getDeleteActions(K id);
|
||||
|
||||
protected abstract String getMappings();
|
||||
|
||||
protected abstract String getId(V v);
|
||||
|
||||
protected String delete(String type, K c) {
|
||||
String id = c.toString();
|
||||
return new DeleteRequest(id, indexNameRaw, type).toString();
|
||||
protected String delete(String type, K id) {
|
||||
return new DeleteRequest(id.toString(), indexNameRaw, type).toString();
|
||||
}
|
||||
|
||||
protected void addNamedElement(String name, JsonObject element, JsonArray array) {
|
||||
|
|
|
@ -110,8 +110,8 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String addActions(Account.Id c) {
|
||||
return delete(ACCOUNTS, c);
|
||||
protected String getDeleteActions(Account.Id a) {
|
||||
return delete(ACCOUNTS, a);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -165,7 +165,7 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String addActions(Id c) {
|
||||
protected String getDeleteActions(Id c) {
|
||||
return delete(OPEN_CHANGES, c) + delete(CLOSED_CHANGES, c);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,8 +109,8 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, I
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String addActions(AccountGroup.UUID c) {
|
||||
return delete(GROUPS, c);
|
||||
protected String getDeleteActions(AccountGroup.UUID g) {
|
||||
return delete(GROUPS, g);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,9 +18,16 @@ package(
|
|||
|
||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
|
||||
|
||||
genrule(
|
||||
name = "polymer_closure_renamed",
|
||||
srcs = ["@polymer_closure//file"],
|
||||
outs = ["polymer_closure_renamed.js"],
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
closure_js_library(
|
||||
name = "polymer_closure",
|
||||
srcs = ["@polymer_closure//file"],
|
||||
srcs = [":polymer_closure_renamed"],
|
||||
data = ["//lib:LICENSE-Apache2.0"],
|
||||
no_closure_library = True,
|
||||
)
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
build --workspace_status_command=./tools/workspace-status.sh --strategy=Closure=worker
|
||||
build --disk_cache=~/.gerritcodereview/bazel-cache/cas
|
||||
build --repository_cache=~/.gerritcodereview/bazel-cache/repository
|
||||
build --experimental_strict_action_env
|
||||
test --build_tests_only
|
||||
|
|
Loading…
Reference in New Issue