-
Notifications
You must be signed in to change notification settings - Fork 99
Move Bazel workspace root to project root #573
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
base: main
Are you sure you want to change the base?
Changes from all commits
5eae0eb
3e718f6
aeb9bac
80a409f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
| load("@rules_license//rules:license.bzl", "license") | ||
|
|
||
| package( | ||
| default_visibility = ["//visibility:public"], | ||
| default_applicable_licenses = [":license"], | ||
| ) | ||
|
|
||
| license( | ||
| name = "license", | ||
| license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"], | ||
| license_text = "LICENSE", | ||
| ) | ||
|
|
||
| exports_files(["LICENSE", "p4runtime_deps.bzl"]) | ||
|
|
||
| # Aliases for backward compatibility with the old workspace structure | ||
| # where proto/ was the root. | ||
| # TODO(https://github.com/p4lang/p4runtime/issues/576): Remove in 2.0. | ||
| alias(name = "p4types_proto", actual = "//proto/p4/config/v1:p4types_proto") | ||
| alias(name = "p4info_proto", actual = "//proto/p4/config/v1:p4info_proto") | ||
| alias(name = "p4data_proto", actual = "//proto/p4/v1:p4data_proto") | ||
| alias(name = "p4runtime_proto", actual = "//proto/p4/v1:p4runtime_proto") | ||
|
|
||
| alias(name = "p4types_cc_proto", actual = "//proto/p4/config/v1:p4types_cc_proto") | ||
| alias(name = "p4info_cc_proto", actual = "//proto/p4/config/v1:p4info_cc_proto") | ||
| alias(name = "p4data_cc_proto", actual = "//proto/p4/v1:p4data_cc_proto") | ||
| alias(name = "p4runtime_cc_proto", actual = "//proto/p4/v1:p4runtime_cc_proto") | ||
|
|
||
| alias(name = "p4types_py_proto", actual = "//proto/p4/config/v1:p4types_py_proto") | ||
| alias(name = "p4info_py_proto", actual = "//proto/p4/config/v1:p4info_py_proto") | ||
| alias(name = "p4data_py_proto", actual = "//proto/p4/v1:p4data_py_proto") | ||
| alias(name = "p4runtime_py_proto", actual = "//proto/p4/v1:p4runtime_py_proto") | ||
|
|
||
| alias(name = "p4info_go_proto", actual = "//proto/p4/config/v1:p4info_go_proto") | ||
| alias(name = "p4runtime_go_proto", actual = "//proto/p4/v1:p4runtime_go_proto") | ||
|
|
||
| alias(name = "p4runtime_cc_grpc", actual = "//proto/p4/v1:p4runtime_cc_grpc") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we want to group these with the other cc/py files. Also maybe we want a comment to specify that each section corresponds to a particular language? Non-blocking comment Any thoughts @smolkaj |
||
| alias(name = "p4runtime_py_grpc", actual = "//proto/p4/v1:p4runtime_py_grpc") | ||
|
|
||
| test_suite( | ||
| name = "proto_build_test", | ||
| tests = [ | ||
| "//proto/p4/config/v1:proto_build_test", | ||
| "//proto/p4/v1:proto_build_test", | ||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,4 @@ | ||
|
|
||
| load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
| load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") | ||
| 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"], | ||
|
|
@@ -19,133 +13,25 @@ license( | |
|
|
||
| exports_files(["LICENSE"]) | ||
|
|
||
| proto_library( | ||
| name = "p4types_proto", | ||
| srcs = ["p4/config/v1/p4types.proto"], | ||
| # TODO(github.com/grpc/grpc/issues/20675): strip_import_prefix breaks | ||
| # cc_grpc_library. Make proto folder the Bazel root folder as a workaround. | ||
| # strip_import_prefix = "proto", | ||
| ) | ||
|
|
||
| proto_library( | ||
| name = "p4data_proto", | ||
| srcs = ["p4/v1/p4data.proto"], | ||
| # TODO(github.com/grpc/grpc/issues/20675): strip_import_prefix breaks | ||
| # cc_grpc_library. Make proto folder the Bazel root folder as a workaround. | ||
| # strip_import_prefix = "proto", | ||
| ) | ||
|
|
||
| proto_library( | ||
| name = "p4info_proto", | ||
| srcs = ["p4/config/v1/p4info.proto"], | ||
| deps = [ | ||
| ":p4types_proto", | ||
| "@com_google_protobuf//:any_proto", | ||
| "@com_google_protobuf//:descriptor_proto", | ||
| ], | ||
| # TODO(github.com/grpc/grpc/issues/20675): strip_import_prefix breaks | ||
| # cc_grpc_library. Make proto folder the Bazel root folder as a workaround. | ||
| # strip_import_prefix = "proto", | ||
| ) | ||
|
|
||
| proto_library( | ||
| name = "p4runtime_proto", | ||
| srcs = ["p4/v1/p4runtime.proto"], | ||
| deps = [ | ||
| ":p4data_proto", | ||
| ":p4info_proto", | ||
| "@com_google_googleapis//google/rpc:status_proto", | ||
| "@com_google_protobuf//:any_proto", | ||
| ], | ||
| # TODO(github.com/grpc/grpc/issues/20675): strip_import_prefix brakes | ||
| # cc_grpc_library. Make proto folder the Bazel root folder as a workaround. | ||
| # strip_import_prefix = "proto", | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4types_cc_proto", | ||
| deps = [":p4types_proto"], | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4info_cc_proto", | ||
| deps = [":p4info_proto"], | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4data_cc_proto", | ||
| deps = [":p4data_proto"], | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4runtime_cc_proto", | ||
| deps = [":p4runtime_proto"], | ||
| ) | ||
|
|
||
| py_proto_library( | ||
| name = "p4types_py_proto", | ||
| deps = [":p4types_proto"], | ||
| ) | ||
|
|
||
| py_proto_library( | ||
| name = "p4info_py_proto", | ||
| deps = [":p4info_proto"], | ||
| ) | ||
| # Aliases for backward compatibility | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| # TODO(https://github.com/p4lang/p4runtime/issues/576): Remove in 2.0. | ||
| alias(name = "p4types_proto", actual = "//proto/p4/config/v1:p4types_proto") | ||
| alias(name = "p4info_proto", actual = "//proto/p4/config/v1:p4info_proto") | ||
| alias(name = "p4data_proto", actual = "//proto/p4/v1:p4data_proto") | ||
| alias(name = "p4runtime_proto", actual = "//proto/p4/v1:p4runtime_proto") | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove empty line here and a few more times below.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| py_proto_library( | ||
| name = "p4data_py_proto", | ||
| deps = [":p4data_proto"], | ||
| ) | ||
| alias(name = "p4types_cc_proto", actual = "//proto/p4/config/v1:p4types_cc_proto") | ||
| alias(name = "p4info_cc_proto", actual = "//proto/p4/config/v1:p4info_cc_proto") | ||
| alias(name = "p4data_cc_proto", actual = "//proto/p4/v1:p4data_cc_proto") | ||
| alias(name = "p4runtime_cc_proto", actual = "//proto/p4/v1:p4runtime_cc_proto") | ||
|
|
||
| py_proto_library( | ||
| name = "p4runtime_py_proto", | ||
| deps = [":p4runtime_proto"], | ||
| ) | ||
| alias(name = "p4types_py_proto", actual = "//proto/p4/config/v1:p4types_py_proto") | ||
| alias(name = "p4info_py_proto", actual = "//proto/p4/config/v1:p4info_py_proto") | ||
| alias(name = "p4data_py_proto", actual = "//proto/p4/v1:p4data_py_proto") | ||
| alias(name = "p4runtime_py_proto", actual = "//proto/p4/v1:p4runtime_py_proto") | ||
|
|
||
| go_proto_library( | ||
| name = "p4info_go_proto", | ||
| importpath = "github.com/p4lang/p4runtime/go/p4/config/v1", | ||
| protos = [ | ||
| ":p4info_proto", | ||
| ":p4types_proto", | ||
| ], | ||
| ) | ||
| alias(name = "p4info_go_proto", actual = "//proto/p4/config/v1:p4info_go_proto") | ||
| alias(name = "p4runtime_go_proto", actual = "//proto/p4/v1:p4runtime_go_proto") | ||
|
|
||
| go_proto_library( | ||
| name = "p4runtime_go_proto", | ||
| importpath = "github.com/p4lang/p4runtime/go/p4/v1", | ||
| protos = [ | ||
| ":p4data_proto", | ||
| ":p4runtime_proto", | ||
| ], | ||
| deps = [ | ||
| ":p4info_go_proto", | ||
| "@com_google_googleapis//google/rpc:status_go_proto", | ||
| ], | ||
| ) | ||
|
|
||
| cc_grpc_library( | ||
| name = "p4runtime_cc_grpc", | ||
| srcs = [":p4runtime_proto"], | ||
| generate_mocks = True, | ||
| grpc_only = True, | ||
| deps = [":p4runtime_cc_proto"], | ||
| ) | ||
|
|
||
| py_grpc_library( | ||
| name = "p4runtime_py_grpc", | ||
| srcs = [":p4runtime_proto"], | ||
| deps = [":p4runtime_py_proto"], | ||
| ) | ||
|
|
||
| build_test( | ||
| name = "proto_build_test", | ||
| targets = [ | ||
| ":p4data_proto", | ||
| ":p4info_proto", | ||
| ":p4runtime_cc_grpc", | ||
| ":p4runtime_proto", | ||
| ":p4runtime_py_grpc", | ||
| ":p4types_proto", | ||
| ], | ||
| ) | ||
| alias(name = "p4runtime_cc_grpc", actual = "//proto/p4/v1:p4runtime_cc_grpc") | ||
| alias(name = "p4runtime_py_grpc", actual = "//proto/p4/v1:p4runtime_py_grpc") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| load("@rules_proto//proto:defs.bzl", "proto_library") | ||
| load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
| load("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library") | ||
| load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
|
|
||
| package( | ||
| default_visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| proto_library( | ||
| name = "p4types_proto", | ||
| srcs = ["p4types.proto"], | ||
| strip_import_prefix = "/proto", | ||
| ) | ||
|
|
||
| proto_library( | ||
| name = "p4info_proto", | ||
| srcs = ["p4info.proto"], | ||
| deps = [ | ||
| ":p4types_proto", | ||
| "@com_google_protobuf//:any_proto", | ||
| "@com_google_protobuf//:descriptor_proto", | ||
| ], | ||
| strip_import_prefix = "/proto", | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4types_cc_proto", | ||
| deps = [":p4types_proto"], | ||
| ) | ||
|
|
||
| cc_proto_library( | ||
| name = "p4info_cc_proto", | ||
| deps = [":p4info_proto"], | ||
| ) | ||
|
|
||
| py_proto_library( | ||
| name = "p4types_py_proto", | ||
| deps = [":p4types_proto"], | ||
| ) | ||
|
|
||
| py_proto_library( | ||
| name = "p4info_py_proto", | ||
| deps = [":p4info_proto"], | ||
| ) | ||
|
|
||
| go_proto_library( | ||
| name = "p4info_go_proto", | ||
| importpath = "github.com/p4lang/p4runtime/go/p4/config/v1", | ||
| protos = [ | ||
| ":p4info_proto", | ||
| ":p4types_proto", | ||
| ], | ||
| ) | ||
|
|
||
| build_test( | ||
| name = "proto_build_test", | ||
| targets = [ | ||
| ":p4info_proto", | ||
| ":p4types_proto", | ||
| ":p4types_cc_proto", | ||
| ":p4info_cc_proto", | ||
| ":p4types_py_proto", | ||
| ":p4info_py_proto", | ||
| ":p4info_go_proto", | ||
| ], | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line (here and a few more times below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.