Skip to content

Commit aeb9bac

Browse files
Move Bazel workspace root, refactor BUILD files, and add aliases
- Moved Bazel workspace files (MODULE.bazel, WORKSPACE.bazel, .bazelrc, etc.) from `proto/` to the repository root. - Refactored `proto/BUILD.bazel` by splitting targets into colocated BUILD files in `proto/p4/config/v1/BUILD.bazel` and `proto/p4/v1/BUILD.bazel`. - Added `strip_import_prefix = "/proto"` to proto_library targets. - Added aliases in the root `BUILD.bazel` to maintain backward compatibility for users who update their workspace root. - Added aliases in `proto/BUILD.bazel` to maintain backward compatibility for users who do not update their workspace root (though strictly speaking the paths are different). - Updated example projects to use the new canonical targets and workspace root. Fixes #571.
1 parent 3e718f6 commit aeb9bac

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

BUILD.bazel

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2+
load("@rules_license//rules:license.bzl", "license")
3+
4+
package(
5+
default_visibility = ["//visibility:public"],
6+
default_applicable_licenses = [":license"],
7+
)
8+
9+
license(
10+
name = "license",
11+
license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"],
12+
license_text = "LICENSE",
13+
)
14+
115
exports_files(["LICENSE", "p4runtime_deps.bzl"])
16+
17+
# Aliases for backward compatibility with the old workspace structure
18+
# where proto/ was the root.
19+
20+
alias(name = "p4types_proto", actual = "//proto/p4/config/v1:p4types_proto")
21+
alias(name = "p4info_proto", actual = "//proto/p4/config/v1:p4info_proto")
22+
alias(name = "p4data_proto", actual = "//proto/p4/v1:p4data_proto")
23+
alias(name = "p4runtime_proto", actual = "//proto/p4/v1:p4runtime_proto")
24+
25+
alias(name = "p4types_cc_proto", actual = "//proto/p4/config/v1:p4types_cc_proto")
26+
alias(name = "p4info_cc_proto", actual = "//proto/p4/config/v1:p4info_cc_proto")
27+
alias(name = "p4data_cc_proto", actual = "//proto/p4/v1:p4data_cc_proto")
28+
alias(name = "p4runtime_cc_proto", actual = "//proto/p4/v1:p4runtime_cc_proto")
29+
30+
alias(name = "p4types_py_proto", actual = "//proto/p4/config/v1:p4types_py_proto")
31+
alias(name = "p4info_py_proto", actual = "//proto/p4/config/v1:p4info_py_proto")
32+
alias(name = "p4data_py_proto", actual = "//proto/p4/v1:p4data_py_proto")
33+
alias(name = "p4runtime_py_proto", actual = "//proto/p4/v1:p4runtime_py_proto")
34+
35+
alias(name = "p4info_go_proto", actual = "//proto/p4/config/v1:p4info_go_proto")
36+
alias(name = "p4runtime_go_proto", actual = "//proto/p4/v1:p4runtime_go_proto")
37+
38+
alias(name = "p4runtime_cc_grpc", actual = "//proto/p4/v1:p4runtime_cc_grpc")
39+
alias(name = "p4runtime_py_grpc", actual = "//proto/p4/v1:p4runtime_py_grpc")
40+
41+
test_suite(name = "proto_build_test", tests = ["//proto:proto_build_test"])

0 commit comments

Comments
 (0)