forked from player-ui/player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_constants.bzl
36 lines (31 loc) · 901 Bytes
/
build_constants.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
36
def _build_constants_impl(repository_ctx):
_BUILD_FILE = """
# DO NOT EDIT: automatically generated for _build_constants rule
filegroup(
name = 'files',
srcs = glob(['**']),
visibility = ['//visibility:public']
)
"""
repository_ctx.file("BUILD", _BUILD_FILE, False)
version = repository_ctx.read(repository_ctx.attr.version_file)
_CONSTANTS_FILE = """
# DO NOT EDIT: automatically generated for _build_constants rule
VERSION = \"{version}\"
"""
repository_ctx.file(
"constants.bzl",
_CONSTANTS_FILE.format(version = version),
False,
)
_build_constants = repository_rule(
implementation = _build_constants_impl,
attrs = {
"version_file": attr.label(
default = Label("//:VERSION"),
allow_single_file = True,
),
},
)
def build_constants():
_build_constants(name = "build_constants")