lib: check that nongoogle.bzl doesn't grow new dependencies

Change-Id: Ie5fbd18de68fca13f954ef4d05ea7acc7d9cfea9
This commit is contained in:
Han-Wen Nienhuys 2019-04-25 12:15:41 +02:00
parent d019c27190
commit a223f5ae97
4 changed files with 29 additions and 2 deletions

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

17
lib/nongoogle_test.sh Executable 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

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

@ -1,9 +1,11 @@
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_LOCAL", "maven_jar")
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def declare_nongoogle_deps():
"""loads dependencies that are not used at Google.
These are exempt from library compliance review.
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