diff --git a/modules/envoy_api/0.0.0-20241214-918efc9/MODULE.bazel b/modules/envoy_api/0.0.0-20241214-918efc9/MODULE.bazel new file mode 100644 index 00000000000..4ebcce7f4a7 --- /dev/null +++ b/modules/envoy_api/0.0.0-20241214-918efc9/MODULE.bazel @@ -0,0 +1,69 @@ +module( + name = "envoy_api", + version = "0.0.0-20241214-918efc9", +) + +bazel_dep(name = "abseil-cpp", version = "20240116.2", repo_name = "com_google_absl") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle") +bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5", repo_name = "com_google_googleapis") +bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest") +bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc") +bazel_dep(name = "opencensus-proto", version = "0.4.1", repo_name = "opencensus_proto") +bazel_dep(name = "opentelemetry-proto", version = "1.4.0.bcr.1", repo_name = "opentelemetry_proto") +bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf") +bazel_dep(name = "protoc-gen-validate", version = "1.0.4.bcr.2", repo_name = "com_envoyproxy_protoc_gen_validate") +bazel_dep(name = "re2", version = "2024-05-01", repo_name = "com_googlesource_code_re2") +bazel_dep(name = "rules_go", version = "0.48.0", repo_name = "io_bazel_rules_go") +bazel_dep(name = "rules_proto", version = "7.0.2") +bazel_dep(name = "rules_python", version = "0.40.0") +bazel_dep(name = "xds", version = "0.0.0-20240423-555b57e", repo_name = "com_github_cncf_xds") + +switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules") +switched_rules.use_languages( + cc = True, + go = True, +) + +non_module_deps = use_extension("//bazel:repositories.bzl", "non_module_deps") +use_repo( + non_module_deps, + "com_github_bufbuild_buf", + "envoy_toolshed", + "prometheus_metrics_model", +) + +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", +) diff --git a/modules/envoy_api/0.0.0-20241214-918efc9/patches/bzlmod_fixes.patch b/modules/envoy_api/0.0.0-20241214-918efc9/patches/bzlmod_fixes.patch new file mode 100644 index 00000000000..5c82424418d --- /dev/null +++ b/modules/envoy_api/0.0.0-20241214-918efc9/patches/bzlmod_fixes.patch @@ -0,0 +1,163 @@ +diff --git a/bazel/api_build_system.bzl b/bazel/api_build_system.bzl +index 729e7716..563c9467 100644 +--- a/bazel/api_build_system.bzl ++++ b/bazel/api_build_system.bzl +@@ -23,6 +23,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", +@@ -42,7 +43,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 + +diff --git a/bazel/cc_proto_descriptor_library/BUILD b/bazel/cc_proto_descriptor_library/BUILD +index 993d1080..6d013919 100644 +--- a/bazel/cc_proto_descriptor_library/BUILD ++++ b/bazel/cc_proto_descriptor_library/BUILD +@@ -37,7 +37,6 @@ cc_library( + "@com_google_absl//absl/strings:str_format", + "@com_google_protobuf//:protobuf", + "@com_google_protobuf//src/google/protobuf/compiler:code_generator", +- "@com_google_protobuf//src/google/protobuf/compiler:retention", + ], + ) + +diff --git a/bazel/external_proto_deps.bzl b/bazel/external_proto_deps.bzl +index 5f08d68e..da477d5b 100644 +--- a/bazel/external_proto_deps.bzl ++++ b/bazel/external_proto_deps.bzl +@@ -12,7 +12,7 @@ EXTERNAL_PROTO_IMPORT_BAZEL_DEP_MAP = { + "google/api/expr/v1alpha1/checked.proto": "@com_google_googleapis//google/api/expr/v1alpha1:checked_proto", + "google/api/expr/v1alpha1/syntax.proto": "@com_google_googleapis//google/api/expr/v1alpha1:syntax_proto", + "io/prometheus/client/metrics.proto": "@prometheus_metrics_model//:client_model", +- "opentelemetry/proto/common/v1/common.proto": "@opentelemetry_proto//:common", ++ "opentelemetry/proto/common/v1/common.proto": "@opentelemetry_proto//:common_proto", + } + + # This maps from the Bazel proto_library target to the Go language binding target for external dependencies. +@@ -28,18 +28,24 @@ EXTERNAL_PROTO_GO_BAZEL_DEP_MAP = { + # go_googleapis in https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#overriding-dependencies + "@com_google_googleapis//google/api/expr/v1alpha1:checked_proto": "@org_golang_google_genproto_googleapis_api//expr/v1alpha1", + "@com_google_googleapis//google/api/expr/v1alpha1:syntax_proto": "@org_golang_google_genproto_googleapis_api//expr/v1alpha1", +- "@opentelemetry_proto//:trace": "@opentelemetry_proto//:trace_go_proto", +- "@opentelemetry_proto//:logs": "@opentelemetry_proto//:logs_go_proto", +- "@opentelemetry_proto//:metrics": "@opentelemetry_proto//:metrics_go_proto", +- "@opentelemetry_proto//:common": "@opentelemetry_proto//:common_go_proto", ++ "@opentelemetry_proto//:trace_proto": "@opentelemetry_proto//:trace_proto_go", ++ "@opentelemetry_proto//:trace_service_proto": "@opentelemetry_proto//:trace_service_grpc_go", ++ "@opentelemetry_proto//:logs_proto": "@opentelemetry_proto//:logs_proto_go", ++ "@opentelemetry_proto//:logs_service_proto": "@opentelemetry_proto//:logs_service_grpc_go", ++ "@opentelemetry_proto//:metrics_proto": "@opentelemetry_proto//:metrics_proto_go", ++ "@opentelemetry_proto//:metrics_service_proto": "@opentelemetry_proto//:metrics_service_grpc_go", ++ "@opentelemetry_proto//:common_proto": "@opentelemetry_proto//:common_proto_go", + } + + # This maps from the Bazel proto_library target to the C++ language binding target for external dependencies. + EXTERNAL_PROTO_CC_BAZEL_DEP_MAP = { + "@com_google_googleapis//google/api/expr/v1alpha1:checked_proto": "@com_google_googleapis//google/api/expr/v1alpha1:checked_cc_proto", + "@com_google_googleapis//google/api/expr/v1alpha1:syntax_proto": "@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto", +- "@opentelemetry_proto//:trace": "@opentelemetry_proto//:trace_cc_proto", +- "@opentelemetry_proto//:logs": "@opentelemetry_proto//:logs_cc_proto", +- "@opentelemetry_proto//:metrics": "@opentelemetry_proto//:metrics_cc_proto", +- "@opentelemetry_proto//:common": "@opentelemetry_proto//:common_cc_proto", ++ "@opentelemetry_proto//:trace_proto": "@opentelemetry_proto//:trace_proto_cc", ++ "@opentelemetry_proto//:trace_service_proto": "@opentelemetry_proto//:trace_service_grpc_cc", ++ "@opentelemetry_proto//:logs_proto": "@opentelemetry_proto//:logs_proto_cc", ++ "@opentelemetry_proto//:logs_service_proto": "@opentelemetry_proto//:logs_service_grpc_cc", ++ "@opentelemetry_proto//:metrics_proto": "@opentelemetry_proto//:metrics_proto_cc", ++ "@opentelemetry_proto//:metrics_service_proto": "@opentelemetry_proto//:metrics_service_grpc_cc", ++ "@opentelemetry_proto//:common_proto": "@opentelemetry_proto//:common_proto_cc", + } +diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl +index ebf04fd2..058b05aa 100644 +--- a/bazel/repositories.bzl ++++ b/bazel/repositories.bzl +@@ -12,7 +12,22 @@ 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, ++ ) ++ external_http_archive( ++ name = "com_github_bufbuild_buf", ++ build_file_content = BUF_BUILD_CONTENT, ++ ) ++ external_http_archive( ++ name = "envoy_toolshed", ++ ) ++ ++ if bzlmod: ++ return ++ + external_http_archive( + name = "bazel_skylib", + ) +@@ -27,15 +42,9 @@ def api_dependencies(): + external_http_archive( + name = "com_google_googleapis", + ) +- + 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_proto", + ) +@@ -47,20 +56,12 @@ def api_dependencies(): + name = "opentelemetry_proto", + build_file_content = OPENTELEMETRY_BUILD_CONTENT, + ) +- external_http_archive( +- name = "com_github_bufbuild_buf", +- build_file_content = BUF_BUILD_CONTENT, +- ) + external_http_archive( + name = "dev_cel", + ) +- + external_http_archive( + name = "com_github_chrusty_protoc_gen_jsonschema", + ) +- external_http_archive( +- name = "envoy_toolshed", +- ) + + PROMETHEUSMETRICS_BUILD_CONTENT = """ + load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library") +@@ -202,3 +203,5 @@ filegroup( + tags = ["manual"], # buf is downloaded as a linux binary; tagged manual to prevent build for non-linux users + ) + """ ++ ++non_module_deps = module_extension(implementation = lambda ctx: api_dependencies(bzlmod = True)) +diff --git a/envoy/extensions/access_loggers/open_telemetry/v3/BUILD b/envoy/extensions/access_loggers/open_telemetry/v3/BUILD +index dad7cd1a..39d57c5e 100644 +--- a/envoy/extensions/access_loggers/open_telemetry/v3/BUILD ++++ b/envoy/extensions/access_loggers/open_telemetry/v3/BUILD +@@ -9,6 +9,6 @@ api_proto_package( + "//envoy/config/core/v3:pkg", + "//envoy/extensions/access_loggers/grpc/v3:pkg", + "@com_github_cncf_xds//udpa/annotations:pkg", +- "@opentelemetry_proto//:common", ++ "@opentelemetry_proto//:common_proto", + ], + ) diff --git a/modules/envoy_api/0.0.0-20241214-918efc9/patches/module_dot_bazel.patch b/modules/envoy_api/0.0.0-20241214-918efc9/patches/module_dot_bazel.patch new file mode 100644 index 00000000000..719324dc14e --- /dev/null +++ b/modules/envoy_api/0.0.0-20241214-918efc9/patches/module_dot_bazel.patch @@ -0,0 +1,75 @@ +diff --git a/MODULE.bazel b/MODULE.bazel +new file mode 100644 +index 00000000..b386fa48 +--- /dev/null ++++ b/MODULE.bazel +@@ -0,0 +1,69 @@ ++module( ++ name = "envoy_api", ++ version = "0.0.0-20241214-918efc9", ++) ++ ++bazel_dep(name = "abseil-cpp", version = "20240116.2", repo_name = "com_google_absl") ++bazel_dep(name = "bazel_skylib", version = "1.7.1") ++bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle") ++bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5", repo_name = "com_google_googleapis") ++bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest") ++bazel_dep(name = "grpc", version = "1.62.1", repo_name = "com_github_grpc_grpc") ++bazel_dep(name = "opencensus-proto", version = "0.4.1", repo_name = "opencensus_proto") ++bazel_dep(name = "opentelemetry-proto", version = "1.4.0.bcr.1", repo_name = "opentelemetry_proto") ++bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf") ++bazel_dep(name = "protoc-gen-validate", version = "1.0.4.bcr.2", repo_name = "com_envoyproxy_protoc_gen_validate") ++bazel_dep(name = "re2", version = "2024-05-01", repo_name = "com_googlesource_code_re2") ++bazel_dep(name = "rules_go", version = "0.48.0", repo_name = "io_bazel_rules_go") ++bazel_dep(name = "rules_proto", version = "7.0.2") ++bazel_dep(name = "rules_python", version = "0.40.0") ++bazel_dep(name = "xds", version = "0.0.0-20240423-555b57e", repo_name = "com_github_cncf_xds") ++ ++switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules") ++switched_rules.use_languages( ++ cc = True, ++ go = True, ++) ++ ++non_module_deps = use_extension("//bazel:repositories.bzl", "non_module_deps") ++use_repo( ++ non_module_deps, ++ "com_github_bufbuild_buf", ++ "envoy_toolshed", ++ "prometheus_metrics_model", ++) ++ ++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", ++) diff --git a/modules/envoy_api/0.0.0-20241214-918efc9/presubmit.yml b/modules/envoy_api/0.0.0-20241214-918efc9/presubmit.yml new file mode 100644 index 00000000000..e89f0a54baa --- /dev/null +++ b/modules/envoy_api/0.0.0-20241214-918efc9/presubmit.yml @@ -0,0 +1,20 @@ +matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + - windows + bazel: + - 7.x + - 8.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - "@envoy_api//test/build:go_build_test" + - "@envoy_api//tools/..." + build_flags: + - "--java_runtime_version=remotejdk_21" diff --git a/modules/envoy_api/0.0.0-20241214-918efc9/source.json b/modules/envoy_api/0.0.0-20241214-918efc9/source.json new file mode 100644 index 00000000000..d1e00f2f719 --- /dev/null +++ b/modules/envoy_api/0.0.0-20241214-918efc9/source.json @@ -0,0 +1,10 @@ +{ + "url": "https://github.com/envoyproxy/data-plane-api/archive/918efc9df33d27b5a3850332d408a3684a4de8ca.tar.gz", + "integrity": "sha256-SQfjzyqaZBx9pgyqMlhjRzflqdHg01jM2OhOnWT9rOA=", + "strip_prefix": "data-plane-api-918efc9df33d27b5a3850332d408a3684a4de8ca", + "patch_strip": 1, + "patches": { + "bzlmod_fixes.patch": "sha256-gKBNp+A+vubtBOf+iygCDc7cn1MB+/gPOtWE2keCxLo=", + "module_dot_bazel.patch": "sha256-iCAR5o+NRzEh4RrG/qeilKImWD24TCeOBVncxrOmQn8=" + } +} diff --git a/modules/envoy_api/metadata.json b/modules/envoy_api/metadata.json new file mode 100644 index 00000000000..370fdb1f14b --- /dev/null +++ b/modules/envoy_api/metadata.json @@ -0,0 +1,16 @@ +{ + "homepage": "https://www.envoyproxy.io/", + "maintainers": [ + { + "email": "bcr-maintainers@bazel.build", + "name": "No Maintainer Specified" + } + ], + "repository": [ + "github:envoyproxy/data-plane-api" + ], + "versions": [ + "0.0.0-20241214-918efc9" + ], + "yanked_versions": {} +}