Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate all protos from udpa tree to xds tree #17

Merged
merged 4 commits into from
Oct 11, 2021
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
25 changes: 18 additions & 7 deletions bazel/api_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _py_proto_mapping(dep):
# TODO(htuch): Convert this to native py_proto_library once
# https://github.com/bazelbuild/bazel/issues/3935 and/or
# https://github.com/bazelbuild/bazel/issues/2626 are resolved.
def _udpa_py_proto_library(name, srcs = [], deps = []):
def _xds_py_proto_library(name, srcs = [], deps = []):
_py_proto_library(
name = name + _PY_PROTO_SUFFIX,
srcs = srcs,
Expand Down Expand Up @@ -76,7 +76,7 @@ def py_proto_library(name, deps = []):
visibility = ["//visibility:public"],
)

def _udpa_cc_py_proto_library(
def _xds_cc_py_proto_library(
name,
visibility = ["//visibility:private"],
srcs = [],
Expand All @@ -103,19 +103,19 @@ def _udpa_cc_py_proto_library(
deps = [relative_name],
visibility = ["//visibility:public"],
)
_udpa_py_proto_library(name, srcs, deps)
_xds_py_proto_library(name, srcs, deps)

# Optionally define gRPC services
if has_services:
# TODO: neither C++ or Python service generation is supported today, follow the Envoy example to implementthis.
pass

def udpa_proto_package(srcs = [], deps = [], has_services = False, visibility = ["//visibility:public"]):
def xds_proto_package(srcs = [], deps = [], has_services = False, visibility = ["//visibility:public"]):
if srcs == []:
srcs = native.glob(["*.proto"])

name = "pkg"
_udpa_cc_py_proto_library(
_xds_cc_py_proto_library(
name = name,
visibility = visibility,
srcs = srcs,
Expand Down Expand Up @@ -146,14 +146,25 @@ def udpa_proto_package(srcs = [], deps = [], has_services = False, visibility =
],
)

def udpa_cc_test(name, **kwargs):
def xds_cc_test(name, **kwargs):
native.cc_test(
name = name,
**kwargs
)

def udpa_go_test(name, **kwargs):
def xds_go_test(name, **kwargs):
go_test(
name = name,
**kwargs
)

# Old names for backward compatibility.
# TODO(roth): Remove these once all callers are migrated to the new names.
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be removed in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that these build rules might be pulled in by projects that use this repo, so I didn't know if I could remove the old names without breaking anyone. But if we know that no one is using these rules, then I'm happy to remove them immediately.

def udpa_proto_package(srcs = [], deps = [], has_services = False, visibility = ["//visibility:public"]):
xds_proto_package(srcs=srcs, deps=deps, has_services=has_services, visibility=visibility)

def udpa_cc_test(name, **kwargs):
xds_cc_test(name, **kwargs)

def udpa_go_test(name, **kwargs):
xds_go_test(name, **kwargs)
7 changes: 6 additions & 1 deletion bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load("@com_envoyproxy_protoc_gen_validate//bazel:repositories.bzl", "pgv_depende
# go version for rules_go
GO_VERSION = "1.16.6"

def udpa_dependency_imports(go_version = GO_VERSION):
def xds_dependency_imports(go_version = GO_VERSION):
protobuf_deps()
go_rules_dependencies()
go_register_toolchains(go_version)
Expand Down Expand Up @@ -52,3 +52,8 @@ def udpa_dependency_imports(go_version = GO_VERSION):
sum = "h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=",
version = "v1.40.0",
)

# Old name for backward compatibility.
# TODO(roth): Remove this once callers are migrated to the new name.
def udpa_dependency_imports(go_version = GO_VERSION):
xds_dependency_imports(go_version=go_version)
7 changes: 6 additions & 1 deletion bazel/envoy_http_archive.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def udpa_http_archive(name, locations, **kwargs):
def xds_http_archive(name, locations, **kwargs):
# `existing_rule_keys` contains the names of repositories that have already
# been defined in the Bazel workspace. By skipping repos with existing keys,
# users can override dependency versions by using standard Bazel repository
Expand All @@ -22,3 +22,8 @@ def udpa_http_archive(name, locations, **kwargs):
strip_prefix = location.get("strip_prefix", ""),
**kwargs
)

# Old name for backward compatibility.
# TODO(roth): Remove once all callers are changed to use the new name.
def udpa_http_archive(name, locations, **kwargs):
xds_http_archive(name, locations, **kwargs)
21 changes: 13 additions & 8 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
load(":envoy_http_archive.bzl", "udpa_http_archive")
load(":envoy_http_archive.bzl", "xds_http_archive")
load(":repository_locations.bzl", "REPOSITORY_LOCATIONS")

def udpa_api_dependencies():
udpa_http_archive(
def xds_api_dependencies():
xds_http_archive(
"bazel_gazelle",
locations = REPOSITORY_LOCATIONS,
)
udpa_http_archive(
xds_http_archive(
"com_envoyproxy_protoc_gen_validate",
locations = REPOSITORY_LOCATIONS,
)
udpa_http_archive(
xds_http_archive(
name = "com_github_grpc_grpc",
locations = REPOSITORY_LOCATIONS,
)
udpa_http_archive(
xds_http_archive(
name = "com_google_googleapis",
locations = REPOSITORY_LOCATIONS,
)
udpa_http_archive(
xds_http_archive(
"com_google_protobuf",
locations = REPOSITORY_LOCATIONS,
)
udpa_http_archive(
xds_http_archive(
"io_bazel_rules_go",
locations = REPOSITORY_LOCATIONS,
)

# Old name for backward compatibility.
# TODO(roth): Remove once all callers are updated to use the new name.
def udpa_api_dependencies():
xds_api_dependencies()
Loading