Prevent duplicated license_kinds
Bazel fails when there are duplicate license_kinds.
Bug: 260148018
Test: go test
Change-Id: I47a27d37d66be947e4a744cd04a3cdcc0b000de4
diff --git a/android/license_test.go b/android/license_test.go
index 7222cd7..89e7f06 100644
--- a/android/license_test.go
+++ b/android/license_test.go
@@ -90,6 +90,36 @@
},
},
{
+ name: "must not duplicate license_kind",
+ fs: map[string][]byte{
+ "top/Android.bp": []byte(`
+ license_kind {
+ name: "top_by_exception_only",
+ conditions: ["by_exception_only"],
+ visibility: ["//visibility:private"],
+ }
+
+ license_kind {
+ name: "top_by_exception_only_2",
+ conditions: ["by_exception_only"],
+ visibility: ["//visibility:private"],
+ }
+
+ license {
+ name: "top_proprietary",
+ license_kinds: [
+ "top_by_exception_only",
+ "top_by_exception_only_2",
+ "top_by_exception_only"
+ ],
+ visibility: ["//visibility:public"],
+ }`),
+ },
+ expectedErrors: []string{
+ `top/Android.bp:14:5: module "top_proprietary": Duplicated license kind: "top_by_exception_only"`,
+ },
+ },
+ {
name: "license_kind module must exist",
fs: map[string][]byte{
"top/Android.bp": []byte(`