Make Skylark "license"-type attributes non-configurable.
Bazel has custom loading-phase logic checking "licenses" attributes.
Without this change, that logic fails with a "licenses is potentially
configurable" error.
--
MOS_MIGRATED_REVID=113890489
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index 717a132..76bbbd4 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -570,4 +570,27 @@
"invalid target name 'bad syntax': target names may not contain ' '",
"Label('//foo:bar').relative('bad syntax')");
}
+
+ @Test
+ public void testLicenseAttributesNonconfigurable() throws Exception {
+ scratch.file("test/BUILD");
+ scratch.file("test/rule.bzl",
+ "def _impl(ctx):",
+ " return",
+ "some_rule = rule(",
+ " implementation = _impl,",
+ " attrs = {",
+ " 'licenses': attr.license()",
+ " }",
+ ")");
+ scratch.file("third_party/foo/BUILD",
+ "load('/test/rule', 'some_rule')",
+ "some_rule(",
+ " name='r',",
+ " licenses = ['unencumbered']",
+ ")");
+ invalidatePackages();
+ // Should succeed without a "licenses attribute is potentially configurable" loading error:
+ createRuleContext("//third_party/foo:r");
+ }
}