envoy_http_archive.bzl 924 B

12345678910111213141516171819202122
  1. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  2. def envoy_http_archive(name, locations, **kwargs):
  3. # `existing_rule_keys` contains the names of repositories that have already
  4. # been defined in the Bazel workspace. By skipping repos with existing keys,
  5. # users can override dependency versions by using standard Bazel repository
  6. # rules in their WORKSPACE files.
  7. existing_rule_keys = native.existing_rules().keys()
  8. if name in existing_rule_keys:
  9. # This repository has already been defined, probably because the user
  10. # wants to override the version. Do nothing.
  11. return
  12. location = locations[name]
  13. # HTTP tarball at a given URL. Add a BUILD file if requested.
  14. http_archive(
  15. name = name,
  16. urls = location["urls"],
  17. sha256 = location["sha256"],
  18. strip_prefix = location.get("strip_prefix", ""),
  19. **kwargs
  20. )