Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load("//:utils.bzl", "json_data")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS_SPEC")

licenses(["notice"]) # Apache 2

Expand All @@ -15,3 +17,8 @@ go_proto_compiler(
valid_archive = False,
visibility = ["//visibility:public"],
)

json_data(
name = "repository_locations",
data = REPOSITORY_LOCATIONS_SPEC,
)
7 changes: 7 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library")
load("//bazel:envoy_build_system.bzl", "envoy_package")
load("//bazel:envoy_internal.bzl", "envoy_select_force_libcpp")
load("//bazel:utils.bzl", "json_data")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS_SPEC")

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -591,3 +593,8 @@ alias(
name = "windows",
actual = "@bazel_tools//src/conditions:windows",
)

json_data(
name = "repository_locations",
data = REPOSITORY_LOCATIONS_SPEC,
)
1 change: 1 addition & 0 deletions bazel/api_binding.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def _default_envoy_api_impl(ctx):
]
for d in api_dirs:
ctx.symlink(ctx.path(ctx.attr.envoy_root).dirname.get_child(ctx.attr.reldir).get_child(d), d)
ctx.symlink(ctx.path(ctx.attr.envoy_root).dirname.get_child("bazel").get_child("utils.bzl"), "utils.bzl")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ive tried a few different ways to make the json_data macro available in the api part of the repo

not sure the best way

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly the cleanest way is to put the json_data macro inside api/bazel. That makes the dependency chain simpler.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why i didnt think of that - ill move it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...in a follow up...


_default_envoy_api = repository_rule(
implementation = _default_envoy_api_impl,
Expand Down
18 changes: 18 additions & 0 deletions bazel/utils.bzl
Original file line number Diff line number Diff line change
@@ -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
)
8 changes: 8 additions & 0 deletions contrib/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
load("//bazel:utils.bzl", "json_data")
load(":contrib_build_config.bzl", "CONTRIB_EXTENSIONS")

licenses(["notice"]) # Apache 2

exports_files([
"extensions_metadata.yaml",
"contrib_build_config.bzl",
])

json_data(
name = "contrib_extensions_build_config",
data = CONTRIB_EXTENSIONS,
)
8 changes: 8 additions & 0 deletions source/extensions/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
load("//bazel:utils.bzl", "json_data")
load(":extensions_build_config.bzl", "EXTENSIONS")

licenses(["notice"]) # Apache 2

exports_files([
"extensions_metadata.yaml",
"extensions_build_config.bzl",
])

json_data(
name = "extensions_build_config",
data = EXTENSIONS,
)