diff --git a/lib/BUILD b/lib/BUILD index 95ca4db461..b3c149a72b 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -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"], +) diff --git a/lib/nongoogle_test.sh b/lib/nongoogle_test.sh new file mode 100755 index 0000000000..23b40add7e --- /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 aefb867277..d4ab2a8c02 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -4,6 +4,8 @@ load( "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 047469e292..2e84717abb 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