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

Add proto_build_test rule that tests building the protos defined in the workspace. #460

Merged
merged 7 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
33 changes: 28 additions & 5 deletions proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package(
default_visibility = ["//visibility:public"],
licenses = ["notice"], # Apache 2.0
)

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
Ankur19 marked this conversation as resolved.
Show resolved Hide resolved
load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_license//rules:license.bzl", "license")
load("@rules_proto//proto:defs.bzl", "proto_library")

package(
default_visibility = ["//visibility:public"],
default_applicable_licenses = [":license"],
)

license(
name = "license",
license_kinds = ["@rules_license//licenses/generic:notice"],
license_text = "LICENSE",
)

exports_files(["LICENSE"])

proto_library(
name = "p4types_proto",
Expand Down Expand Up @@ -126,3 +137,15 @@ py_grpc_library(
srcs = [":p4runtime_proto"],
deps = [":p4runtime_py_proto"],
)

build_test(
name = "proto_build_test",
Ankur19 marked this conversation as resolved.
Show resolved Hide resolved
targets = [
":p4data_proto",
":p4info_proto",
":p4runtime_cc_grpc",
":p4runtime_proto",
":p4runtime_py_grpc",
":p4types_proto",
],
)
1 change: 1 addition & 0 deletions proto/LICENSE
3 changes: 3 additions & 0 deletions proto/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ pip_parse(

load("@grpc_python_dependencies//:requirements.bzl", "install_deps")
install_deps()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
18 changes: 18 additions & 0 deletions proto/p4runtime_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,21 @@ def p4runtime_deps():
strip_prefix = "grpc-1.51.1",
sha256 = "b55696fb249669744de3e71acc54a9382bea0dce7cd5ba379b356b12b82d4229",
)
if not native.existing_rule("bazel_skylib"):
http_archive(
name = "bazel_skylib",
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
],
)
if not native.existing_rule("rules_license"):
http_archive(
name = "rules_license",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz",
"https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz",
],
sha256 = "4531deccb913639c30e5c7512a054d5d875698daeb75d8cf90f284375fe7c360",
)
Loading