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

Change-Id: Ie5fbd18de68fca13f954ef4d05ea7acc7d9cfea9
diff --git a/lib/BUILD b/lib/BUILD
index 95ca4db..b3c149a 100644
--- a/lib/BUILD
+++ b/lib/BUILD
@@ -504,3 +504,9 @@
     visibility = ["//visibility:public"],
     exports = ["@postgresql//jar"],
 )
+
+sh_test(
+    name = "nongoogle_test",
+    srcs = ["nongoogle_test.sh"],
+    data = ["//tools:nongoogle.bzl"],
+)
diff --git a/lib/nongoogle_test.sh b/lib/nongoogle_test.sh
new file mode 100755
index 0000000..23b40ad
--- /dev/null
+++ b/lib/nongoogle_test.sh
@@ -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
diff --git a/tools/BUILD b/tools/BUILD
index aefb867..d4ab2a8 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -4,6 +4,8 @@
     "default_java_toolchain",
 )
 
+exports_files(["nongoogle.bzl"])
+
 py_binary(
     name = "merge_jars",
     srcs = ["merge_jars.py"],
diff --git a/tools/nongoogle.bzl b/tools/nongoogle.bzl
index 047469e..2e84717 100644
--- a/tools/nongoogle.bzl
+++ b/tools/nongoogle.bzl
@@ -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