diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 00000000..54140e54 --- /dev/null +++ b/.bazelignore @@ -0,0 +1,3 @@ +# The examples/ dir has example bazel workspaces that show how to import +# remote-apis, and should not be treated as part of this workspace. +examples diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..9fe9ff9d --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.0.1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87cbcde3..c3a2f792 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,12 +15,19 @@ jobs: - name: Install bazelisk run: | - curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 + curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 mkdir -p "${HOME}/bin" mv bazelisk-linux-amd64 "${HOME}/bin/bazel" chmod +x "${HOME}/bin/bazel" + # TODO: Should this step assert that generated code == checked-in code? - name: Check bindings generation run: | set -e PATH=${HOME}/bin:$PATH ./hooks/pre-commit + + - name: Check sample project build + run: | + set -e + cd examples/sample_project + bazel build //... diff --git a/.gitignore b/.gitignore index b060ee8e..038053df 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,7 @@ *~ # Ignore Vim swap files. .*.sw* -# Ignore bazel directories -/bazel-bin -/bazel-genfiles -/bazel-out -/bazel-remote-apis -/bazel-testlogs +# Ignore bazel directories, including those in nested workspaces (such as the +# examples). +**/bazel-* +MODULE.bazel.lock diff --git a/BUILD.bazel b/BUILD.bazel index e69de29b..27ab34fb 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -0,0 +1,10 @@ +load("@gazelle//:def.bzl", "gazelle") + +# gazelle:prefix github.com/bazelbuild/remote-apis + +# gazelle:resolve proto google/api/annotations.proto @googleapis//google/api:annotations_proto +# gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto//googleapis/api/annotations + +gazelle( + name = "gazelle", +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..e395e65c --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,29 @@ +module( + name = "remoteapis", + version = "0", +) + +bazel_dep(name = "gazelle", version = "0.35.0") +bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5", repo_name = "com_google_googleapis") +bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_go", version = "0.44.2") +bazel_dep(name = "rules_java", version = "7.3.2") +bazel_dep(name = "rules_proto", version = "6.0.0-rc1") +bazel_dep(name = "rules_proto_grpc_cpp", version = "5.0.0-alpha2") + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") +use_repo( + go_deps, + "com_google_cloud_go_longrunning", + "org_golang_google_genproto", + "org_golang_google_genproto_googleapis_api", + "org_golang_google_genproto_googleapis_rpc", + "org_golang_google_grpc", + "org_golang_google_protobuf", +) + +switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules") +switched_rules.use_languages(go = True) +use_repo(switched_rules, "com_google_googleapis_imports") diff --git a/WORKSPACE b/WORKSPACE index 391d0c2a..fa28d27b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,106 +1 @@ -workspace(name = "bazel_remote_apis") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -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", - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -# Pull in go rules, which we need in order to selectively pull in Go dependencies. -http_archive( - name = "io_bazel_rules_go", - sha256 = "d6ab6b57e48c09523e93050f13698f708428cfd5e619252e369d377af6597707", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.43.0/rules_go-v0.43.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.43.0/rules_go-v0.43.0.zip", - ], -) - -# Gazelle, which we need in order to selectively pull in Gazelle dependencies for Go. -http_archive( - name = "bazel_gazelle", - sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz", - ], -) - -# Needed for protobuf. -http_archive( - name = "com_google_protobuf", - sha256 = "535fbf566d372ccf3a097c374b26896fa044bf4232aef9cab37bd1cc1ba4e850", - strip_prefix = "protobuf-3.15.0", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.15.0.zip"], -) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() - -# Needed for C++ gRPC. -http_archive( - name = "com_github_grpc_grpc", - sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6", - strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0", # v1.24.3 with fixes - urls = ["https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip"], -) - -# Pull in all gRPC dependencies. -load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") - -grpc_deps() - -# More gRPC dependencies. grpc_extra_deps does not work out of the box. -load("@upb//bazel:workspace_deps.bzl", "upb_deps") -load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") -load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") - -upb_deps() - -apple_rules_dependencies() - -apple_support_dependencies() - -load("@upb//bazel:repository_defs.bzl", "bazel_version_repository") - -bazel_version_repository( - name = "bazel_version", -) - -bind( - name = "grpc_cpp_plugin", - actual = "@com_github_grpc_grpc//:grpc_cpp_plugin", -) - -bind( - name = "grpc_lib", - actual = "@com_github_grpc_grpc//:grpc++", -) - -load("//:remote_apis_deps.bzl", "remote_apis_go_deps") - -remote_apis_go_deps() - -# Needed for the googleapis protos. -http_archive( - name = "googleapis", - sha256 = "b28c13e99001664eac5f1fb81b44d912d19fbc041e30772263251da131f6573c", - strip_prefix = "googleapis-bb964feba5980ed70c9fb8f84fe6e86694df65b0", - urls = ["https://github.com/googleapis/googleapis/archive/bb964feba5980ed70c9fb8f84fe6e86694df65b0.zip"], -) - -load("@googleapis//:repository_rules.bzl", "switched_rules_by_language") - -switched_rules_by_language( - name = "com_google_googleapis_imports", -) +"""Empty WORKSPACE file to denote the bazel workspace root""" diff --git a/build/bazel/remote/asset/v1/BUILD b/build/bazel/remote/asset/v1/BUILD index f360b4fe..35df49ac 100644 --- a/build/bazel/remote/asset/v1/BUILD +++ b/build/bazel/remote/asset/v1/BUILD @@ -1,6 +1,10 @@ -package(default_visibility = ["//visibility:public"]) - +load("@rules_go//proto:def.bzl", "go_grpc_library") +load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_proto_grpc_cpp//:defs.bzl", "cpp_grpc_library") + +# gazelle:ignore +package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -11,28 +15,38 @@ proto_library( "//build/bazel/remote/execution/v2:remote_execution_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:timestamp_proto", - "@googleapis//google/api:annotations_proto", - "@googleapis//google/api:http_proto", - "@googleapis//google/rpc:status_proto", + "@com_google_googleapis//google/api:annotations_proto", + "@com_google_googleapis//google/api:http_proto", + "@com_google_googleapis//google/rpc:status_proto", ], ) -alias( - name = "remote_asset_java_proto", - actual = "//build/bazel/remote/asset/v1/java:remote_asset_java_proto", -) +go_grpc_library( + name = "remote_asset_go_grpc", + importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/asset/v1", + protos = [":remote_asset_proto"], + deps = [ + "//build/bazel/remote/execution/v2:remote_execution_go_grpc", + "@org_golang_google_genproto_googleapis_api//annotations", + "@org_golang_google_genproto_googleapis_rpc//status", + ], +) # keep alias( - name = "remote_asset_cc_proto", - actual = "//build/bazel/remote/asset/v1/cc:remote_asset_cc_grpc", + name = "go_default_library", + actual = ":remote_asset_go_grpc", ) -alias( - name = "remote_asset_go_proto", - actual = "//build/bazel/remote/asset/v1/go:remote_asset_go_proto", +cpp_grpc_library( + name = "remote_asset_cpp_grpc", + protos = [":remote_asset_proto"], + deps = [ + "//build/bazel/remote/execution/v2:remote_execution_cpp_grpc", + ], ) -alias( - name = "go_default_library", - actual = "//build/bazel/remote/asset/v1/go:go_default_library", +# TODO: Include/replace with gRPC stub generation targets when feasible +java_proto_library( + name = "remote_asset_java_proto", + deps = [":remote_asset_proto"], ) diff --git a/build/bazel/remote/asset/v1/cc/BUILD b/build/bazel/remote/asset/v1/cc/BUILD deleted file mode 100644 index f4bcddb3..00000000 --- a/build/bazel/remote/asset/v1/cc/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/asset/v1:__pkg__"]) - -load("//internal:cc_grpc_library.bzl", "cc_grpc_codegen") - -cc_proto_library( - name = "remote_asset_cc_proto", - deps = ["//build/bazel/remote/asset/v1:remote_asset_proto"], -) - -cc_grpc_codegen( - name = "remote_asset_cc_grpc_codegen", - proto = "//build/bazel/remote/asset/v1:remote_asset_proto", -) - -cc_library( - name = "remote_asset_cc_grpc", - srcs = [":remote_asset_cc_grpc_codegen"], - hdrs = [":remote_asset_cc_grpc_codegen"], - include_prefix = "build/bazel/remote/asset/v1", - strip_include_prefix = "/" + package_name(), - deps = [ - ":remote_asset_cc_proto", - "@com_github_grpc_grpc//:grpc++_codegen_proto", - ], -) diff --git a/build/bazel/remote/asset/v1/go/BUILD b/build/bazel/remote/asset/v1/go/BUILD deleted file mode 100644 index f1b1d262..00000000 --- a/build/bazel/remote/asset/v1/go/BUILD +++ /dev/null @@ -1,22 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/asset/v1:__pkg__"]) - -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -go_proto_library( - name = "remote_asset_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/asset/v1", - proto = "//build/bazel/remote/asset/v1:remote_asset_proto", - deps = [ - "//build/bazel/remote/execution/v2:remote_execution_go_proto", - "@org_golang_google_genproto//googleapis/api/annotations", - "@org_golang_google_genproto//googleapis/rpc/status", - ], -) - -go_library( - name = "go_default_library", - embed = [":remote_asset_go_proto"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/asset/v1", -) diff --git a/build/bazel/remote/asset/v1/java/BUILD b/build/bazel/remote/asset/v1/java/BUILD deleted file mode 100644 index 6346656d..00000000 --- a/build/bazel/remote/asset/v1/java/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/asset/v1:__pkg__"]) - -java_proto_library( - name = "remote_asset_java_proto", - deps = ["//build/bazel/remote/asset/v1:remote_asset_proto"], -) diff --git a/build/bazel/remote/asset/v1/remote_asset.pb.go b/build/bazel/remote/asset/v1/remote_asset.pb.go index 8c0c360c..9037f5fe 100644 --- a/build/bazel/remote/asset/v1/remote_asset.pb.go +++ b/build/bazel/remote/asset/v1/remote_asset.pb.go @@ -14,20 +14,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v3.15.0 +// protoc-gen-go v1.32.0 +// protoc v3.21.7 // source: build/bazel/remote/asset/v1/remote_asset.proto package remoteasset import ( - context "context" v2 "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2" _ "google.golang.org/genproto/googleapis/api/annotations" status "google.golang.org/genproto/googleapis/rpc/status" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status1 "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" durationpb "google.golang.org/protobuf/types/known/durationpb" @@ -1281,409 +1277,3 @@ func file_build_bazel_remote_asset_v1_remote_asset_proto_init() { file_build_bazel_remote_asset_v1_remote_asset_proto_goTypes = nil file_build_bazel_remote_asset_v1_remote_asset_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// FetchClient is the client API for Fetch service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type FetchClient interface { - // Resolve or fetch referenced assets, making them available to the caller and - // other consumers in the [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage]. - // - // Servers *MAY* fetch content that they do not already have cached, for any - // URLs they support. - // - // Servers *SHOULD* ensure that referenced files are present in the CAS at the - // time of the response, and (if supported) that they will remain available - // for a reasonable period of time. The lifetimes of the referenced blobs *SHOULD* - // be increased if necessary and applicable. - // In the event that a client receives a reference to content that is no - // longer present, it *MAY* re-issue the request with - // `oldest_content_accepted` set to a more recent timestamp than the original - // attempt, to induce a re-fetch from origin. - // - // Servers *MAY* cache fetched content and reuse it for subsequent requests, - // subject to `oldest_content_accepted`. - // - // Servers *MAY* support the complementary [Push][build.bazel.remote.asset.v1.Push] - // API and allow content to be directly inserted for use in future fetch - // responses. - // - // Servers *MUST* ensure Fetch'd content matches all the specified - // qualifiers except in the case of previously Push'd resources, for which - // the server *MAY* trust the pushing client to have set the qualifiers - // correctly, without validation. - // - // Servers not implementing the complementary [Push][build.bazel.remote.asset.v1.Push] - // API *MUST* reject requests containing qualifiers it does not support. - // - // Servers *MAY* transform assets as part of the fetch. For example a - // tarball fetched by [FetchDirectory][build.bazel.remote.asset.v1.Fetch.FetchDirectory] - // might be unpacked, or a Git repository - // fetched by [FetchBlob][build.bazel.remote.asset.v1.Fetch.FetchBlob] - // might be passed through `git-archive`. - // - // Errors handling the requested assets will be returned as gRPC Status errors - // here; errors outside the server's control will be returned inline in the - // `status` field of the response (see comment there for details). - // The possible RPC errors include: - // - `INVALID_ARGUMENT`: One or more arguments were invalid, such as a - // qualifier that is not supported by the server. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to - // perform the requested operation. The client may retry after a delay. - // - `UNAVAILABLE`: Due to a transient condition the operation could not be - // completed. The client should retry. - // - `INTERNAL`: An internal error occurred while performing the operation. - // The client should retry. - // - `DEADLINE_EXCEEDED`: The fetch could not be completed within the given - // RPC deadline. The client should retry for at least as long as the value - // provided in `timeout` field of the request. - // - // In the case of unsupported qualifiers, the server *SHOULD* additionally - // send a [BadRequest][google.rpc.BadRequest] error detail where, for each - // unsupported qualifier, there is a `FieldViolation` with a `field` of - // `qualifiers.name` and a `description` of `"{qualifier}" not supported` - // indicating the name of the unsupported qualifier. - FetchBlob(ctx context.Context, in *FetchBlobRequest, opts ...grpc.CallOption) (*FetchBlobResponse, error) - FetchDirectory(ctx context.Context, in *FetchDirectoryRequest, opts ...grpc.CallOption) (*FetchDirectoryResponse, error) -} - -type fetchClient struct { - cc grpc.ClientConnInterface -} - -func NewFetchClient(cc grpc.ClientConnInterface) FetchClient { - return &fetchClient{cc} -} - -func (c *fetchClient) FetchBlob(ctx context.Context, in *FetchBlobRequest, opts ...grpc.CallOption) (*FetchBlobResponse, error) { - out := new(FetchBlobResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.asset.v1.Fetch/FetchBlob", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *fetchClient) FetchDirectory(ctx context.Context, in *FetchDirectoryRequest, opts ...grpc.CallOption) (*FetchDirectoryResponse, error) { - out := new(FetchDirectoryResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.asset.v1.Fetch/FetchDirectory", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FetchServer is the server API for Fetch service. -type FetchServer interface { - // Resolve or fetch referenced assets, making them available to the caller and - // other consumers in the [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage]. - // - // Servers *MAY* fetch content that they do not already have cached, for any - // URLs they support. - // - // Servers *SHOULD* ensure that referenced files are present in the CAS at the - // time of the response, and (if supported) that they will remain available - // for a reasonable period of time. The lifetimes of the referenced blobs *SHOULD* - // be increased if necessary and applicable. - // In the event that a client receives a reference to content that is no - // longer present, it *MAY* re-issue the request with - // `oldest_content_accepted` set to a more recent timestamp than the original - // attempt, to induce a re-fetch from origin. - // - // Servers *MAY* cache fetched content and reuse it for subsequent requests, - // subject to `oldest_content_accepted`. - // - // Servers *MAY* support the complementary [Push][build.bazel.remote.asset.v1.Push] - // API and allow content to be directly inserted for use in future fetch - // responses. - // - // Servers *MUST* ensure Fetch'd content matches all the specified - // qualifiers except in the case of previously Push'd resources, for which - // the server *MAY* trust the pushing client to have set the qualifiers - // correctly, without validation. - // - // Servers not implementing the complementary [Push][build.bazel.remote.asset.v1.Push] - // API *MUST* reject requests containing qualifiers it does not support. - // - // Servers *MAY* transform assets as part of the fetch. For example a - // tarball fetched by [FetchDirectory][build.bazel.remote.asset.v1.Fetch.FetchDirectory] - // might be unpacked, or a Git repository - // fetched by [FetchBlob][build.bazel.remote.asset.v1.Fetch.FetchBlob] - // might be passed through `git-archive`. - // - // Errors handling the requested assets will be returned as gRPC Status errors - // here; errors outside the server's control will be returned inline in the - // `status` field of the response (see comment there for details). - // The possible RPC errors include: - // - `INVALID_ARGUMENT`: One or more arguments were invalid, such as a - // qualifier that is not supported by the server. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to - // perform the requested operation. The client may retry after a delay. - // - `UNAVAILABLE`: Due to a transient condition the operation could not be - // completed. The client should retry. - // - `INTERNAL`: An internal error occurred while performing the operation. - // The client should retry. - // - `DEADLINE_EXCEEDED`: The fetch could not be completed within the given - // RPC deadline. The client should retry for at least as long as the value - // provided in `timeout` field of the request. - // - // In the case of unsupported qualifiers, the server *SHOULD* additionally - // send a [BadRequest][google.rpc.BadRequest] error detail where, for each - // unsupported qualifier, there is a `FieldViolation` with a `field` of - // `qualifiers.name` and a `description` of `"{qualifier}" not supported` - // indicating the name of the unsupported qualifier. - FetchBlob(context.Context, *FetchBlobRequest) (*FetchBlobResponse, error) - FetchDirectory(context.Context, *FetchDirectoryRequest) (*FetchDirectoryResponse, error) -} - -// UnimplementedFetchServer can be embedded to have forward compatible implementations. -type UnimplementedFetchServer struct { -} - -func (*UnimplementedFetchServer) FetchBlob(context.Context, *FetchBlobRequest) (*FetchBlobResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method FetchBlob not implemented") -} -func (*UnimplementedFetchServer) FetchDirectory(context.Context, *FetchDirectoryRequest) (*FetchDirectoryResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method FetchDirectory not implemented") -} - -func RegisterFetchServer(s *grpc.Server, srv FetchServer) { - s.RegisterService(&_Fetch_serviceDesc, srv) -} - -func _Fetch_FetchBlob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchBlobRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FetchServer).FetchBlob(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.asset.v1.Fetch/FetchBlob", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FetchServer).FetchBlob(ctx, req.(*FetchBlobRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Fetch_FetchDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FetchServer).FetchDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.asset.v1.Fetch/FetchDirectory", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FetchServer).FetchDirectory(ctx, req.(*FetchDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Fetch_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.asset.v1.Fetch", - HandlerType: (*FetchServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchBlob", - Handler: _Fetch_FetchBlob_Handler, - }, - { - MethodName: "FetchDirectory", - Handler: _Fetch_FetchDirectory_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "build/bazel/remote/asset/v1/remote_asset.proto", -} - -// PushClient is the client API for Push service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type PushClient interface { - // These APIs associate the identifying information of a resource, as - // indicated by URI and optionally Qualifiers, with content available in the - // CAS. For example, associating a repository url and a commit id with a - // Directory Digest. - // - // Servers *SHOULD* only allow trusted clients to associate content, and *MAY* - // only allow certain URIs to be pushed. - // - // Clients *MUST* ensure associated content is available in CAS prior to - // pushing. - // - // Clients *MUST* ensure the Qualifiers listed correctly match the contents, - // and Servers *MAY* trust these values without validation. - // Fetch servers *MAY* require exact match of all qualifiers when returning - // content previously pushed, or allow fetching content with only a subset of - // the qualifiers specified on Push. - // - // Clients can specify expiration information that the server *SHOULD* - // respect. Subsequent requests can be used to alter the expiration time. - // - // A minimal compliant Fetch implementation may support only Push'd content - // and return `NOT_FOUND` for any resource that was not pushed first. - // Alternatively, a compliant implementation may choose to not support Push - // and only return resources that can be Fetch'd from origin. - // - // Errors will be returned as gRPC Status errors. - // The possible RPC errors include: - // - `INVALID_ARGUMENT`: One or more arguments to the RPC were invalid. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to - // perform the requested operation. The client may retry after a delay. - // - `UNAVAILABLE`: Due to a transient condition the operation could not be - // completed. The client should retry. - // - `INTERNAL`: An internal error occurred while performing the operation. - // The client should retry. - PushBlob(ctx context.Context, in *PushBlobRequest, opts ...grpc.CallOption) (*PushBlobResponse, error) - PushDirectory(ctx context.Context, in *PushDirectoryRequest, opts ...grpc.CallOption) (*PushDirectoryResponse, error) -} - -type pushClient struct { - cc grpc.ClientConnInterface -} - -func NewPushClient(cc grpc.ClientConnInterface) PushClient { - return &pushClient{cc} -} - -func (c *pushClient) PushBlob(ctx context.Context, in *PushBlobRequest, opts ...grpc.CallOption) (*PushBlobResponse, error) { - out := new(PushBlobResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.asset.v1.Push/PushBlob", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pushClient) PushDirectory(ctx context.Context, in *PushDirectoryRequest, opts ...grpc.CallOption) (*PushDirectoryResponse, error) { - out := new(PushDirectoryResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.asset.v1.Push/PushDirectory", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PushServer is the server API for Push service. -type PushServer interface { - // These APIs associate the identifying information of a resource, as - // indicated by URI and optionally Qualifiers, with content available in the - // CAS. For example, associating a repository url and a commit id with a - // Directory Digest. - // - // Servers *SHOULD* only allow trusted clients to associate content, and *MAY* - // only allow certain URIs to be pushed. - // - // Clients *MUST* ensure associated content is available in CAS prior to - // pushing. - // - // Clients *MUST* ensure the Qualifiers listed correctly match the contents, - // and Servers *MAY* trust these values without validation. - // Fetch servers *MAY* require exact match of all qualifiers when returning - // content previously pushed, or allow fetching content with only a subset of - // the qualifiers specified on Push. - // - // Clients can specify expiration information that the server *SHOULD* - // respect. Subsequent requests can be used to alter the expiration time. - // - // A minimal compliant Fetch implementation may support only Push'd content - // and return `NOT_FOUND` for any resource that was not pushed first. - // Alternatively, a compliant implementation may choose to not support Push - // and only return resources that can be Fetch'd from origin. - // - // Errors will be returned as gRPC Status errors. - // The possible RPC errors include: - // - `INVALID_ARGUMENT`: One or more arguments to the RPC were invalid. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to - // perform the requested operation. The client may retry after a delay. - // - `UNAVAILABLE`: Due to a transient condition the operation could not be - // completed. The client should retry. - // - `INTERNAL`: An internal error occurred while performing the operation. - // The client should retry. - PushBlob(context.Context, *PushBlobRequest) (*PushBlobResponse, error) - PushDirectory(context.Context, *PushDirectoryRequest) (*PushDirectoryResponse, error) -} - -// UnimplementedPushServer can be embedded to have forward compatible implementations. -type UnimplementedPushServer struct { -} - -func (*UnimplementedPushServer) PushBlob(context.Context, *PushBlobRequest) (*PushBlobResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method PushBlob not implemented") -} -func (*UnimplementedPushServer) PushDirectory(context.Context, *PushDirectoryRequest) (*PushDirectoryResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method PushDirectory not implemented") -} - -func RegisterPushServer(s *grpc.Server, srv PushServer) { - s.RegisterService(&_Push_serviceDesc, srv) -} - -func _Push_PushBlob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushBlobRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PushServer).PushBlob(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.asset.v1.Push/PushBlob", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PushServer).PushBlob(ctx, req.(*PushBlobRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Push_PushDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PushDirectoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PushServer).PushDirectory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.asset.v1.Push/PushDirectory", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PushServer).PushDirectory(ctx, req.(*PushDirectoryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Push_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.asset.v1.Push", - HandlerType: (*PushServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PushBlob", - Handler: _Push_PushBlob_Handler, - }, - { - MethodName: "PushDirectory", - Handler: _Push_PushDirectory_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "build/bazel/remote/asset/v1/remote_asset.proto", -} diff --git a/build/bazel/remote/execution/v2/BUILD b/build/bazel/remote/execution/v2/BUILD index e8edcf09..53da11a8 100644 --- a/build/bazel/remote/execution/v2/BUILD +++ b/build/bazel/remote/execution/v2/BUILD @@ -1,6 +1,11 @@ -package(default_visibility = ["//visibility:public"]) +# gazelle:ignore +load("@rules_go//proto:def.bzl", "go_grpc_library") +load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_proto_grpc_cpp//:defs.bzl", "cpp_grpc_library") + +package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -9,33 +14,48 @@ proto_library( srcs = ["remote_execution.proto"], deps = [ "//build/bazel/semver:semver_proto", + "@com_google_googleapis//google/api:annotations_proto", + "@com_google_googleapis//google/api:http_proto", + "@com_google_googleapis//google/longrunning:operations_proto", + "@com_google_googleapis//google/rpc:status_proto", "@com_google_protobuf//:any_proto", "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", - "@googleapis//google/api:annotations_proto", - "@googleapis//google/api:http_proto", - "@googleapis//google/longrunning:operations_proto", - "@googleapis//google/rpc:status_proto", ], ) -alias( - name = "remote_execution_java_proto", - actual = "//build/bazel/remote/execution/v2/java:remote_execution_java_proto", +go_grpc_library( + name = "remote_execution_go_grpc", + importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2", + protos = [":remote_execution_proto"], + deps = [ + "//build/bazel/semver:semver_go_grpc", + "@com_google_googleapis//google/longrunning:longrunning_go_proto", + "@org_golang_google_genproto_googleapis_api//annotations", + "@org_golang_google_genproto_googleapis_rpc//http", + "@org_golang_google_genproto_googleapis_rpc//status", + ], ) alias( - name = "remote_execution_cc_proto", - actual = "//build/bazel/remote/execution/v2/cc:remote_execution_cc_grpc", + name = "go_default_library", + actual = ":remote_execution_go_grpc", ) -alias( - name = "remote_execution_go_proto", - actual = "//build/bazel/remote/execution/v2/go:remote_execution_go_proto", +cpp_grpc_library( + name = "remote_execution_cpp_grpc", + protos = [":remote_execution_proto"], + deps = [ + "//build/bazel/semver:annotations_cpp_grpc", + "//build/bazel/semver:http_cpp_grpc", + "//build/bazel/semver:operations_cpp_grpc", + "//build/bazel/semver:semver_cpp_grpc", + ], ) -alias( - name = "go_default_library", - actual = "//build/bazel/remote/execution/v2/go:go_default_library", +# TODO: Include/replace with gRPC stub generation targets when feasible +java_proto_library( + name = "remote_execution_java_proto", + deps = [":remote_execution_proto"], ) diff --git a/build/bazel/remote/execution/v2/cc/BUILD b/build/bazel/remote/execution/v2/cc/BUILD deleted file mode 100644 index 541b6455..00000000 --- a/build/bazel/remote/execution/v2/cc/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/execution/v2:__pkg__"]) - -load("//internal:cc_grpc_library.bzl", "cc_grpc_codegen") - -cc_proto_library( - name = "remote_execution_cc_proto", - deps = ["//build/bazel/remote/execution/v2:remote_execution_proto"], -) - -cc_grpc_codegen( - name = "remote_execution_cc_grpc_codegen", - proto = "//build/bazel/remote/execution/v2:remote_execution_proto", -) - -cc_library( - name = "remote_execution_cc_grpc", - srcs = [":remote_execution_cc_grpc_codegen"], - hdrs = [":remote_execution_cc_grpc_codegen"], - include_prefix = "build/bazel/remote/execution/v2", - strip_include_prefix = "/" + package_name(), - deps = [ - ":remote_execution_cc_proto", - "@com_github_grpc_grpc//:grpc++_codegen_proto", - ], -) diff --git a/build/bazel/remote/execution/v2/go/BUILD b/build/bazel/remote/execution/v2/go/BUILD deleted file mode 100644 index 24cc7a0d..00000000 --- a/build/bazel/remote/execution/v2/go/BUILD +++ /dev/null @@ -1,23 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/execution/v2:__pkg__"]) - -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -go_proto_library( - name = "remote_execution_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2", - proto = "//build/bazel/remote/execution/v2:remote_execution_proto", - deps = [ - "//build/bazel/semver:semver_go_proto", - "@org_golang_google_genproto//googleapis/api/annotations", - "@org_golang_google_genproto//googleapis/longrunning", - "@org_golang_google_genproto//googleapis/rpc/status", - ], -) - -go_library( - name = "go_default_library", - embed = [":remote_execution_go_proto"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2", -) diff --git a/build/bazel/remote/execution/v2/java/BUILD b/build/bazel/remote/execution/v2/java/BUILD deleted file mode 100644 index e6bb0225..00000000 --- a/build/bazel/remote/execution/v2/java/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/execution/v2:__pkg__"]) - -java_proto_library( - name = "remote_execution_java_proto", - deps = ["//build/bazel/remote/execution/v2:remote_execution_proto"], -) diff --git a/build/bazel/remote/execution/v2/remote_execution.pb.go b/build/bazel/remote/execution/v2/remote_execution.pb.go index 3dad0e13..754e9756 100755 --- a/build/bazel/remote/execution/v2/remote_execution.pb.go +++ b/build/bazel/remote/execution/v2/remote_execution.pb.go @@ -14,21 +14,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v3.15.0 +// protoc-gen-go v1.32.0 +// protoc v3.21.7 // source: build/bazel/remote/execution/v2/remote_execution.proto package remoteexecution import ( - context "context" semver "github.com/bazelbuild/remote-apis/build/bazel/semver" _ "google.golang.org/genproto/googleapis/api/annotations" longrunning "google.golang.org/genproto/googleapis/longrunning" status "google.golang.org/genproto/googleapis/rpc/status" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status1 "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" @@ -6592,969 +6588,3 @@ func file_build_bazel_remote_execution_v2_remote_execution_proto_init() { file_build_bazel_remote_execution_v2_remote_execution_proto_goTypes = nil file_build_bazel_remote_execution_v2_remote_execution_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ExecutionClient is the client API for Execution service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ExecutionClient interface { - // Execute an action remotely. - // - // In order to execute an action, the client must first upload all of the - // inputs, the - // [Command][build.bazel.remote.execution.v2.Command] to run, and the - // [Action][build.bazel.remote.execution.v2.Action] into the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage]. - // It then calls `Execute` with an `action_digest` referring to them. The - // server will run the action and eventually return the result. - // - // The input `Action`'s fields MUST meet the various canonicalization - // requirements specified in the documentation for their types so that it has - // the same digest as other logically equivalent `Action`s. The server MAY - // enforce the requirements and return errors if a non-canonical input is - // received. It MAY also proceed without verifying some or all of the - // requirements, such as for performance reasons. If the server does not - // verify the requirement, then it will treat the `Action` as distinct from - // another logically equivalent action if they hash differently. - // - // Returns a stream of - // [google.longrunning.Operation][google.longrunning.Operation] messages - // describing the resulting execution, with eventual `response` - // [ExecuteResponse][build.bazel.remote.execution.v2.ExecuteResponse]. The - // `metadata` on the operation is of type - // [ExecuteOperationMetadata][build.bazel.remote.execution.v2.ExecuteOperationMetadata]. - // - // If the client remains connected after the first response is returned after - // the server, then updates are streamed as if the client had called - // [WaitExecution][build.bazel.remote.execution.v2.Execution.WaitExecution] - // until the execution completes or the request reaches an error. The - // operation can also be queried using [Operations - // API][google.longrunning.Operations.GetOperation]. - // - // The server NEED NOT implement other methods or functionality of the - // Operations API. - // - // Errors discovered during creation of the `Operation` will be reported - // as gRPC Status errors, while errors that occurred while running the - // action will be reported in the `status` field of the `ExecuteResponse`. The - // server MUST NOT set the `error` field of the `Operation` proto. - // The possible errors include: - // - // - `INVALID_ARGUMENT`: One or more arguments are invalid. - // - `FAILED_PRECONDITION`: One or more errors occurred in setting up the - // action requested, such as a missing input or command or no worker being - // available. The client may be able to fix the errors and retry. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run - // the action. - // - `UNAVAILABLE`: Due to a transient condition, such as all workers being - // occupied (and the server does not support a queue), the action could not - // be started. The client should retry. - // - `INTERNAL`: An internal error occurred in the execution engine or the - // worker. - // - `DEADLINE_EXCEEDED`: The execution timed out. - // - `CANCELLED`: The operation was cancelled by the client. This status is - // only possible if the server implements the Operations API CancelOperation - // method, and it was called for the current execution. - // - // In the case of a missing input or command, the server SHOULD additionally - // send a [PreconditionFailure][google.rpc.PreconditionFailure] error detail - // where, for each requested blob not present in the CAS, there is a - // `Violation` with a `type` of `MISSING` and a `subject` of - // `"blobs/{digest_function/}{hash}/{size}"` indicating the digest of the - // missing blob. The `subject` is formatted the same way as the - // `resource_name` provided to - // [ByteStream.Read][google.bytestream.ByteStream.Read], with the leading - // instance name omitted. `digest_function` MUST thus be omitted if its value - // is one of MD5, MURMUR3, SHA1, SHA256, SHA384, SHA512, or VSO. - // - // The server does not need to guarantee that a call to this method leads to - // at most one execution of the action. The server MAY execute the action - // multiple times, potentially in parallel. These redundant executions MAY - // continue to run, even if the operation is completed. - Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (Execution_ExecuteClient, error) - // Wait for an execution operation to complete. When the client initially - // makes the request, the server immediately responds with the current status - // of the execution. The server will leave the request stream open until the - // operation completes, and then respond with the completed operation. The - // server MAY choose to stream additional updates as execution progresses, - // such as to provide an update as to the state of the execution. - // - // In addition to the cases describe for Execute, the WaitExecution method - // may fail as follows: - // - // - `NOT_FOUND`: The operation no longer exists due to any of a transient - // condition, an unknown operation name, or if the server implements the - // Operations API DeleteOperation method and it was called for the current - // execution. The client should call `Execute` to retry. - WaitExecution(ctx context.Context, in *WaitExecutionRequest, opts ...grpc.CallOption) (Execution_WaitExecutionClient, error) -} - -type executionClient struct { - cc grpc.ClientConnInterface -} - -func NewExecutionClient(cc grpc.ClientConnInterface) ExecutionClient { - return &executionClient{cc} -} - -func (c *executionClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (Execution_ExecuteClient, error) { - stream, err := c.cc.NewStream(ctx, &_Execution_serviceDesc.Streams[0], "/build.bazel.remote.execution.v2.Execution/Execute", opts...) - if err != nil { - return nil, err - } - x := &executionExecuteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Execution_ExecuteClient interface { - Recv() (*longrunning.Operation, error) - grpc.ClientStream -} - -type executionExecuteClient struct { - grpc.ClientStream -} - -func (x *executionExecuteClient) Recv() (*longrunning.Operation, error) { - m := new(longrunning.Operation) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *executionClient) WaitExecution(ctx context.Context, in *WaitExecutionRequest, opts ...grpc.CallOption) (Execution_WaitExecutionClient, error) { - stream, err := c.cc.NewStream(ctx, &_Execution_serviceDesc.Streams[1], "/build.bazel.remote.execution.v2.Execution/WaitExecution", opts...) - if err != nil { - return nil, err - } - x := &executionWaitExecutionClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Execution_WaitExecutionClient interface { - Recv() (*longrunning.Operation, error) - grpc.ClientStream -} - -type executionWaitExecutionClient struct { - grpc.ClientStream -} - -func (x *executionWaitExecutionClient) Recv() (*longrunning.Operation, error) { - m := new(longrunning.Operation) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ExecutionServer is the server API for Execution service. -type ExecutionServer interface { - // Execute an action remotely. - // - // In order to execute an action, the client must first upload all of the - // inputs, the - // [Command][build.bazel.remote.execution.v2.Command] to run, and the - // [Action][build.bazel.remote.execution.v2.Action] into the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage]. - // It then calls `Execute` with an `action_digest` referring to them. The - // server will run the action and eventually return the result. - // - // The input `Action`'s fields MUST meet the various canonicalization - // requirements specified in the documentation for their types so that it has - // the same digest as other logically equivalent `Action`s. The server MAY - // enforce the requirements and return errors if a non-canonical input is - // received. It MAY also proceed without verifying some or all of the - // requirements, such as for performance reasons. If the server does not - // verify the requirement, then it will treat the `Action` as distinct from - // another logically equivalent action if they hash differently. - // - // Returns a stream of - // [google.longrunning.Operation][google.longrunning.Operation] messages - // describing the resulting execution, with eventual `response` - // [ExecuteResponse][build.bazel.remote.execution.v2.ExecuteResponse]. The - // `metadata` on the operation is of type - // [ExecuteOperationMetadata][build.bazel.remote.execution.v2.ExecuteOperationMetadata]. - // - // If the client remains connected after the first response is returned after - // the server, then updates are streamed as if the client had called - // [WaitExecution][build.bazel.remote.execution.v2.Execution.WaitExecution] - // until the execution completes or the request reaches an error. The - // operation can also be queried using [Operations - // API][google.longrunning.Operations.GetOperation]. - // - // The server NEED NOT implement other methods or functionality of the - // Operations API. - // - // Errors discovered during creation of the `Operation` will be reported - // as gRPC Status errors, while errors that occurred while running the - // action will be reported in the `status` field of the `ExecuteResponse`. The - // server MUST NOT set the `error` field of the `Operation` proto. - // The possible errors include: - // - // - `INVALID_ARGUMENT`: One or more arguments are invalid. - // - `FAILED_PRECONDITION`: One or more errors occurred in setting up the - // action requested, such as a missing input or command or no worker being - // available. The client may be able to fix the errors and retry. - // - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run - // the action. - // - `UNAVAILABLE`: Due to a transient condition, such as all workers being - // occupied (and the server does not support a queue), the action could not - // be started. The client should retry. - // - `INTERNAL`: An internal error occurred in the execution engine or the - // worker. - // - `DEADLINE_EXCEEDED`: The execution timed out. - // - `CANCELLED`: The operation was cancelled by the client. This status is - // only possible if the server implements the Operations API CancelOperation - // method, and it was called for the current execution. - // - // In the case of a missing input or command, the server SHOULD additionally - // send a [PreconditionFailure][google.rpc.PreconditionFailure] error detail - // where, for each requested blob not present in the CAS, there is a - // `Violation` with a `type` of `MISSING` and a `subject` of - // `"blobs/{digest_function/}{hash}/{size}"` indicating the digest of the - // missing blob. The `subject` is formatted the same way as the - // `resource_name` provided to - // [ByteStream.Read][google.bytestream.ByteStream.Read], with the leading - // instance name omitted. `digest_function` MUST thus be omitted if its value - // is one of MD5, MURMUR3, SHA1, SHA256, SHA384, SHA512, or VSO. - // - // The server does not need to guarantee that a call to this method leads to - // at most one execution of the action. The server MAY execute the action - // multiple times, potentially in parallel. These redundant executions MAY - // continue to run, even if the operation is completed. - Execute(*ExecuteRequest, Execution_ExecuteServer) error - // Wait for an execution operation to complete. When the client initially - // makes the request, the server immediately responds with the current status - // of the execution. The server will leave the request stream open until the - // operation completes, and then respond with the completed operation. The - // server MAY choose to stream additional updates as execution progresses, - // such as to provide an update as to the state of the execution. - // - // In addition to the cases describe for Execute, the WaitExecution method - // may fail as follows: - // - // - `NOT_FOUND`: The operation no longer exists due to any of a transient - // condition, an unknown operation name, or if the server implements the - // Operations API DeleteOperation method and it was called for the current - // execution. The client should call `Execute` to retry. - WaitExecution(*WaitExecutionRequest, Execution_WaitExecutionServer) error -} - -// UnimplementedExecutionServer can be embedded to have forward compatible implementations. -type UnimplementedExecutionServer struct { -} - -func (*UnimplementedExecutionServer) Execute(*ExecuteRequest, Execution_ExecuteServer) error { - return status1.Errorf(codes.Unimplemented, "method Execute not implemented") -} -func (*UnimplementedExecutionServer) WaitExecution(*WaitExecutionRequest, Execution_WaitExecutionServer) error { - return status1.Errorf(codes.Unimplemented, "method WaitExecution not implemented") -} - -func RegisterExecutionServer(s *grpc.Server, srv ExecutionServer) { - s.RegisterService(&_Execution_serviceDesc, srv) -} - -func _Execution_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ExecuteRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ExecutionServer).Execute(m, &executionExecuteServer{stream}) -} - -type Execution_ExecuteServer interface { - Send(*longrunning.Operation) error - grpc.ServerStream -} - -type executionExecuteServer struct { - grpc.ServerStream -} - -func (x *executionExecuteServer) Send(m *longrunning.Operation) error { - return x.ServerStream.SendMsg(m) -} - -func _Execution_WaitExecution_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(WaitExecutionRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ExecutionServer).WaitExecution(m, &executionWaitExecutionServer{stream}) -} - -type Execution_WaitExecutionServer interface { - Send(*longrunning.Operation) error - grpc.ServerStream -} - -type executionWaitExecutionServer struct { - grpc.ServerStream -} - -func (x *executionWaitExecutionServer) Send(m *longrunning.Operation) error { - return x.ServerStream.SendMsg(m) -} - -var _Execution_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.execution.v2.Execution", - HandlerType: (*ExecutionServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Execute", - Handler: _Execution_Execute_Handler, - ServerStreams: true, - }, - { - StreamName: "WaitExecution", - Handler: _Execution_WaitExecution_Handler, - ServerStreams: true, - }, - }, - Metadata: "build/bazel/remote/execution/v2/remote_execution.proto", -} - -// ActionCacheClient is the client API for ActionCache service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ActionCacheClient interface { - // Retrieve a cached execution result. - // - // Implementations SHOULD ensure that any blobs referenced from the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage] - // are available at the time of returning the - // [ActionResult][build.bazel.remote.execution.v2.ActionResult] and will be - // for some period of time afterwards. The lifetimes of the referenced blobs SHOULD be increased - // if necessary and applicable. - // - // Errors: - // - // * `NOT_FOUND`: The requested `ActionResult` is not in the cache. - GetActionResult(ctx context.Context, in *GetActionResultRequest, opts ...grpc.CallOption) (*ActionResult, error) - // Upload a new execution result. - // - // In order to allow the server to perform access control based on the type of - // action, and to assist with client debugging, the client MUST first upload - // the [Action][build.bazel.remote.execution.v2.Execution] that produced the - // result, along with its - // [Command][build.bazel.remote.execution.v2.Command], into the - // `ContentAddressableStorage`. - // - // Server implementations MAY modify the - // `UpdateActionResultRequest.action_result` and return an equivalent value. - // - // Errors: - // - // - `INVALID_ARGUMENT`: One or more arguments are invalid. - // - `FAILED_PRECONDITION`: One or more errors occurred in updating the - // action result, such as a missing command or action. - // - `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the - // entry to the cache. - UpdateActionResult(ctx context.Context, in *UpdateActionResultRequest, opts ...grpc.CallOption) (*ActionResult, error) -} - -type actionCacheClient struct { - cc grpc.ClientConnInterface -} - -func NewActionCacheClient(cc grpc.ClientConnInterface) ActionCacheClient { - return &actionCacheClient{cc} -} - -func (c *actionCacheClient) GetActionResult(ctx context.Context, in *GetActionResultRequest, opts ...grpc.CallOption) (*ActionResult, error) { - out := new(ActionResult) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.ActionCache/GetActionResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *actionCacheClient) UpdateActionResult(ctx context.Context, in *UpdateActionResultRequest, opts ...grpc.CallOption) (*ActionResult, error) { - out := new(ActionResult) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.ActionCache/UpdateActionResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ActionCacheServer is the server API for ActionCache service. -type ActionCacheServer interface { - // Retrieve a cached execution result. - // - // Implementations SHOULD ensure that any blobs referenced from the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage] - // are available at the time of returning the - // [ActionResult][build.bazel.remote.execution.v2.ActionResult] and will be - // for some period of time afterwards. The lifetimes of the referenced blobs SHOULD be increased - // if necessary and applicable. - // - // Errors: - // - // * `NOT_FOUND`: The requested `ActionResult` is not in the cache. - GetActionResult(context.Context, *GetActionResultRequest) (*ActionResult, error) - // Upload a new execution result. - // - // In order to allow the server to perform access control based on the type of - // action, and to assist with client debugging, the client MUST first upload - // the [Action][build.bazel.remote.execution.v2.Execution] that produced the - // result, along with its - // [Command][build.bazel.remote.execution.v2.Command], into the - // `ContentAddressableStorage`. - // - // Server implementations MAY modify the - // `UpdateActionResultRequest.action_result` and return an equivalent value. - // - // Errors: - // - // - `INVALID_ARGUMENT`: One or more arguments are invalid. - // - `FAILED_PRECONDITION`: One or more errors occurred in updating the - // action result, such as a missing command or action. - // - `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the - // entry to the cache. - UpdateActionResult(context.Context, *UpdateActionResultRequest) (*ActionResult, error) -} - -// UnimplementedActionCacheServer can be embedded to have forward compatible implementations. -type UnimplementedActionCacheServer struct { -} - -func (*UnimplementedActionCacheServer) GetActionResult(context.Context, *GetActionResultRequest) (*ActionResult, error) { - return nil, status1.Errorf(codes.Unimplemented, "method GetActionResult not implemented") -} -func (*UnimplementedActionCacheServer) UpdateActionResult(context.Context, *UpdateActionResultRequest) (*ActionResult, error) { - return nil, status1.Errorf(codes.Unimplemented, "method UpdateActionResult not implemented") -} - -func RegisterActionCacheServer(s *grpc.Server, srv ActionCacheServer) { - s.RegisterService(&_ActionCache_serviceDesc, srv) -} - -func _ActionCache_GetActionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetActionResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ActionCacheServer).GetActionResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.ActionCache/GetActionResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ActionCacheServer).GetActionResult(ctx, req.(*GetActionResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ActionCache_UpdateActionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateActionResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ActionCacheServer).UpdateActionResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.ActionCache/UpdateActionResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ActionCacheServer).UpdateActionResult(ctx, req.(*UpdateActionResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ActionCache_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.execution.v2.ActionCache", - HandlerType: (*ActionCacheServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetActionResult", - Handler: _ActionCache_GetActionResult_Handler, - }, - { - MethodName: "UpdateActionResult", - Handler: _ActionCache_UpdateActionResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "build/bazel/remote/execution/v2/remote_execution.proto", -} - -// ContentAddressableStorageClient is the client API for ContentAddressableStorage service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ContentAddressableStorageClient interface { - // Determine if blobs are present in the CAS. - // - // Clients can use this API before uploading blobs to determine which ones are - // already present in the CAS and do not need to be uploaded again. - // - // Servers SHOULD increase the lifetimes of the referenced blobs if necessary and - // applicable. - // - // There are no method-specific errors. - FindMissingBlobs(ctx context.Context, in *FindMissingBlobsRequest, opts ...grpc.CallOption) (*FindMissingBlobsResponse, error) - // Upload many blobs at once. - // - // The server may enforce a limit of the combined total size of blobs - // to be uploaded using this API. This limit may be obtained using the - // [Capabilities][build.bazel.remote.execution.v2.Capabilities] API. - // Requests exceeding the limit should either be split into smaller - // chunks or uploaded using the - // [ByteStream API][google.bytestream.ByteStream], as appropriate. - // - // This request is equivalent to calling a Bytestream `Write` request - // on each individual blob, in parallel. The requests may succeed or fail - // independently. - // - // Errors: - // - // - `INVALID_ARGUMENT`: The client attempted to upload more than the - // server supported limit. - // - // Individual requests may return the following errors, additionally: - // - // * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. - // * `INVALID_ARGUMENT`: The - // [Digest][build.bazel.remote.execution.v2.Digest] does not match the - // provided data. - BatchUpdateBlobs(ctx context.Context, in *BatchUpdateBlobsRequest, opts ...grpc.CallOption) (*BatchUpdateBlobsResponse, error) - // Download many blobs at once. - // - // The server may enforce a limit of the combined total size of blobs - // to be downloaded using this API. This limit may be obtained using the - // [Capabilities][build.bazel.remote.execution.v2.Capabilities] API. - // Requests exceeding the limit should either be split into smaller - // chunks or downloaded using the - // [ByteStream API][google.bytestream.ByteStream], as appropriate. - // - // This request is equivalent to calling a Bytestream `Read` request - // on each individual blob, in parallel. The requests may succeed or fail - // independently. - // - // Errors: - // - // - `INVALID_ARGUMENT`: The client attempted to read more than the - // server supported limit. - // - // Every error on individual read will be returned in the corresponding digest - // status. - BatchReadBlobs(ctx context.Context, in *BatchReadBlobsRequest, opts ...grpc.CallOption) (*BatchReadBlobsResponse, error) - // Fetch the entire directory tree rooted at a node. - // - // This request must be targeted at a - // [Directory][build.bazel.remote.execution.v2.Directory] stored in the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage] - // (CAS). The server will enumerate the `Directory` tree recursively and - // return every node descended from the root. - // - // The GetTreeRequest.page_token parameter can be used to skip ahead in - // the stream (e.g. when retrying a partially completed and aborted request), - // by setting it to a value taken from GetTreeResponse.next_page_token of the - // last successfully processed GetTreeResponse). - // - // The exact traversal order is unspecified and, unless retrieving subsequent - // pages from an earlier request, is not guaranteed to be stable across - // multiple invocations of `GetTree`. - // - // If part of the tree is missing from the CAS, the server will return the - // portion present and omit the rest. - // - // Errors: - // - // * `NOT_FOUND`: The requested tree root is not present in the CAS. - GetTree(ctx context.Context, in *GetTreeRequest, opts ...grpc.CallOption) (ContentAddressableStorage_GetTreeClient, error) -} - -type contentAddressableStorageClient struct { - cc grpc.ClientConnInterface -} - -func NewContentAddressableStorageClient(cc grpc.ClientConnInterface) ContentAddressableStorageClient { - return &contentAddressableStorageClient{cc} -} - -func (c *contentAddressableStorageClient) FindMissingBlobs(ctx context.Context, in *FindMissingBlobsRequest, opts ...grpc.CallOption) (*FindMissingBlobsResponse, error) { - out := new(FindMissingBlobsResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.ContentAddressableStorage/FindMissingBlobs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *contentAddressableStorageClient) BatchUpdateBlobs(ctx context.Context, in *BatchUpdateBlobsRequest, opts ...grpc.CallOption) (*BatchUpdateBlobsResponse, error) { - out := new(BatchUpdateBlobsResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.ContentAddressableStorage/BatchUpdateBlobs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *contentAddressableStorageClient) BatchReadBlobs(ctx context.Context, in *BatchReadBlobsRequest, opts ...grpc.CallOption) (*BatchReadBlobsResponse, error) { - out := new(BatchReadBlobsResponse) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.ContentAddressableStorage/BatchReadBlobs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *contentAddressableStorageClient) GetTree(ctx context.Context, in *GetTreeRequest, opts ...grpc.CallOption) (ContentAddressableStorage_GetTreeClient, error) { - stream, err := c.cc.NewStream(ctx, &_ContentAddressableStorage_serviceDesc.Streams[0], "/build.bazel.remote.execution.v2.ContentAddressableStorage/GetTree", opts...) - if err != nil { - return nil, err - } - x := &contentAddressableStorageGetTreeClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type ContentAddressableStorage_GetTreeClient interface { - Recv() (*GetTreeResponse, error) - grpc.ClientStream -} - -type contentAddressableStorageGetTreeClient struct { - grpc.ClientStream -} - -func (x *contentAddressableStorageGetTreeClient) Recv() (*GetTreeResponse, error) { - m := new(GetTreeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ContentAddressableStorageServer is the server API for ContentAddressableStorage service. -type ContentAddressableStorageServer interface { - // Determine if blobs are present in the CAS. - // - // Clients can use this API before uploading blobs to determine which ones are - // already present in the CAS and do not need to be uploaded again. - // - // Servers SHOULD increase the lifetimes of the referenced blobs if necessary and - // applicable. - // - // There are no method-specific errors. - FindMissingBlobs(context.Context, *FindMissingBlobsRequest) (*FindMissingBlobsResponse, error) - // Upload many blobs at once. - // - // The server may enforce a limit of the combined total size of blobs - // to be uploaded using this API. This limit may be obtained using the - // [Capabilities][build.bazel.remote.execution.v2.Capabilities] API. - // Requests exceeding the limit should either be split into smaller - // chunks or uploaded using the - // [ByteStream API][google.bytestream.ByteStream], as appropriate. - // - // This request is equivalent to calling a Bytestream `Write` request - // on each individual blob, in parallel. The requests may succeed or fail - // independently. - // - // Errors: - // - // - `INVALID_ARGUMENT`: The client attempted to upload more than the - // server supported limit. - // - // Individual requests may return the following errors, additionally: - // - // * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. - // * `INVALID_ARGUMENT`: The - // [Digest][build.bazel.remote.execution.v2.Digest] does not match the - // provided data. - BatchUpdateBlobs(context.Context, *BatchUpdateBlobsRequest) (*BatchUpdateBlobsResponse, error) - // Download many blobs at once. - // - // The server may enforce a limit of the combined total size of blobs - // to be downloaded using this API. This limit may be obtained using the - // [Capabilities][build.bazel.remote.execution.v2.Capabilities] API. - // Requests exceeding the limit should either be split into smaller - // chunks or downloaded using the - // [ByteStream API][google.bytestream.ByteStream], as appropriate. - // - // This request is equivalent to calling a Bytestream `Read` request - // on each individual blob, in parallel. The requests may succeed or fail - // independently. - // - // Errors: - // - // - `INVALID_ARGUMENT`: The client attempted to read more than the - // server supported limit. - // - // Every error on individual read will be returned in the corresponding digest - // status. - BatchReadBlobs(context.Context, *BatchReadBlobsRequest) (*BatchReadBlobsResponse, error) - // Fetch the entire directory tree rooted at a node. - // - // This request must be targeted at a - // [Directory][build.bazel.remote.execution.v2.Directory] stored in the - // [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage] - // (CAS). The server will enumerate the `Directory` tree recursively and - // return every node descended from the root. - // - // The GetTreeRequest.page_token parameter can be used to skip ahead in - // the stream (e.g. when retrying a partially completed and aborted request), - // by setting it to a value taken from GetTreeResponse.next_page_token of the - // last successfully processed GetTreeResponse). - // - // The exact traversal order is unspecified and, unless retrieving subsequent - // pages from an earlier request, is not guaranteed to be stable across - // multiple invocations of `GetTree`. - // - // If part of the tree is missing from the CAS, the server will return the - // portion present and omit the rest. - // - // Errors: - // - // * `NOT_FOUND`: The requested tree root is not present in the CAS. - GetTree(*GetTreeRequest, ContentAddressableStorage_GetTreeServer) error -} - -// UnimplementedContentAddressableStorageServer can be embedded to have forward compatible implementations. -type UnimplementedContentAddressableStorageServer struct { -} - -func (*UnimplementedContentAddressableStorageServer) FindMissingBlobs(context.Context, *FindMissingBlobsRequest) (*FindMissingBlobsResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method FindMissingBlobs not implemented") -} -func (*UnimplementedContentAddressableStorageServer) BatchUpdateBlobs(context.Context, *BatchUpdateBlobsRequest) (*BatchUpdateBlobsResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method BatchUpdateBlobs not implemented") -} -func (*UnimplementedContentAddressableStorageServer) BatchReadBlobs(context.Context, *BatchReadBlobsRequest) (*BatchReadBlobsResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method BatchReadBlobs not implemented") -} -func (*UnimplementedContentAddressableStorageServer) GetTree(*GetTreeRequest, ContentAddressableStorage_GetTreeServer) error { - return status1.Errorf(codes.Unimplemented, "method GetTree not implemented") -} - -func RegisterContentAddressableStorageServer(s *grpc.Server, srv ContentAddressableStorageServer) { - s.RegisterService(&_ContentAddressableStorage_serviceDesc, srv) -} - -func _ContentAddressableStorage_FindMissingBlobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindMissingBlobsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContentAddressableStorageServer).FindMissingBlobs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.ContentAddressableStorage/FindMissingBlobs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContentAddressableStorageServer).FindMissingBlobs(ctx, req.(*FindMissingBlobsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContentAddressableStorage_BatchUpdateBlobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BatchUpdateBlobsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContentAddressableStorageServer).BatchUpdateBlobs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.ContentAddressableStorage/BatchUpdateBlobs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContentAddressableStorageServer).BatchUpdateBlobs(ctx, req.(*BatchUpdateBlobsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContentAddressableStorage_BatchReadBlobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(BatchReadBlobsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContentAddressableStorageServer).BatchReadBlobs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.ContentAddressableStorage/BatchReadBlobs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContentAddressableStorageServer).BatchReadBlobs(ctx, req.(*BatchReadBlobsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ContentAddressableStorage_GetTree_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetTreeRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ContentAddressableStorageServer).GetTree(m, &contentAddressableStorageGetTreeServer{stream}) -} - -type ContentAddressableStorage_GetTreeServer interface { - Send(*GetTreeResponse) error - grpc.ServerStream -} - -type contentAddressableStorageGetTreeServer struct { - grpc.ServerStream -} - -func (x *contentAddressableStorageGetTreeServer) Send(m *GetTreeResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _ContentAddressableStorage_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.execution.v2.ContentAddressableStorage", - HandlerType: (*ContentAddressableStorageServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FindMissingBlobs", - Handler: _ContentAddressableStorage_FindMissingBlobs_Handler, - }, - { - MethodName: "BatchUpdateBlobs", - Handler: _ContentAddressableStorage_BatchUpdateBlobs_Handler, - }, - { - MethodName: "BatchReadBlobs", - Handler: _ContentAddressableStorage_BatchReadBlobs_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "GetTree", - Handler: _ContentAddressableStorage_GetTree_Handler, - ServerStreams: true, - }, - }, - Metadata: "build/bazel/remote/execution/v2/remote_execution.proto", -} - -// CapabilitiesClient is the client API for Capabilities service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CapabilitiesClient interface { - // GetCapabilities returns the server capabilities configuration of the - // remote endpoint. - // Only the capabilities of the services supported by the endpoint will - // be returned: - // - Execution + CAS + Action Cache endpoints should return both - // CacheCapabilities and ExecutionCapabilities. - // - Execution only endpoints should return ExecutionCapabilities. - // - CAS + Action Cache only endpoints should return CacheCapabilities. - // - // There are no method-specific errors. - GetCapabilities(ctx context.Context, in *GetCapabilitiesRequest, opts ...grpc.CallOption) (*ServerCapabilities, error) -} - -type capabilitiesClient struct { - cc grpc.ClientConnInterface -} - -func NewCapabilitiesClient(cc grpc.ClientConnInterface) CapabilitiesClient { - return &capabilitiesClient{cc} -} - -func (c *capabilitiesClient) GetCapabilities(ctx context.Context, in *GetCapabilitiesRequest, opts ...grpc.CallOption) (*ServerCapabilities, error) { - out := new(ServerCapabilities) - err := c.cc.Invoke(ctx, "/build.bazel.remote.execution.v2.Capabilities/GetCapabilities", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CapabilitiesServer is the server API for Capabilities service. -type CapabilitiesServer interface { - // GetCapabilities returns the server capabilities configuration of the - // remote endpoint. - // Only the capabilities of the services supported by the endpoint will - // be returned: - // - Execution + CAS + Action Cache endpoints should return both - // CacheCapabilities and ExecutionCapabilities. - // - Execution only endpoints should return ExecutionCapabilities. - // - CAS + Action Cache only endpoints should return CacheCapabilities. - // - // There are no method-specific errors. - GetCapabilities(context.Context, *GetCapabilitiesRequest) (*ServerCapabilities, error) -} - -// UnimplementedCapabilitiesServer can be embedded to have forward compatible implementations. -type UnimplementedCapabilitiesServer struct { -} - -func (*UnimplementedCapabilitiesServer) GetCapabilities(context.Context, *GetCapabilitiesRequest) (*ServerCapabilities, error) { - return nil, status1.Errorf(codes.Unimplemented, "method GetCapabilities not implemented") -} - -func RegisterCapabilitiesServer(s *grpc.Server, srv CapabilitiesServer) { - s.RegisterService(&_Capabilities_serviceDesc, srv) -} - -func _Capabilities_GetCapabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCapabilitiesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CapabilitiesServer).GetCapabilities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.execution.v2.Capabilities/GetCapabilities", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CapabilitiesServer).GetCapabilities(ctx, req.(*GetCapabilitiesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Capabilities_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.execution.v2.Capabilities", - HandlerType: (*CapabilitiesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetCapabilities", - Handler: _Capabilities_GetCapabilities_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "build/bazel/remote/execution/v2/remote_execution.proto", -} diff --git a/build/bazel/remote/logstream/v1/BUILD b/build/bazel/remote/logstream/v1/BUILD index d189c9cc..47e83214 100644 --- a/build/bazel/remote/logstream/v1/BUILD +++ b/build/bazel/remote/logstream/v1/BUILD @@ -1,6 +1,10 @@ -package(default_visibility = ["//visibility:public"]) - +load("@rules_java//java:defs.bzl", "java_proto_library") +load("@rules_go//proto:def.bzl", "go_grpc_library") load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_proto_grpc_cpp//:defs.bzl", "cpp_grpc_library") + +# gazelle:ignore +package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -9,22 +13,24 @@ proto_library( srcs = ["remote_logstream.proto"], ) -alias( - name = "remote_logstream_java_proto", - actual = "//build/bazel/remote/logstream/v1/java:remote_logstream_java_proto", +go_grpc_library( + name = "remote_logstream_go_grpc", + importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/logstream/v1", + protos = [":remote_logstream_proto"], ) alias( - name = "remote_logstream_cc_proto", - actual = "//build/bazel/remote/logstream/v1/cc:remote_logstream_cc_grpc", + name = "go_default_library", + actual = ":remote_logstream_go_grpc", ) -alias( - name = "remote_logstream_go_proto", - actual = "//build/bazel/remote/logstream/v1/go:remote_logstream_go_proto", +cpp_grpc_library( + name = "remote_logstream_cpp_grpc", + protos = [":remote_logstream_proto"], ) -alias( - name = "go_default_library", - actual = "//build/bazel/remote/logstream/v1/go:go_default_library", +# TODO: Include/replace with gRPC stub generation targets when feasible +java_proto_library( + name = "remote_logstream_java_proto", + deps = [":remote_logstream_proto"], ) diff --git a/build/bazel/remote/logstream/v1/cc/BUILD b/build/bazel/remote/logstream/v1/cc/BUILD deleted file mode 100644 index 21458e06..00000000 --- a/build/bazel/remote/logstream/v1/cc/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/logstream/v1:__pkg__"]) - -load("//internal:cc_grpc_library.bzl", "cc_grpc_codegen") - -cc_proto_library( - name = "remote_logstream_cc_proto", - deps = ["//build/bazel/remote/logstream/v1:remote_logstream_proto"], -) - -cc_grpc_codegen( - name = "remote_logstream_cc_grpc_codegen", - proto = "//build/bazel/remote/logstream/v1:remote_logstream_proto", -) - -cc_library( - name = "remote_logstream_cc_grpc", - srcs = [":remote_logstream_cc_grpc_codegen"], - hdrs = [":remote_logstream_cc_grpc_codegen"], - include_prefix = "build/bazel/remote/logstream/v1", - strip_include_prefix = "/" + package_name(), - deps = [ - ":remote_logstream_cc_proto", - "@com_github_grpc_grpc//:grpc++_codegen_proto", - ], -) diff --git a/build/bazel/remote/logstream/v1/go/BUILD b/build/bazel/remote/logstream/v1/go/BUILD deleted file mode 100644 index df86f75f..00000000 --- a/build/bazel/remote/logstream/v1/go/BUILD +++ /dev/null @@ -1,17 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/logstream/v1:__pkg__"]) - -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -go_proto_library( - name = "remote_logstream_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/logstream/v1", - proto = "//build/bazel/remote/logstream/v1:remote_logstream_proto", -) - -go_library( - name = "go_default_library", - embed = [":remote_logstream_go_proto"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/logstream/v1", -) diff --git a/build/bazel/remote/logstream/v1/java/BUILD b/build/bazel/remote/logstream/v1/java/BUILD deleted file mode 100644 index 23f3a2c4..00000000 --- a/build/bazel/remote/logstream/v1/java/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//build/bazel/remote/logstream/v1:__pkg__"]) - -java_proto_library( - name = "remote_logstream_java_proto", - deps = ["//build/bazel/remote/logstream/v1:remote_logstream_proto"], -) diff --git a/build/bazel/remote/logstream/v1/remote_logstream.pb.go b/build/bazel/remote/logstream/v1/remote_logstream.pb.go index cd1ac2f6..911573c3 100755 --- a/build/bazel/remote/logstream/v1/remote_logstream.pb.go +++ b/build/bazel/remote/logstream/v1/remote_logstream.pb.go @@ -16,17 +16,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v3.15.0 +// protoc-gen-go v1.32.0 +// protoc v3.21.7 // source: build/bazel/remote/logstream/v1/remote_logstream.proto package remotelogstream import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -295,95 +291,3 @@ func file_build_bazel_remote_logstream_v1_remote_logstream_proto_init() { file_build_bazel_remote_logstream_v1_remote_logstream_proto_goTypes = nil file_build_bazel_remote_logstream_v1_remote_logstream_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// LogStreamServiceClient is the client API for LogStreamService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LogStreamServiceClient interface { - // Create a LogStream which may be written to. - // - // The returned LogStream resource name will include a `write_resource_name` - // which is the resource to use when writing to the LogStream. - // Callers of CreateLogStream are expected to NOT publish the - // `write_resource_name`. - CreateLogStream(ctx context.Context, in *CreateLogStreamRequest, opts ...grpc.CallOption) (*LogStream, error) -} - -type logStreamServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewLogStreamServiceClient(cc grpc.ClientConnInterface) LogStreamServiceClient { - return &logStreamServiceClient{cc} -} - -func (c *logStreamServiceClient) CreateLogStream(ctx context.Context, in *CreateLogStreamRequest, opts ...grpc.CallOption) (*LogStream, error) { - out := new(LogStream) - err := c.cc.Invoke(ctx, "/build.bazel.remote.logstream.v1.LogStreamService/CreateLogStream", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogStreamServiceServer is the server API for LogStreamService service. -type LogStreamServiceServer interface { - // Create a LogStream which may be written to. - // - // The returned LogStream resource name will include a `write_resource_name` - // which is the resource to use when writing to the LogStream. - // Callers of CreateLogStream are expected to NOT publish the - // `write_resource_name`. - CreateLogStream(context.Context, *CreateLogStreamRequest) (*LogStream, error) -} - -// UnimplementedLogStreamServiceServer can be embedded to have forward compatible implementations. -type UnimplementedLogStreamServiceServer struct { -} - -func (*UnimplementedLogStreamServiceServer) CreateLogStream(context.Context, *CreateLogStreamRequest) (*LogStream, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateLogStream not implemented") -} - -func RegisterLogStreamServiceServer(s *grpc.Server, srv LogStreamServiceServer) { - s.RegisterService(&_LogStreamService_serviceDesc, srv) -} - -func _LogStreamService_CreateLogStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateLogStreamRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogStreamServiceServer).CreateLogStream(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/build.bazel.remote.logstream.v1.LogStreamService/CreateLogStream", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogStreamServiceServer).CreateLogStream(ctx, req.(*CreateLogStreamRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _LogStreamService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "build.bazel.remote.logstream.v1.LogStreamService", - HandlerType: (*LogStreamServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateLogStream", - Handler: _LogStreamService_CreateLogStream_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "build/bazel/remote/logstream/v1/remote_logstream.proto", -} diff --git a/build/bazel/semver/BUILD b/build/bazel/semver/BUILD index 9663c94b..6674e8cd 100644 --- a/build/bazel/semver/BUILD +++ b/build/bazel/semver/BUILD @@ -1,6 +1,9 @@ -package(default_visibility = ["//visibility:public"]) - +load("@rules_go//proto:def.bzl", "go_grpc_library") +load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_proto_grpc_cpp//:defs.bzl", "cpp_grpc_library") + +package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -9,22 +12,71 @@ proto_library( srcs = ["semver.proto"], ) +# golang targets + +go_grpc_library( + name = "semver_go_grpc", + importpath = "github.com/bazelbuild/remote-apis/build/bazel/semver", + protos = [":semver_proto"], +) + alias( + name = "go_default_library", + actual = ":semver_go_grpc", +) + +# C++ targets +cpp_grpc_library( + name = "semver_cpp_grpc", + protos = [":semver_proto"], +) + +# java targets +# TODO: Include/replace with gRPC stub generation targets when feasible +java_proto_library( name = "semver_java_proto", - actual = "//build/bazel/semver/java:semver_java_proto", + deps = [":semver_proto"], ) -alias( - name = "semver_cc_proto", - actual = "//build/bazel/semver/cc:semver_cc_proto", +# TODO: Should the dependencies below be moved/removed in favor of a third-party +# target reference? + +## protobuf proto libraries + +cpp_grpc_library( + name = "status_cpp_grpc", + protos = ["@com_google_googleapis//google/rpc:status_proto"], ) -alias( - name = "semver_go_proto", - actual = "//build/bazel/semver/go:semver_go_proto", +## googleapis proto libraries + +cpp_grpc_library( + name = "annotations_cpp_grpc", + protos = ["@com_google_googleapis//google/api:annotations_proto"], + deps = [ + ":http_cpp_grpc", + ], ) -alias( - name = "go_default_library", - actual = "//build/bazel/semver/go:go_default_library", +cpp_grpc_library( + name = "client_cpp_grpc", + protos = [ + "@com_google_googleapis//google/api:client_proto", + "@com_google_googleapis//google/api:launch_stage_proto", + ], +) + +cpp_grpc_library( + name = "http_cpp_grpc", + protos = ["@com_google_googleapis//google/api:http_proto"], +) + +cpp_grpc_library( + name = "operations_cpp_grpc", + protos = ["@com_google_googleapis//google/longrunning:operations_proto"], + deps = [ + ":annotations_cpp_grpc", + ":client_cpp_grpc", + ":status_cpp_grpc", + ], ) diff --git a/build/bazel/semver/cc/BUILD b/build/bazel/semver/cc/BUILD deleted file mode 100644 index ceda8a5e..00000000 --- a/build/bazel/semver/cc/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//build/bazel/semver:__pkg__"]) - -cc_proto_library( - name = "semver_cc_proto", - deps = ["//build/bazel/semver:semver_proto"], -) diff --git a/build/bazel/semver/go/BUILD b/build/bazel/semver/go/BUILD deleted file mode 100644 index 3023c192..00000000 --- a/build/bazel/semver/go/BUILD +++ /dev/null @@ -1,16 +0,0 @@ -package(default_visibility = ["//build/bazel/semver:__pkg__"]) - -load("@io_bazel_rules_go//go:def.bzl", "go_library") -load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - -go_proto_library( - name = "semver_go_proto", - importpath = "github.com/bazelbuild/remote-apis/build/bazel/semver", - proto = "//build/bazel/semver:semver_proto", -) - -go_library( - name = "go_default_library", - embed = [":semver_go_proto"], - importpath = "github.com/bazelbuild/remote-apis/build/bazel/semver", -) diff --git a/build/bazel/semver/java/BUILD b/build/bazel/semver/java/BUILD deleted file mode 100644 index 7148af3f..00000000 --- a/build/bazel/semver/java/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//build/bazel/semver:__pkg__"]) - -java_proto_library( - name = "semver_java_proto", - deps = ["//build/bazel/semver:semver_proto"], -) diff --git a/build/bazel/semver/semver.pb.go b/build/bazel/semver/semver.pb.go index a33becad..799e6438 100755 --- a/build/bazel/semver/semver.pb.go +++ b/build/bazel/semver/semver.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v3.15.0 +// protoc-gen-go v1.32.0 +// protoc v3.21.7 // source: build/bazel/semver/semver.proto package semver diff --git a/examples/sample_project/BUILD.bazel b/examples/sample_project/BUILD.bazel new file mode 100644 index 00000000..2f8cf3ff --- /dev/null +++ b/examples/sample_project/BUILD.bazel @@ -0,0 +1,11 @@ +load("@gazelle//:def.bzl", "gazelle") + +# gazelle:prefix github.com/bazelbuild/remote-apis/example/sample_project +gazelle( + name = "gazelle", +) + +alias( + name = "go_build_update", + actual = "gazelle", +) diff --git a/examples/sample_project/MODULE.bazel b/examples/sample_project/MODULE.bazel new file mode 100644 index 00000000..c639ce7e --- /dev/null +++ b/examples/sample_project/MODULE.bazel @@ -0,0 +1,58 @@ +module( + name = "bazel_remote_apis_example", +) + +# C++ example dependencies; these are necessary if the project should build +# against generated REAPI C++ code +bazel_dep(name = "rules_cc", version = "0.0.9") + +# Go example dependencies; these are necessary if the project should build +# against generated REAPI Go code +bazel_dep(name = "gazelle", version = "0.35.0") +bazel_dep(name = "rules_go", version = "0.44.2") + +# Java example dependencies; these are necessary if the project should build +# against the generated REAPI Java code +bazel_dep(name = "rules_java", version = "7.3.2") + +bazel_dep(name = "bazel_remote_apis", version = "0.0.0.rpg.version.placeholder") +local_path_override( + module_name = "bazel_remote_apis", + path = "../..", +) + +bazel_dep(name = "toolchains_llvm", version = "0.10.3") +llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") +llvm.toolchain( + # This is a version of LLVM that builds absl and upb successfully with their + # default compile options. + # + # TODO: Update this to the latest version of LLVM possible + llvm_version = "13.0.0", +) +use_repo(llvm, "llvm_toolchain") +register_toolchains("@llvm_toolchain//:all") + +# TODO: Remove this once googleapis is a bzlmod module +bazel_dep(name = "com_google_googleapis", version = "64926d52febbf298cb82a8f472ade4a3969ba922") +archive_override( + module_name = "com_google_googleapis", + integrity = "sha256-nRqTDnZ8k8glOYuPhpLso/41O5qq3t+88fyiKCyF34g=", + patch_strip = 1, + patches = [ + "patches/googleapis_add_bzlmod_support.patch", + ], + strip_prefix = "googleapis-64926d52febbf298cb82a8f472ade4a3969ba922", + urls = [ + "https://github.com/googleapis/googleapis/archive/64926d52febbf298cb82a8f472ade4a3969ba922.zip", + ], +) + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") +use_repo( + go_deps, + "org_golang_google_genproto", + "org_golang_google_genproto_googleapis_api", + "org_golang_google_genproto_googleapis_rpc", +) diff --git a/internal/BUILD b/examples/sample_project/WORKSPACE similarity index 100% rename from internal/BUILD rename to examples/sample_project/WORKSPACE diff --git a/examples/sample_project/cpp/.clang-format b/examples/sample_project/cpp/.clang-format new file mode 100644 index 00000000..f6cb8ad9 --- /dev/null +++ b/examples/sample_project/cpp/.clang-format @@ -0,0 +1 @@ +BasedOnStyle: Google diff --git a/examples/sample_project/cpp/BUILD.bazel b/examples/sample_project/cpp/BUILD.bazel new file mode 100644 index 00000000..1c9d52ad --- /dev/null +++ b/examples/sample_project/cpp/BUILD.bazel @@ -0,0 +1,11 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary") + +cc_binary( + name = "example", + srcs = ["example.cpp"], + deps = [ + "@bazel_remote_apis//build/bazel/remote/asset/v1:remote_asset_cpp_grpc", + "@bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_cpp_grpc", + "@bazel_remote_apis//build/bazel/remote/logstream/v1:remote_logstream_cpp_grpc", + ], +) diff --git a/examples/sample_project/cpp/example.cpp b/examples/sample_project/cpp/example.cpp new file mode 100644 index 00000000..31eb930d --- /dev/null +++ b/examples/sample_project/cpp/example.cpp @@ -0,0 +1,14 @@ +#include + +// #includes for these protos appear to be determined by the protobuf package, +// and not related to BUILD rule path in this repo. +#include "build/bazel/remote/asset/v1/remote_asset.grpc.pb.h" +#include "build/bazel/remote/asset/v1/remote_asset.pb.h" +#include "build/bazel/remote/execution/v2/remote_execution.grpc.pb.h" +#include "build/bazel/remote/execution/v2/remote_execution.pb.h" +#include "build/bazel/remote/logstream/v1/remote_logstream.grpc.pb.h" +#include "build/bazel/remote/logstream/v1/remote_logstream.pb.h" + +int main(int argc, char **argv) { + std::cout << "C++ example compiles and runs!" << std::endl; +} diff --git a/examples/sample_project/go.mod b/examples/sample_project/go.mod new file mode 100644 index 00000000..1e535626 --- /dev/null +++ b/examples/sample_project/go.mod @@ -0,0 +1,21 @@ +module github.com/bazelbuild/remote-apis/examples/sample_project + +go 1.21.6 + +require ( + github.com/bazelbuild/remote-apis v0.0.0-20231221155620-d20ae8b97fd3 + google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 + google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 +) + +require ( + cloud.google.com/go/longrunning v0.5.4 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.6.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/grpc v1.60.1 // indirect + google.golang.org/protobuf v1.32.0 // indirect +) diff --git a/examples/sample_project/go.sum b/examples/sample_project/go.sum new file mode 100644 index 00000000..d23f3d18 --- /dev/null +++ b/examples/sample_project/go.sum @@ -0,0 +1,138 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgGS0GVg= +cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/bazelbuild/remote-apis v0.0.0-20231221155620-d20ae8b97fd3 h1:pYzFHP6FWkA8FjSyx+Kx99zeyVjiRB1epllcRIMDIbc= +github.com/bazelbuild/remote-apis v0.0.0-20231221155620-d20ae8b97fd3/go.mod h1:ry8Y6CkQqCVcYsjPOlLXDX2iRVjOnjogdNwhvHmRcz8= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210505214959-0714010a04ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1 h1:/IWabOtPziuXTEtI1KYCpM6Ss7vaAkeMxk+uXV/xvZs= +google.golang.org/genproto v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1 h1:OPXtXn7fNMaXwO3JvOmF1QyTc00jsSFFz1vXXBOdCDo= +google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/examples/sample_project/go/BUILD.bazel b/examples/sample_project/go/BUILD.bazel new file mode 100644 index 00000000..74d5b4ea --- /dev/null +++ b/examples/sample_project/go/BUILD.bazel @@ -0,0 +1,19 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_lib", + srcs = ["example.go"], + importpath = "github.com/bazelbuild/remote-apis/example/sample_project/go", + visibility = ["//visibility:private"], + deps = [ + "@bazel_remote_apis//build/bazel/remote/asset/v1:go_default_library", + "@bazel_remote_apis//build/bazel/remote/execution/v2:go_default_library", + "@bazel_remote_apis//build/bazel/remote/logstream/v1:go_default_library", + ], +) + +go_binary( + name = "example", + embed = [":go_lib"], + visibility = ["//visibility:public"], +) diff --git a/examples/sample_project/go/example.go b/examples/sample_project/go/example.go new file mode 100644 index 00000000..317859e1 --- /dev/null +++ b/examples/sample_project/go/example.go @@ -0,0 +1,17 @@ +package main + +import ( + "fmt" + + rapb "github.com/bazelbuild/remote-apis/build/bazel/remote/asset/v1" + repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2" + lspb "github.com/bazelbuild/remote-apis/build/bazel/remote/logstream/v1" +) + +func main() { + _ = repb.NewExecutionClient(nil) + _ = rapb.NewPushClient(nil) + _ = lspb.NewLogStreamServiceClient(nil) + + fmt.Println("Go example compiles and runs!") +} diff --git a/examples/sample_project/java/BUILD.bazel b/examples/sample_project/java/BUILD.bazel new file mode 100644 index 00000000..c200d841 --- /dev/null +++ b/examples/sample_project/java/BUILD.bazel @@ -0,0 +1,11 @@ +load("@rules_java//java:defs.bzl", "java_binary") + +java_binary( + name = "Example", + srcs = ["Example.java"], + deps = [ + "@bazel_remote_apis//build/bazel/remote/asset/v1:remote_asset_java_proto", + "@bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_java_proto", + "@bazel_remote_apis//build/bazel/remote/logstream/v1:remote_logstream_java_proto", + ], +) diff --git a/examples/sample_project/java/Example.java b/examples/sample_project/java/Example.java new file mode 100644 index 00000000..9f7402a5 --- /dev/null +++ b/examples/sample_project/java/Example.java @@ -0,0 +1,11 @@ +import build.bazel.remote.asset.v1.RemoteAssetProto; +import build.bazel.remote.execution.v2.RemoteExecutionProto; +import build.bazel.remote.logstream.v1.RemoteLogStreamProto; + +class Example { + public static void main(String []args) { + // TODO: Add instantiation of gRPC stub to prove that codegen works as + // expected + System.out.println("Java example compiles and runs!"); + } +} diff --git a/examples/sample_project/patches b/examples/sample_project/patches new file mode 120000 index 00000000..0bb555db --- /dev/null +++ b/examples/sample_project/patches @@ -0,0 +1 @@ +../../patches \ No newline at end of file diff --git a/go.mod b/go.mod index 2c335960..ee950062 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,19 @@ module github.com/bazelbuild/remote-apis -go 1.12 +go 1.21 require ( - github.com/golang/protobuf v1.5.2 - golang.org/x/net v0.0.0-20210505214959-0714010a04ed // indirect - golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5 // indirect - google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 - google.golang.org/grpc v1.37.0 - google.golang.org/protobuf v1.26.0 + cloud.google.com/go/longrunning v0.5.4 + google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 +) + +require ( + github.com/golang/protobuf v1.5.3 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect ) diff --git a/go.sum b/go.sum index 22389406..b4d08498 100644 --- a/go.sum +++ b/go.sum @@ -1,123 +1,27 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgGS0GVg= +cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210505214959-0714010a04ed h1:V9kAVxLvz1lkufatrpHuUVyJ/5tR3Ms7rk951P4mI98= -golang.org/x/net v0.0.0-20210505214959-0714010a04ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5 h1:cez+MEm4+A0CG7ik1Qzj3bmK9DFoouuLom9lwM+Ijow= -golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2 h1:pl8qT5D+48655f14yDURpIZwSPvMWuuekfAP+gxtjvk= -google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg= +google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac h1:OZkkudMUu9LVQMCoRUbI/1p5VCo9BOrlvkqMvWtqa6s= +google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/hooks/pre-commit b/hooks/pre-commit index ca2e9e85..d23a5660 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -2,9 +2,9 @@ # Precommit hook to rebuild generated go code. Fails if building or copying the # files fails. set -e -bazel build build/bazel/remote/execution/v2:remote_execution_go_proto \ - build/bazel/remote/asset/v1:remote_asset_go_proto \ - build/bazel/remote/logstream/v1:remote_logstream_go_proto +bazel build build/bazel/remote/execution/v2:remote_execution_go_grpc \ + build/bazel/remote/asset/v1:remote_asset_go_grpc \ + build/bazel/remote/logstream/v1:remote_logstream_go_grpc for i in "build/bazel/remote/execution/v2/remote_execution.pb.go" \ "build/bazel/semver/semver.pb.go" \ diff --git a/internal/cc_grpc_library.bzl b/internal/cc_grpc_library.bzl deleted file mode 100644 index a6e8ab0d..00000000 --- a/internal/cc_grpc_library.bzl +++ /dev/null @@ -1,118 +0,0 @@ -"""Rule for running the gRPC C++ code generator. - -This is a simplified and modernised version of the upstream gRPC -`bazel/cc_grpc_library.bzl` file, which as of release v1.45 -(published 2022-03-19) does not support separating the `proto_library` and -`cc_proto_library` targets into separate packages or repositories. - -The following logic should eventually find a home in upstream gRPC, rules_proto, -or rules_cc so that the Bazel Remote APIs repository can be further decoupled -from language-specific concerns. -""" - -load("@com_github_grpc_grpc//bazel:protobuf.bzl", "get_include_protoc_args") - -_EXT_PROTO = ".proto" -_EXT_PROTODEVEL = ".protodevel" -_EXT_GRPC_HDR = ".grpc.pb.h" -_EXT_GRPC_SRC = ".grpc.pb.cc" - -def _drop_proto_ext(name): - if name.endswith(_EXT_PROTO): - return name[:-len(_EXT_PROTO)] - if name.endswith(_EXT_PROTODEVEL): - return name[:-len(_EXT_PROTODEVEL)] - fail("{!r} does not end with {!r} or {!r}".format( - name, - _EXT_PROTO, - _EXT_PROTODEVEL, - )) - -def _proto_srcname(file): - """Return the Protobuf source name for a proto_library source file. - - The source name is what the Protobuf compiler uses to identify a .proto - source file. It is relative to the compiler's `--proto_path` flag. - """ - ws_root = file.owner.workspace_root - if ws_root != "" and file.path.startswith(ws_root): - return file.path[len(ws_root) + 1:] - return file.short_path - -def _cc_grpc_codegen(ctx): - """Run the gRPC C++ code generator to produce sources and headers""" - proto = ctx.attr.proto[ProtoInfo] - proto_srcs = proto.check_deps_sources.to_list() - proto_imports = proto.transitive_imports.to_list() - - protoc_out = ctx.actions.declare_directory(ctx.attr.name + "_protoc_out") - protoc_outputs = [protoc_out] - rule_outputs = [] - - for proto_src in proto_srcs: - srcname = _drop_proto_ext(_proto_srcname(proto_src)) - basename = _drop_proto_ext(proto_src.basename) - - out_hdr = ctx.actions.declare_file(basename + _EXT_GRPC_HDR) - out_src = ctx.actions.declare_file(basename + _EXT_GRPC_SRC) - - protoc_out_prefix = protoc_out.basename - protoc_out_hdr = ctx.actions.declare_file( - "{}/{}".format(protoc_out_prefix, srcname + _EXT_GRPC_HDR), - ) - protoc_out_src = ctx.actions.declare_file( - "{}/{}".format(protoc_out_prefix, srcname + _EXT_GRPC_SRC), - ) - - rule_outputs.extend([out_hdr, out_src]) - protoc_outputs.extend([protoc_out_hdr, protoc_out_src]) - - ctx.actions.expand_template( - template = protoc_out_hdr, - output = out_hdr, - substitutions = {}, - ) - ctx.actions.expand_template( - template = protoc_out_src, - output = out_src, - substitutions = {}, - ) - - plugin = ctx.executable._protoc_gen_grpc - protoc_args = ctx.actions.args() - protoc_args.add("--plugin", "protoc-gen-grpc=" + plugin.path) - protoc_args.add("--grpc_out", protoc_out.path) - - protoc_args.add_all(get_include_protoc_args(proto_imports)) - protoc_args.add_all(proto_srcs, map_each = _proto_srcname) - - ctx.actions.run( - executable = ctx.executable._protoc, - arguments = [protoc_args], - inputs = proto_srcs + proto_imports, - outputs = protoc_outputs, - tools = [plugin], - ) - - return DefaultInfo(files = depset(rule_outputs)) - -cc_grpc_codegen = rule( - implementation = _cc_grpc_codegen, - attrs = { - "proto": attr.label( - mandatory = True, - allow_single_file = True, - providers = [ProtoInfo], - ), - "_protoc_gen_grpc": attr.label( - default = Label("@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin"), - executable = True, - cfg = "host", - ), - "_protoc": attr.label( - default = Label("//external:protocol_compiler"), - executable = True, - cfg = "host", - ), - }, -) diff --git a/remote_apis_deps.bzl b/remote_apis_deps.bzl deleted file mode 100644 index c828a2e1..00000000 --- a/remote_apis_deps.bzl +++ /dev/null @@ -1,55 +0,0 @@ -"""Load dependencies needed to depend on the RE API repo.""" - -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") -load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies") - -def _maybe(repo_rule, name, **kwargs): - if name not in native.existing_rules(): - repo_rule(name = name, **kwargs) - -def remote_apis_go_deps(): - """Load dependencies needed to depend on RE API for Go""" - go_download_sdk(name = "go_sdk", version = "1.20.6") - go_register_toolchains() - - # The version of this repo needs to be in sync with @googleapis - go_repository( - name = "org_golang_google_genproto", - build_extra_args = ["-exclude=vendor"], - build_file_generation = "on", - build_file_proto_mode = "disable_global", - importpath = "google.golang.org/genproto", - sum = "h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y=", - version = "v0.0.0-20221024183307-1bc688fe9f3e", - ) - - go_rules_dependencies() - gazelle_dependencies(go_sdk = "go_sdk") - _maybe( - go_repository, - name = "com_github_golang_protobuf", - importpath = "github.com/golang/protobuf", - tag = "v1.3.2", - ) - _maybe( - go_repository, - name = "org_golang_google_grpc", - build_file_proto_mode = "disable", - importpath = "google.golang.org/grpc", - sum = "h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c=", - version = "v1.37.0", - ) - _maybe( - go_repository, - name = "org_golang_x_net", - importpath = "golang.org/x/net", - sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=", - version = "v0.0.0-20190311183353-d8887717615a", - ) - _maybe( - go_repository, - name = "org_golang_x_text", - importpath = "golang.org/x/text", - sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", - version = "v0.3.0", - ) diff --git a/repository_rules.bzl b/repository_rules.bzl deleted file mode 100644 index b6174ce6..00000000 --- a/repository_rules.bzl +++ /dev/null @@ -1,18 +0,0 @@ -"""Deprecated stub for compatibility with previous releases.""" - -load("//:remote_apis_deps.bzl", "remote_apis_go_deps") - -def switched_rules_by_language( - name, - java = False, - go = False, - cc = False, - rules_override = {}): - """Deprecated stub for compatibility with previous releases.""" - print( - "The switched_rules_by_language macro is deprecated. Consumers of" + - " @bazel_remote_apis should specify per-language dependencies in" + - " their own workspace.", - ) - if go: - remote_apis_go_deps()