Skip to content
Draft
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
15 changes: 11 additions & 4 deletions api/bazel/external_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ DEPENDENCY_ANNOTATIONS = [
# This attribute is mandatory for each dependecy.
"use_category",

# Use the project name rather than the starlark key as the repo name.
"use_project_name",

# The dependency version. This may be either a tagged release (preferred)
# or git SHA (as an exception when no release tagged version is suitable).
"version",
Expand Down Expand Up @@ -81,14 +84,18 @@ def load_repository_locations(repository_locations_spec):
locations = {}
for key, location in load_repository_locations_spec(repository_locations_spec).items():
mutable_location = dict(location)
locations[key] = mutable_location

if "sha256" not in location or len(location["sha256"]) == 0:
_fail_missing_attribute("sha256", key)

if "project_name" not in location:
_fail_missing_attribute("project_name", key)

if location.get("use_project_name", False):
locations[location["project_name"]] = mutable_location
else:
locations[key] = mutable_location

if "sha256" not in location or len(location["sha256"]) == 0:
_fail_missing_attribute("sha256", key)

if "project_desc" not in location:
_fail_missing_attribute("project_desc", key)

Expand Down
8 changes: 5 additions & 3 deletions bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains", "register_yq_toolchains")
load("@bazel_lib//lib:repositories.bzl", "bazel_lib_register_toolchains")
load("@base_pip3//:requirements.bzl", pip_dependencies = "install_deps")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
Expand All @@ -23,6 +23,7 @@ load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
load("@rules_rust//rust:defs.bzl", "rust_common")
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")

# go version for rules_go
GO_VERSION = "1.24.6"
Expand All @@ -41,6 +42,8 @@ def envoy_dependency_imports(
buf_version = BUF_VERSION):
compatibility_proxy_repo()
rules_foreign_cc_dependencies()
rules_shell_dependencies()
rules_shell_toolchains()
go_rules_dependencies()
go_register_toolchains(go_version)
if go_version != "host":
Expand Down Expand Up @@ -79,8 +82,7 @@ def envoy_dependency_imports(
oss_fuzz = True,
honggfuzz = False,
)
register_jq_toolchains(version = jq_version)
register_yq_toolchains(version = yq_version)
bazel_lib_register_toolchains()
parser_deps()

rules_buf_toolchains(
Expand Down
6 changes: 6 additions & 0 deletions bazel/dependency_imports_extra.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@dynamic_modules_rust_sdk_crate_index//:defs.bzl", "crate_repositories")
load("@platforms//host:extension.bzl", "host_platform_repo")

# Dependencies that rely on a first stage of envoy_dependency_imports() in dependency_imports.bzl.
def envoy_dependency_imports_extra():
crate_repositories()
maybe(
host_platform_repo,
name = "host_platform",
)
2 changes: 1 addition & 1 deletion bazel/repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _envoy_repo_impl(repository_ctx):
Project and repo data can be accessed in JSON format using `@envoy_repo//:project`, eg:

```starlark
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@jq.bzl", "jq")

jq(
name = "project_version",
Expand Down
8 changes: 5 additions & 3 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ def envoy_dependencies(skip_targets = []):
external_http_archive("rules_pkg")
external_http_archive("com_github_aignas_rules_shellcheck")
external_http_archive(
"aspect_bazel_lib",
patch_args = ["-p1"],
patches = ["@envoy//bazel:aspect.patch"],
"bazel_lib",
# patch_args = ["-p1"],
# patches = ["@envoy//bazel:aspect.patch"],
)
external_http_archive("jq.bzl")
external_http_archive("yq.bzl")

_com_github_fdio_vpp_vcl()

Expand Down
4 changes: 2 additions & 2 deletions bazel/repositories_extra.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
load("@bazel_lib//lib:repositories.bzl", "bazel_lib_dependencies")
load("@bazel_features//:deps.bzl", "bazel_features_deps")
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features")
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
Expand Down Expand Up @@ -31,7 +31,7 @@ def envoy_dependencies_extra(
ignore_root_user_error = ignore_root_user_error,
)

aspect_bazel_lib_dependencies()
bazel_lib_dependencies()

if not native.existing_rule("proto_bazel_features"):
proto_bazel_features(name = "proto_bazel_features")
Expand Down
44 changes: 37 additions & 7 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ REPOSITORY_LOCATIONS_SPEC = dict(
license = "Apache-2.0",
license_url = "https://github.com/envoyproxy/toolshed/blob/bazel-v{version}/LICENSE",
),
jq_bzl = dict(
project_name = "jq.bzl",
project_desc = "Bazel rule wrapping the jq utility",
project_url = "https://github.com/bazel-contrib/jq.bzl",
use_project_name = True,
version = "0.4.0",
sha256 = "21617eb71fb775a748ef5639131ab943ef39946bd2a4ce96ea60b03f985db0c5",
strip_prefix = "jq.bzl-{version}",
urls = ["https://github.com/bazel-contrib/jq.bzl/releases/download/v{version}/jq.bzl-v{version}.tar.gz"],
release_date = "2025-06-02",
cpe = "N/A",
use_category = ["build", "test_only"],
license = "Apache-2.0",
license_url = "https://github.com/bazel-contrib/jq.bzl/blob/v{version}/LICENSE",
),
rules_fuzzing = dict(
project_name = "Fuzzing Rules for Bazel",
project_desc = "Bazel rules for fuzz tests",
Expand Down Expand Up @@ -172,16 +187,16 @@ REPOSITORY_LOCATIONS_SPEC = dict(
release_date = "2025-10-13",
cpe = "cpe:2.3:a:google:boringssl:*",
),
aspect_bazel_lib = dict(
project_name = "Aspect Bazel helpers",
project_desc = "Base Starlark libraries and basic Bazel rules which are useful for constructing rulesets and BUILD files",
project_url = "https://github.com/aspect-build/bazel-lib",
version = "2.16.0",
sha256 = "092f841dd9ea8e736ea834f304877a25190a762d0f0a6c8edac9f94aac8bbf16",
bazel_lib = dict(
project_name = "Bazel lib",
project_desc = "Common useful functions for writing BUILD files and Starlark macros/rules",
project_url = "https://github.com/bazel-contrib/bazel-lib",
version = "3.0.0",
sha256 = "622914a38966f7dec9b1200b40082bec4c4e19631a447da1b62208f3f55debfb",
strip_prefix = "bazel-lib-{version}",
urls = ["https://github.com/aspect-build/bazel-lib/archive/v{version}.tar.gz"],
use_category = ["build", "test_only"],
release_date = "2025-05-06",
release_date = "2025-10-17",
cpe = "N/A",
license = "Apache-2.0",
license_url = "https://github.com/aspect-build/bazel-lib/blob/v{version}/LICENSE",
Expand Down Expand Up @@ -1190,6 +1205,21 @@ REPOSITORY_LOCATIONS_SPEC = dict(
release_date = "2025-07-09",
cpe = "cpe:2.3:a:google:v8:*",
),
yq_bzl = dict(
project_name = "yq.bzl",
project_desc = "Bazel rule wrapping the yq utility",
project_url = "https://github.com/bazel-contrib/yq.bzl",
use_project_name = True,
version = "0.3.1",
sha256 = "7132988406a5bd2021df4efc43e6e6f0bb5c7f976adf16107dc76711881e3051",
strip_prefix = "yq.bzl-{version}",
urls = ["https://github.com/bazel-contrib/yq.bzl/releases/download/v{version}/yq.bzl-v{version}.tar.gz"],
release_date = "2025-06-02",
cpe = "N/A",
use_category = ["build", "test_only"],
license = "Apache-2.0",
license_url = "https://github.com/bazel-contrib/yq.bzl/blob/v{version}/LICENSE",
),
fast_float = dict(
project_name = "fast_float number parsing library",
project_desc = "Fast and exact implementation of the C++ from_chars functions for number types: 4x to 10x faster than strtod, part of GCC 12, Chromium, Redis and WebKit/Safari",
Expand Down
2 changes: 1 addition & 1 deletion mobile/test/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:yq.bzl", "yq")
load("@yq.bzl", "yq")

licenses(["notice"]) # Apache 2

Expand Down
2 changes: 1 addition & 1 deletion test/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@aspect_bazel_lib//lib:yq.bzl", "yq")
load("@yq.bzl", "yq")
load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_test_library",
Expand Down
4 changes: 2 additions & 2 deletions tools/base/envoy_python.bzl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@aspect_bazel_lib//lib:yq.bzl", "yq")
load("@base_pip3//:requirements.bzl", "requirement")
load("@jq.bzl", "jq")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
load("@yq.bzl", "yq")

ENVOY_PYTOOL_NAMESPACE = [
":py-init",
Expand Down
2 changes: 1 addition & 1 deletion tools/code/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@envoy_repo//:path.bzl", "PATH")
load("@jq.bzl", "jq")
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load(
Expand Down
2 changes: 1 addition & 1 deletion tools/coverage/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@envoy_repo//:path.bzl", "PATH")
load("@jq.bzl", "jq")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//bazel:envoy_build_system.bzl", "envoy_package")

Expand Down
2 changes: 1 addition & 1 deletion tools/proto_format/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@envoy_repo//:path.bzl", "PATH")
load("@jq.bzl", "jq")
load("@rules_python//python:defs.bzl", "py_binary")
load("//tools/base:envoy_python.bzl", "envoy_genjson", "envoy_py_data", "envoy_pytool_binary")
load("//tools/python:namespace.bzl", "envoy_py_namespace")
Expand Down
2 changes: 1 addition & 1 deletion tools/protoxform/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library")
load("@jq.bzl", "jq")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
Expand Down