1# This is here to test that built-in names can be shadowed by global names. 2# (Regression test for http://b/35984389). 3# buildifier: disable=module-docstring 4config = "value for global config variable" 5 6def my_rule_impl(ctx): 7 return [] 8 9def exercise_the_api(): 10 var1 = config_common.FeatureFlagInfo 11 var2 = platform_common.TemplateVariableInfo 12 var3 = repository_rule( 13 implementation = my_rule_impl, 14 doc = "This repository rule has documentation.", 15 ) 16 var4 = testing.ExecutionInfo({}) 17 18exercise_the_api() 19 20MyInfo = provider( 21 fields = { 22 "foo": "Something foo-related.", 23 "bar": "Something bar-related.", 24 }, 25) 26 27my_info = MyInfo(foo = "x", bar = "y") 28 29my_rule = rule( 30 implementation = my_rule_impl, 31 doc = "This rule exercises some of the build API.", 32 attrs = { 33 "src": attr.label( 34 doc = "The source file.", 35 allow_files = [".bzl"], 36 ), 37 "deps": attr.label_list( 38 doc = """ 39A list of dependencies. 40""", 41 providers = [MyInfo], 42 allow_files = False, 43 ), 44 "tool": attr.label( 45 doc = "The location of the tool to use.", 46 allow_files = True, 47 default = Label("//foo/bar/baz:target"), 48 cfg = "host", 49 executable = True, 50 ), 51 "out": attr.output( 52 doc = "The output file.", 53 mandatory = True, 54 ), 55 "extra_arguments": attr.string_list(default = []), 56 }, 57) 58