Skip to content
Open
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
67 changes: 67 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module(
name = "envoy_api",
)

bazel_dep(name = "abseil-cpp", version = "20250814.1", repo_name = "com_google_absl")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "gazelle", version = "0.46.0", repo_name = "bazel_gazelle")
bazel_dep(name = "googleapis", version = "0.0.0-20251003-2193a2bf", repo_name = "com_google_googleapis")
bazel_dep(name = "googletest", version = "1.17.0", repo_name = "com_google_googletest")
bazel_dep(name = "grpc", version = "1.74.1", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "opencensus-proto", version = "0.4.1.bcr.2", repo_name = "opencensus_proto")
bazel_dep(name = "opentelemetry-proto", version = "1.5.0", repo_name = "opentelemetry_proto")
bazel_dep(name = "protobuf", version = "33.0", repo_name = "com_google_protobuf")
bazel_dep(name = "protoc-gen-validate", version = "1.2.1.bcr.1", repo_name = "com_envoyproxy_protoc_gen_validate")
bazel_dep(name = "re2", version = "2024-07-02.bcr.1", repo_name = "com_googlesource_code_re2")
bazel_dep(name = "rules_go", version = "0.58.3", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_python", version = "1.6.0")
bazel_dep(name = "rules_cc", version = "0.2.13")
bazel_dep(name = "xds", version = "0.0.0-20240423-555b57e", repo_name = "com_github_cncf_xds")

# Bump google_benchmark to avoid rules_foreign_cc
bazel_dep(name = "google_benchmark", version = "1.9.4")

non_module_deps = use_extension("//bazel:repositories.bzl", "non_module_deps")
use_repo(
non_module_deps,
"prometheus_metrics_model",
)

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.24.0")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.module(
path = "github.com/planetscale/vtprotobuf",
sum = "h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=",
version = "v0.6.1-0.20240319094008-0393e58bdf10",
)
go_deps.module(
path = "google.golang.org/protobuf",
sum = "h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=",
version = "v1.31.0",
)
go_deps.module(
path = "google.golang.org/genproto/googleapis/rpc",
sum = "h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8=",
version = "v0.0.0-20240521202816-d264139d666e",
)
go_deps.module(
path = "google.golang.org/genproto/googleapis/api",
sum = "h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0=",
version = "v0.0.0-20240521202816-d264139d666e",
)
go_deps.module(
path = "github.com/golang/protobuf",
sum = "h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=",
version = "v1.5.4",
)
use_repo(
go_deps,
"com_github_golang_protobuf",
"com_github_planetscale_vtprotobuf",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_genproto_googleapis_rpc",
"org_golang_google_protobuf",
)
15 changes: 0 additions & 15 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@envoy_toolshed//:macros.bzl", "json_data")
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load(
":external_proto_deps.bzl",
Expand Down Expand Up @@ -28,17 +27,3 @@ go_proto_compiler(
valid_archive = False,
visibility = ["//visibility:public"],
)

json_data(
name = "repository_locations",
data = load_repository_locations_spec(REPOSITORY_LOCATIONS_SPEC),
)

json_data(
name = "external_proto_deps",
data = dict(
cc = EXTERNAL_PROTO_CC_BAZEL_DEP_MAP,
go = EXTERNAL_PROTO_GO_BAZEL_DEP_MAP,
imports = EXTERNAL_PROTO_IMPORT_BAZEL_DEP_MAP,
),
)
7 changes: 5 additions & 2 deletions bazel/api_build_system.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@com_envoyproxy_protoc_gen_validate//bazel:pgv_proto_library.bzl", "pgv_cc_proto_library")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:python_rules.bzl", _py_proto_library = "py_proto_library")
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
Expand All @@ -24,6 +25,7 @@ _CC_GRPC_SUFFIX = "_cc_grpc"
_GO_PROTO_SUFFIX = "_go_proto"
_GO_IMPORTPATH_PREFIX = "github.com/envoyproxy/go-control-plane/"
_JAVA_PROTO_SUFFIX = "_java_proto"
_IS_BZLMOD = str(Label("//:invalid")).startswith("@@")

_COMMON_PROTO_DEPS = [
"@com_google_protobuf//:any_proto",
Expand All @@ -43,7 +45,8 @@ _COMMON_PROTO_DEPS = [
def _proto_mapping(dep, proto_dep_map, proto_suffix):
mapped = proto_dep_map.get(dep)
if mapped == None:
prefix = "@" + Label(dep).workspace_name if not dep.startswith("//") else ""
prefix = "@@" if _IS_BZLMOD else "@"
prefix = prefix + Label(dep).repo_name if not dep.startswith("//") else ""
return prefix + "//" + Label(dep).package + ":" + Label(dep).name + proto_suffix
return mapped

Expand Down Expand Up @@ -113,7 +116,7 @@ def api_cc_py_proto_library(
)

if java:
native.java_proto_library(
java_proto_library(
name = name + _JAVA_PROTO_SUFFIX,
visibility = ["//visibility:public"],
deps = [relative_name],
Expand Down
3 changes: 3 additions & 0 deletions bazel/cc_proto_descriptor_library/builddefs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"""

load("@bazel_skylib//lib:paths.bzl", "paths")
load("@com_google_protobuf//bazel/common:proto_info.bzl", "ProtoInfo")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")

# begin:google_only
# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
Expand Down
14 changes: 9 additions & 5 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ def external_http_archive(name, **kwargs):
**kwargs
)

def api_dependencies():
def api_dependencies(bzlmod = False):
external_http_archive(
name = "prometheus_metrics_model",
build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT,
)
if bzlmod:
return
external_http_archive(
name = "bazel_skylib",
)
Expand All @@ -30,10 +36,6 @@ def api_dependencies():
external_http_archive(
name = "com_github_cncf_xds",
)
external_http_archive(
name = "prometheus_metrics_model",
build_file_content = PROMETHEUSMETRICS_BUILD_CONTENT,
)
external_http_archive(
name = "rules_buf",
)
Expand Down Expand Up @@ -380,3 +382,5 @@ go_grpc_library(
],
)
"""

non_module_deps = module_extension(implementation = lambda ctx: api_dependencies(bzlmod = True))