Merge changes Ie5fbd18d,I4b96d0cd into stable-2.16

* changes:
  lib: check that nongoogle.bzl doesn't grow new dependencies
  tools/nongoogle.bzl: separate out dependencies exempt from library compliance
This commit is contained in:
David Pursehouse 2019-05-12 06:28:16 +00:00 committed by Gerrit Code Review
commit 36f14811df
5 changed files with 43 additions and 6 deletions

View File

@ -5,6 +5,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar")
load("//lib/codemirror:cm.bzl", "CM_VERSION", "DIFF_MATCH_PATCH_VERSION")
load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
load("//tools:nongoogle.bzl", "declare_nongoogle_deps")
http_archive(
name = "bazel_skylib",
@ -633,12 +634,7 @@ maven_jar(
sha1 = "ed193d86e0af90cc2342aedbe73c5d86b03fa09b",
)
# Transitive dependency of commons-compress
maven_jar(
name = "tukaani-xz",
artifact = "org.tukaani:xz:1.6",
sha1 = "05b6f921f1810bdf90e25471968f741f87168b64",
)
declare_nongoogle_deps()
LUCENE_VERS = "6.6.5"

View File

@ -504,3 +504,9 @@ java_library(
visibility = ["//visibility:public"],
exports = ["@postgresql//jar"],
)
sh_test(
name = "nongoogle_test",
srcs = ["nongoogle_test.sh"],
data = ["//tools:nongoogle.bzl"],
)

17
lib/nongoogle_test.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# This test ensures that new dependencies in nongoogle.bzl go through LC review.
set -eux
bzl=$(pwd)/tools/nongoogle.bzl
TMP=$(mktemp -d || mktemp -d -t /tmp/tmp.XXXXXX)
grep 'name = "[^"]*"' ${bzl} | sed 's|^[^"]*"||g;s|".*$||g' | sort > $TMP/names
cat << EOF > $TMP/want
tukaani-xz
EOF
diff -u $TMP/names $TMP/want

View File

@ -4,6 +4,8 @@ load(
"default_java_toolchain",
)
exports_files(["nongoogle.bzl"])
py_binary(
name = "merge_jars",
srcs = ["merge_jars.py"],

16
tools/nongoogle.bzl Normal file
View File

@ -0,0 +1,16 @@
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def declare_nongoogle_deps():
"""loads dependencies that are not used at Google.
Changes to versions are exempt from library compliance review. New
dependencies must pass through library compliance review. This is
enforced by //lib:nongoogle_test.
"""
# Transitive dependency of commons-compress
maven_jar(
name = "tukaani-xz",
artifact = "org.tukaani:xz:1.6",
sha1 = "05b6f921f1810bdf90e25471968f741f87168b64",
)