Skip to content

Commit 3dc3a33

Browse files
authored
Protogolf (#83)
* btoken * make it work * rename golf proto
1 parent d54de27 commit 3dc3a33

File tree

22 files changed

+263
-360
lines changed

22 files changed

+263
-360
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ startup --output_base=~/.bazelout
22

33
build --cxxopt='-std=c++17'
44
build --host_cxxopt='-std=c++17'
5+
build --disk_cache=~/bzlcache
56

67
test --cxxopt='-std=c++17'
78
test --host_cxxopt='-std=c++17'

.circleci/config.yml

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ jobs:
3535
- run:
3636
name: Run Go Tests
3737
command: bazel test //go/...
38-
- run:
39-
name: Run Rust Tests
40-
command: bazel test //rust/...
4138
- run:
4239
name: Run Cpp Tests
4340
command: bazel test //cpp/...

.clwb/.bazelproject

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
directories:
22
cpp
3+
protos
34

45
# Automatically includes all relevant targets under the 'directories' above
56
derive_targets_from_directories: true

WORKSPACE

+30-38
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
workspace(name = "moon_base")
22

3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
34
load("//bazel:http_archives.bzl", "register_http_archive_dependencies")
45

56
register_http_archive_dependencies()
67

8+
#######################################################################################
9+
##################################################
10+
##################
11+
#
12+
# load protos first to get pre-compiled version
13+
#
14+
#############################################################
15+
#######################################################################################
16+
17+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
18+
19+
rules_proto_dependencies()
20+
21+
rules_proto_toolchains()
22+
723
########################################################################################
824
##################################################
925
###################
@@ -23,47 +39,41 @@ go_register_toolchains(version = "1.20.4")
2339
##################################################
2440
###################
2541
#
26-
# cpp stuff
42+
# grpc proto stuff
2743
#
2844
##############################################################
2945
########################################################################################
3046

31-
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
32-
33-
grpc_deps()
34-
35-
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
47+
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
3648

37-
grpc_extra_deps()
49+
rules_proto_grpc_toolchains()
3850

39-
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
51+
rules_proto_grpc_repos()
4052

41-
hedron_compile_commands_setup()
53+
#load("@rules_proto_grpc//cpp:repositories.bzl", "cpp_repos")
54+
#
55+
#cpp_repos()
4256

4357
########################################################################################
4458
##################################################
4559
###################
4660
#
47-
# proto stuff
61+
# cpp stuff
4862
#
4963
##############################################################
5064
########################################################################################
5165

52-
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
53-
54-
rules_proto_grpc_toolchains()
55-
56-
rules_proto_grpc_repos()
66+
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
5767

58-
load("@rules_proto_grpc//cpp:repositories.bzl", "cpp_repos")
68+
grpc_deps()
5969

60-
cpp_repos()
70+
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
6171

62-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
72+
grpc_extra_deps()
6373

64-
rules_proto_dependencies()
74+
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
6575

66-
rules_proto_toolchains()
76+
hedron_compile_commands_setup()
6777

6878
########################################################################################
6979
##################################################
@@ -173,21 +183,3 @@ load("@io_bazel_rules_scala//scala/scalafmt:scalafmt_repositories.bzl", "scalafm
173183
scalafmt_default_config()
174184

175185
scalafmt_repositories()
176-
177-
#############################################################
178-
#############
179-
## Rust Stuff
180-
###
181-
##############
182-
#############################################################
183-
184-
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
185-
186-
rules_rust_dependencies()
187-
188-
rust_register_toolchains(
189-
edition = "2021",
190-
versions = [
191-
"1.71.0",
192-
],
193-
)

bazel/http_archives.bzl

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22

33
def register_http_archive_dependencies():
4+
http_archive(
5+
name = "com_github_bazelbuild_buildtools",
6+
sha256 = "977a0bd4593c8d4c8f45e056d181c35e48aa01ad4f8090bdb84f78dca42f47dc",
7+
strip_prefix = "buildtools-6.1.2",
8+
urls = [
9+
"https://github.com/bazelbuild/buildtools/archive/refs/tags/v6.1.2.tar.gz",
10+
],
11+
)
12+
13+
http_archive(
14+
name = "rules_proto",
15+
sha256 = "bc12122a5ae4b517fa423ea03a8d82ea6352d5127ea48cb54bc324e8ab78493c",
16+
strip_prefix = "rules_proto-af6481970a34554c6942d993e194a9aed7987780",
17+
urls = [
18+
"https://github.com/bazelbuild/rules_proto/archive/af6481970a34554c6942d993e194a9aed7987780.tar.gz",
19+
],
20+
)
21+
422
http_archive(
523
name = "com_github_grpc_grpc",
624
patch_args = ["-p1"],
725
patches = ["//bazel/patches:grpc_extra_deps.patch"],
8-
sha256 = "d8c3180df613759e705aabde77798a463b8d2dad08f182cf4cbdc6d8c9d0ebdd",
9-
strip_prefix = "grpc-fd843629c89a22fc920fbbda8bcd79aa3b86add4",
26+
sha256 = "64c3756f8f4ac3a876655f6a04f4d9f6858c77612d79200d0528ad923d5550c7",
27+
strip_prefix = "grpc-8871dab19b4ab5389e28474d25cfeea61283265c",
1028
urls = [
11-
"https://github.com/grpc/grpc/archive/fd843629c89a22fc920fbbda8bcd79aa3b86add4.tar.gz",
29+
"https://github.com/grpc/grpc/archive/8871dab19b4ab5389e28474d25cfeea61283265c.tar.gz",
1230
],
1331
)
1432

@@ -86,21 +104,6 @@ def register_http_archive_dependencies():
86104
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip" % RULES_SCALA_VERSION,
87105
)
88106

89-
http_archive(
90-
name = "rules_rust",
91-
sha256 = "50ec4b84a7ec5370f5882d52f4a1e6b8a75de2f8dcc0a4403747b69b2c4ef5b1",
92-
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.23.0/rules_rust-v0.23.0.tar.gz"],
93-
)
94-
95-
http_archive(
96-
name = "com_github_bazelbuild_buildtools",
97-
sha256 = "977a0bd4593c8d4c8f45e056d181c35e48aa01ad4f8090bdb84f78dca42f47dc",
98-
strip_prefix = "buildtools-6.1.2",
99-
urls = [
100-
"https://github.com/bazelbuild/buildtools/archive/refs/tags/v6.1.2.tar.gz",
101-
],
102-
)
103-
104107
http_archive(
105108
name = "hedron_compile_commands",
106109
sha256 = "3cd0e49f0f4a6d406c1d74b53b7616f5e24f5fd319eafc1bf8eee6e14124d115",

cpp/example_service/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cc_binary(
33
srcs = ["example_service.cc"],
44
visibility = ["//visibility:public"],
55
deps = [
6-
"//protos:example_service_proto",
6+
"//protos/example_cc_grpc:example_service_proto",
77
"@com_github_grpc_grpc//:grpc++",
88
"@com_github_grpc_grpc//:grpc++_reflection",
99
"@com_google_absl//absl/flags:flag",

cpp/example_service/example_service.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <string>
88

99
#include "absl/strings/str_format.h"
10-
#include "protos/example_service.grpc.pb.h"
10+
#include "protos/example_cc_grpc/example_service.grpc.pb.h"
1111

1212
using example_service::Greeter;
1313
using example_service::HelloReply;

cpp/golf_service/BUILD.bazel

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ cc_test(
2020

2121
cc_library(
2222
name = "api",
23-
srcs = ["api.cc"],
2423
hdrs = ["api.h"],
2524
deps = [
2625
"//cpp/cards/golf",
@@ -38,8 +37,10 @@ cc_binary(
3837
":api",
3938
":game_state_mapper",
4039
"//cpp/cards/golf",
40+
"//protos/golf_ws:golf_cc_proto",
4141
"@com_google_absl//absl/status:statusor",
4242
"@com_google_absl//absl/strings",
43+
"@com_google_protobuf//:protobuf",
4344
"@mongoose_cc//:mongoose",
4445
],
4546
)

0 commit comments

Comments
 (0)