forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generated_assembly_info.bzl
35 lines (33 loc) · 1.31 KB
/
generated_assembly_info.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Label of the template file to use.
_TEMPLATE = "//dotnet:AssemblyInfo.cs.template"
def _generated_assembly_info_impl(ctx):
ctx.actions.expand_template(
template = ctx.file.template,
output = ctx.outputs.source_file,
substitutions = {
"{ASSEMBLY_VERSION}": ctx.attr.version,
"{ASSEMBLY_COMPANY}": ctx.attr.company,
"{ASSEMBLY_COPYRIGHT}": ctx.attr.copyright,
"{ASSEMBLY_DESCRIPTION}": ctx.attr.description,
"{ASSEMBLY_PRODUCT}": ctx.attr.product,
"{ASSEMBLY_TITLE}": ctx.attr.title,
"{ASSEMBLY_INFORMATIONAL_VERSION}": ctx.attr.informational_version,
},
)
generated_assembly_info = rule(
implementation = _generated_assembly_info_impl,
attrs = {
"version": attr.string(mandatory = True),
"company": attr.string(mandatory = True),
"copyright": attr.string(mandatory = True),
"description": attr.string(mandatory = True),
"product": attr.string(mandatory = True),
"title": attr.string(mandatory = True),
"informational_version": attr.string(mandatory = True),
"template": attr.label(
default = Label(_TEMPLATE),
allow_single_file = True,
),
},
outputs = {"source_file": "%{name}.AssemblyInfo.cs"},
)