|
| 1 | +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 2 | +load("//bazel:versions.bzl", "VERSIONS") |
| 3 | + |
| 4 | +def load_github_archives(): |
| 5 | + for k, v in VERSIONS.items(): |
| 6 | + if type(v) == type("") or v.get("type") != "github_archive": |
| 7 | + continue |
| 8 | + kwargs = dict(name = k, **v) |
| 9 | + # Format string values, but not lists |
| 10 | + formatted_kwargs = {} |
| 11 | + for arg_k, arg_v in kwargs.items(): |
| 12 | + if arg_k in ["repo", "type", "version"]: |
| 13 | + continue |
| 14 | + if type(arg_v) == type(""): |
| 15 | + formatted_kwargs[arg_k] = arg_v.format(**kwargs) |
| 16 | + else: |
| 17 | + formatted_kwargs[arg_k] = arg_v |
| 18 | + http_archive(**formatted_kwargs) |
| 19 | + |
| 20 | +def load_http_archives(): |
| 21 | + for k, v in VERSIONS.items(): |
| 22 | + if type(v) == type("") or v.get("type") != "http_archive": |
| 23 | + continue |
| 24 | + kwargs = dict(name = k, **v) |
| 25 | + # Format string values, but not lists |
| 26 | + formatted_kwargs = {} |
| 27 | + for arg_k, arg_v in kwargs.items(): |
| 28 | + if arg_k in ["type", "version"]: |
| 29 | + continue |
| 30 | + if type(arg_v) == type(""): |
| 31 | + formatted_kwargs[arg_k] = arg_v.format(**kwargs) |
| 32 | + else: |
| 33 | + formatted_kwargs[arg_k] = arg_v |
| 34 | + http_archive(**formatted_kwargs) |
| 35 | + |
| 36 | +def load_envoy_examples_archives(): |
| 37 | + load_github_archives() |
| 38 | + load_http_archives() |
0 commit comments