-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patharchives.bzl
More file actions
40 lines (35 loc) · 1.4 KB
/
archives.bzl
File metadata and controls
40 lines (35 loc) · 1.4 KB
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
37
38
39
40
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:versions.bzl", "VERSIONS")
def load_github_archives():
for k, v in VERSIONS.items():
if type(v) == type("") or v.get("type") != "github_archive":
continue
kwargs = dict(name = k, **v)
# Format string values, but not lists
formatted_kwargs = {}
for arg_k, arg_v in kwargs.items():
if arg_k in ["arch", "download_suffix", "repo", "type", "version"]:
continue
if type(arg_v) == type(""):
formatted_kwargs[arg_k] = arg_v.format(**kwargs)
else:
formatted_kwargs[arg_k] = arg_v
http_archive(**formatted_kwargs)
def load_http_archives():
for k, v in VERSIONS.items():
if type(v) == type("") or v.get("type") != "http_archive":
continue
kwargs = dict(name = k, **v)
# Format string values, but not lists
formatted_kwargs = {}
for arg_k, arg_v in kwargs.items():
if arg_k in ["arch", "download_suffix", "repo", "type", "version"]:
continue
if type(arg_v) == type(""):
formatted_kwargs[arg_k] = arg_v.format(**kwargs)
else:
formatted_kwargs[arg_k] = arg_v
http_archive(**formatted_kwargs)
def load_archives():
load_github_archives()
load_http_archives()