build: Move bazel/utils.bzl into api/bazel (#26858)

Move bazel/utils.bzl into api/bazel

The api/... subtree depends on utils.bzl, but it is stored in //bazel,
not //api/bazel.  When the api sub-tree is exported as
"data-plane-api", the resulting repository is not buildable.

This attempts to fix that by changing the canonical location of
utils.bzl and updating the references to it.

Signed-off-by: Ryan Anderson <ryan@michonline.com>

Mirrored from https://github.com/envoyproxy/envoy @ 35ef2c4eeac8e930e3c00e40baaea5271590db41
pull/626/head
data-plane-api(Azure Pipelines) 2 years ago
parent 84d576a549
commit 2110bf3692
  1. 3
      bazel/BUILD
  2. 18
      bazel/utils.bzl

@ -1,5 +1,5 @@
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load("//:utils.bzl", "json_data")
load(":utils.bzl", "json_data")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS_SPEC")
load(":repository_locations_utils.bzl", "load_repository_locations_spec")
load(
@ -15,6 +15,7 @@ licenses(["notice"]) # Apache 2
exports_files([
"repository_locations.bzl",
"repository_locations_utils.bzl",
"utils.bzl",
])
go_proto_compiler(

@ -0,0 +1,18 @@
load("@bazel_skylib//rules:write_file.bzl", "write_file")
def json_data(
name,
data,
visibility = ["//visibility:public"],
**kwargs):
"""Write a bazel object to a file
The provided `data` object should be json serializable.
"""
write_file(
name = name,
out = "%s.json" % name,
content = json.encode(data).split("\n"),
visibility = visibility,
**kwargs
)
Loading…
Cancel
Save