-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup BUILD for a no-op output service server.
PiperOrigin-RevId: 678271733 Change-Id: Id541ff8d7c6ed93c4087528e13df29eb024e2738
- Loading branch information
1 parent
0825634
commit c1734aa
Showing
6 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/tools/remote/src/main/cpp/testonly_output_service/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package( | ||
default_applicable_licenses = ["//:license"], | ||
default_visibility = ["//:__subpackages__"], | ||
) | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = glob(["**"]), | ||
visibility = ["//src:__subpackages__"], | ||
) | ||
|
||
cc_binary( | ||
name = "testonly_output_service", | ||
srcs = [ | ||
"bazel_output_service_impl.cc", | ||
"bazel_output_service_impl.h", | ||
"main.cc", | ||
], | ||
deps = [ | ||
"//src/main/protobuf:bazel_output_service_cc_grpc", | ||
"//src/main/protobuf:bazel_output_service_cc_proto", | ||
"//src/main/protobuf:bazel_output_service_rev2_cc_proto", | ||
"//third_party/grpc:grpc++_unsecure", | ||
], | ||
) |
15 changes: 15 additions & 0 deletions
15
src/tools/remote/src/main/cpp/testonly_output_service/bazel_output_service_impl.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2024 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "src/tools/remote/src/main/cpp/testonly_output_service/bazel_output_service_impl.h" |
23 changes: 23 additions & 0 deletions
23
src/tools/remote/src/main/cpp/testonly_output_service/bazel_output_service_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2024 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef BAZEL_SRC_TOOLS_REMOTE_SRC_MAIN_CPP_OUTPUT_SERVICE_BAZEL_OUTPUT_SERVICE_IMPL_H_ | ||
#define BAZEL_SRC_TOOLS_REMOTE_SRC_MAIN_CPP_OUTPUT_SERVICE_BAZEL_OUTPUT_SERVICE_IMPL_H_ | ||
|
||
#include "src/main/protobuf/bazel_output_service.grpc.pb.h" | ||
|
||
class BazelOutputServiceImpl | ||
: public bazel_output_service::BazelOutputService::Service {}; | ||
|
||
#endif // BAZEL_SRC_TOOLS_REMOTE_SRC_MAIN_CPP_OUTPUT_SERVICE_BAZEL_OUTPUT_SERVICE_IMPL_H_ |
40 changes: 40 additions & 0 deletions
40
src/tools/remote/src/main/cpp/testonly_output_service/main.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2024 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
|
||
#include "src/tools/remote/src/main/cpp/testonly_output_service/bazel_output_service_impl.h" | ||
#include "grpcpp/security/server_credentials.h" | ||
#include "grpcpp/server_builder.h" | ||
|
||
static void RunServer() { | ||
BazelOutputServiceImpl service; | ||
|
||
std::string server_address = "0.0.0.0:8080"; | ||
|
||
grpc::ServerBuilder builder; | ||
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); | ||
builder.RegisterService(&service); | ||
std::unique_ptr<grpc::Server> server(builder.BuildAndStart()); | ||
std::cerr << "Server listening on " << server_address << std::endl; | ||
|
||
server->Wait(); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
RunServer(); | ||
return 0; | ||
} |