Skip to content

Commit 2250918

Browse files
authored
Merge pull request #140 from rules-proto-grpc/dev
4.0.0 Release
2 parents 126a1a0 + 98a3974 commit 2250918

File tree

323 files changed

+9852
-6553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+9852
-6553
lines changed

.bazelci/presubmit.yml

Lines changed: 438 additions & 61 deletions
Large diffs are not rendered by default.

.github/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ lang-cpp: ['cpp/**/*', 'example/cpp/**/*', 'tools/rulegen/cpp.go']
77
lang-csharp: ['csharp/**/*', 'example/csharp/**/*', 'tools/rulegen/csharp.go']
88
lang-d: ['d/**/*', 'example/d/**/*', 'tools/rulegen/d.go']
99
lang-doc: ['doc/**/*', 'example/doc/**/*', 'tools/rulegen/doc.go']
10+
lang-fsharp: ['fsharp/**/*', 'example/fsharp/**/*', 'tools/rulegen/fsharp.go']
1011
lang-go: ['go/**/*', 'example/go/**/*', 'tools/rulegen/go.go']
1112
lang-grpc-gateway: ['grpc-gateway/**/*', 'example/grpc-gateway/**/*', 'tools/rulegen/grpc_gateway.go']
1213
lang-java: ['java/**/*', 'example/java/**/*', 'tools/rulegen/java.go']

CNAME

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rules-proto-grpc.aliddell.com
1+
rules-proto-grpc.com

Makefile

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -53,59 +53,19 @@ pip_compile:
5353
.PHONY: csharp_regenerate_packages
5454
csharp_regenerate_packages:
5555
./csharp/nuget/regenerate_packages.sh
56+
bazel run //tools:buildifier
57+
58+
59+
# Run F# package regeneration
60+
.PHONY: fsharp_regenerate_packages
61+
fsharp_regenerate_packages:
62+
./fsharp/nuget/regenerate_packages.sh
63+
bazel run //tools:buildifier
5664

5765

5866
# Run all language specific updates
5967
.PHONY: all_updates
60-
all_updates: rust_raze yarn_upgrade ruby_bundle_upgrade pip_compile csharp_regenerate_packages
61-
62-
63-
# A collection of targets that build routeguide clients
64-
.PHONY: clients
65-
clients:
66-
bazel build \
67-
//cpp/example/routeguide:client \
68-
//go/example/routeguide/client \
69-
//java/example/routeguide:client \
70-
//python/example/routeguide:client \
71-
//scala/example/routeguide:client \
72-
73-
# A collection of targets that build routeguide servers
74-
.PHONY: servers
75-
servers:
76-
bazel build \
77-
//cpp/example/routeguide:server \
78-
//go/example/routeguide/server \
79-
//java/example/routeguide:server \
80-
//python/example/routeguide:server \
81-
//scala/example/routeguide:server \
82-
83-
84-
# A collection of test targets
85-
.PHONY: tests
86-
tests:
87-
bazel test \
88-
//cpp/example/routeguide/... \
89-
//java/example/routeguide/... \
90-
//go/example/routeguide/... \
91-
92-
.PHONY: pending_clients
93-
pending_clients:
94-
bazel build \
95-
//android/example/routeguide:client \
96-
//js/example/routeguide:client \
97-
//ruby/example/routeguide:client \
98-
//rust/example/routeguide:client
99-
100-
.PHONY: pending_servers
101-
pending_servers:
102-
bazel build \
103-
//js/example/routeguide:server \
104-
//ruby/example/routeguide:server \
105-
//rust/example/routeguide:server
106-
107-
.PHONY: all
108-
all: clients servers tests
68+
all_updates: rust_raze yarn_upgrade ruby_bundle_upgrade pip_compile csharp_regenerate_packages fsharp_regenerate_packages
10969

11070

11171
# Pull in auto-generated examples makefile

README.md

Lines changed: 95 additions & 85 deletions
Large diffs are not rendered by default.

WORKSPACE

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
7373
go_rules_dependencies()
7474

7575
go_register_toolchains(
76-
version = "1.15.8",
76+
version = "1.17.1",
7777
)
7878

7979
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
@@ -96,7 +96,7 @@ load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
9696
grpc_deps()
9797

9898
#
99-
# C#
99+
# C#/F#
100100
#
101101
load("//csharp:repositories.bzl", "csharp_repos")
102102

@@ -116,9 +116,13 @@ dotnet_register_toolchains()
116116

117117
dotnet_repositories_nugets()
118118

119-
load("@rules_proto_grpc//csharp/nuget:nuget.bzl", "nuget_rules_proto_grpc_packages")
119+
load("@rules_proto_grpc//csharp/nuget:nuget.bzl", nuget_rules_proto_grpc_packages_csharp = "nuget_rules_proto_grpc_packages")
120120

121-
nuget_rules_proto_grpc_packages()
121+
nuget_rules_proto_grpc_packages_csharp()
122+
123+
load("@rules_proto_grpc//fsharp/nuget:nuget.bzl", nuget_rules_proto_grpc_packages_fsharp = "nuget_rules_proto_grpc_packages")
124+
125+
nuget_rules_proto_grpc_packages_fsharp()
122126

123127
#
124128
# D
@@ -220,14 +224,15 @@ load("@bazelruby_rules_ruby//ruby:deps.bzl", "rules_ruby_dependencies", "rules_r
220224

221225
rules_ruby_dependencies()
222226

223-
rules_ruby_select_sdk(version = "2.7.1")
227+
rules_ruby_select_sdk(version = "3.0.1")
224228

225229
load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle")
226230

227231
ruby_bundle(
228232
name = "rules_proto_grpc_bundle",
229233
gemfile = "@rules_proto_grpc//ruby:Gemfile",
230234
gemfile_lock = "@rules_proto_grpc//ruby:Gemfile.lock",
235+
includes = {"grpc": ["etc"]},
231236
)
232237

233238
#
@@ -244,7 +249,7 @@ rust_repositories()
244249
#
245250
# Scala
246251
#
247-
load("//scala:repositories.bzl", "scala_repos")
252+
load("//scala:repositories.bzl", "MAVEN_ARTIFACTS", "scala_repos")
248253

249254
scala_repos()
250255

@@ -260,41 +265,12 @@ load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
260265

261266
scala_register_toolchains()
262267

263-
load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories")
264-
265-
scala_proto_repositories()
266-
267-
#
268-
# Scala routeguide
269-
#
270-
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
271-
272-
jvm_maven_import_external(
273-
name = "com_thesamet_scalapb_scalapb_json4s",
274-
artifact = "com.thesamet.scalapb:scalapb-json4s_2.12:0.7.1",
275-
artifact_sha256 = "6c8771714329464e03104b6851bfdc3e2e4967276e1a9bd2c87c3b5a6d9c53c7",
276-
server_urls = ["https://repo.maven.apache.org/maven2"],
277-
)
278-
279-
jvm_maven_import_external(
280-
name = "org_json4s_json4s_jackson_2_12",
281-
artifact = "org.json4s:json4s-jackson_2.12:3.6.1",
282-
artifact_sha256 = "83b854a39e69f022ad3d7dd3da664623252dc822ed4ed1117304f39115c88043",
283-
server_urls = ["https://repo.maven.apache.org/maven2"],
284-
)
285-
286-
jvm_maven_import_external(
287-
name = "org_json4s_json4s_core_2_12",
288-
artifact = "org.json4s:json4s-core_2.12:3.6.1",
289-
artifact_sha256 = "e0f481509429a24e295b30ba64f567bad95e8d978d0882ec74e6dab291fcdac0",
290-
server_urls = ["https://repo.maven.apache.org/maven2"],
291-
)
292-
293-
jvm_maven_import_external(
294-
name = "org_json4s_json4s_ast_2_12",
295-
artifact = "org.json4s:json4s-ast_2.12:3.6.1",
296-
artifact_sha256 = "39c7de601df28e32eb0c4e3d684ec65bbf2e59af83c6088cda12688d796f7746",
297-
server_urls = ["https://repo.maven.apache.org/maven2"],
268+
maven_install(
269+
name = "rules_proto_grpc_scala_maven",
270+
artifacts = MAVEN_ARTIFACTS,
271+
repositories = [
272+
"https://repo1.maven.org/maven2",
273+
],
298274
)
299275

300276
#

android/android_grpc_compile.bzl

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,17 @@
11
"""Generated definition of android_grpc_compile."""
22

3-
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
43
load(
54
"//:defs.bzl",
6-
"ProtoLibraryAspectNodeInfo",
75
"ProtoPluginInfo",
8-
"proto_compile_aspect_attrs",
9-
"proto_compile_aspect_impl",
106
"proto_compile_attrs",
117
"proto_compile_impl",
128
)
139

14-
# Create aspect for android_grpc_compile
15-
android_grpc_compile_aspect = aspect(
16-
implementation = proto_compile_aspect_impl,
17-
provides = [ProtoLibraryAspectNodeInfo],
18-
attr_aspects = ["deps"],
19-
attrs = dict(
20-
proto_compile_aspect_attrs,
21-
_plugins = attr.label_list(
22-
doc = "List of protoc plugins to apply",
23-
providers = [ProtoPluginInfo],
24-
default = [
25-
Label("//android:javalite_plugin"),
26-
Label("//android:grpc_javalite_plugin"),
27-
],
28-
),
29-
_prefix = attr.string(
30-
doc = "String used to disambiguate aspects when generating outputs",
31-
default = "android_grpc_compile_aspect",
32-
),
33-
),
34-
toolchains = [str(Label("//protobuf:toolchain_type"))],
35-
)
36-
3710
# Create compile rule
38-
_rule = rule(
11+
android_grpc_compile = rule(
3912
implementation = proto_compile_impl,
4013
attrs = dict(
4114
proto_compile_attrs,
42-
protos = attr.label_list(
43-
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
44-
providers = [ProtoInfo],
45-
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
46-
),
47-
deps = attr.label_list(
48-
mandatory = False,
49-
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
50-
aspects = [android_grpc_compile_aspect],
51-
doc = "DEPRECATED: Use protos attr",
52-
),
5315
_plugins = attr.label_list(
5416
providers = [ProtoPluginInfo],
5517
default = [
@@ -61,10 +23,3 @@ _rule = rule(
6123
),
6224
toolchains = [str(Label("//protobuf:toolchain_type"))],
6325
)
64-
65-
# Create macro for converting attrs and passing to compile
66-
def android_grpc_compile(**kwargs):
67-
_rule(
68-
verbose_string = "{}".format(kwargs.get("verbose", 0)),
69-
**kwargs
70-
)

android/android_grpc_library.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def android_grpc_library(name, **kwargs):
1212
**{
1313
k: v
1414
for (k, v) in kwargs.items()
15-
if k in ["protos" if "protos" in kwargs else "deps"] + proto_compile_attrs.keys()
15+
if k in proto_compile_attrs.keys()
1616
} # Forward args
1717
)
1818

1919
# Create android library
2020
android_library(
2121
name = name,
2222
srcs = [name_pb],
23-
deps = GRPC_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
23+
deps = GRPC_DEPS + kwargs.get("deps", []),
2424
exports = GRPC_DEPS + kwargs.get("exports", []),
2525
visibility = kwargs.get("visibility"),
2626
tags = kwargs.get("tags"),

android/android_proto_compile.bzl

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,17 @@
11
"""Generated definition of android_proto_compile."""
22

3-
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
43
load(
54
"//:defs.bzl",
6-
"ProtoLibraryAspectNodeInfo",
75
"ProtoPluginInfo",
8-
"proto_compile_aspect_attrs",
9-
"proto_compile_aspect_impl",
106
"proto_compile_attrs",
117
"proto_compile_impl",
128
)
139

14-
# Create aspect for android_proto_compile
15-
android_proto_compile_aspect = aspect(
16-
implementation = proto_compile_aspect_impl,
17-
provides = [ProtoLibraryAspectNodeInfo],
18-
attr_aspects = ["deps"],
19-
attrs = dict(
20-
proto_compile_aspect_attrs,
21-
_plugins = attr.label_list(
22-
doc = "List of protoc plugins to apply",
23-
providers = [ProtoPluginInfo],
24-
default = [
25-
Label("//android:javalite_plugin"),
26-
],
27-
),
28-
_prefix = attr.string(
29-
doc = "String used to disambiguate aspects when generating outputs",
30-
default = "android_proto_compile_aspect",
31-
),
32-
),
33-
toolchains = [str(Label("//protobuf:toolchain_type"))],
34-
)
35-
3610
# Create compile rule
37-
_rule = rule(
11+
android_proto_compile = rule(
3812
implementation = proto_compile_impl,
3913
attrs = dict(
4014
proto_compile_attrs,
41-
protos = attr.label_list(
42-
mandatory = False, # TODO: set to true in 4.0.0 when deps removed below
43-
providers = [ProtoInfo],
44-
doc = "List of labels that provide the ProtoInfo provider (such as proto_library from rules_proto)",
45-
),
46-
deps = attr.label_list(
47-
mandatory = False,
48-
providers = [ProtoInfo, ProtoLibraryAspectNodeInfo],
49-
aspects = [android_proto_compile_aspect],
50-
doc = "DEPRECATED: Use protos attr",
51-
),
5215
_plugins = attr.label_list(
5316
providers = [ProtoPluginInfo],
5417
default = [
@@ -59,10 +22,3 @@ _rule = rule(
5922
),
6023
toolchains = [str(Label("//protobuf:toolchain_type"))],
6124
)
62-
63-
# Create macro for converting attrs and passing to compile
64-
def android_proto_compile(**kwargs):
65-
_rule(
66-
verbose_string = "{}".format(kwargs.get("verbose", 0)),
67-
**kwargs
68-
)

android/android_proto_library.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def android_proto_library(name, **kwargs):
1212
**{
1313
k: v
1414
for (k, v) in kwargs.items()
15-
if k in ["protos" if "protos" in kwargs else "deps"] + proto_compile_attrs.keys()
15+
if k in proto_compile_attrs.keys()
1616
} # Forward args
1717
)
1818

1919
# Create android library
2020
android_library(
2121
name = name,
2222
srcs = [name_pb],
23-
deps = PROTO_DEPS + (kwargs.get("deps", []) if "protos" in kwargs else []),
23+
deps = PROTO_DEPS + kwargs.get("deps", []),
2424
exports = PROTO_DEPS + kwargs.get("exports", []),
2525
visibility = kwargs.get("visibility"),
2626
tags = kwargs.get("tags"),

buf/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ proto_plugin(
55
quirks = ["QUIRK_DIRECT_MODE"],
66
separate_options_flag = True,
77
tool = select({
8-
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_breaking_darwin//file",
9-
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_breaking_linux//file",
8+
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_breaking_darwin_x86_64//file",
9+
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_breaking_linux_x86_64//file",
1010
}),
1111
visibility = ["//visibility:public"],
1212
)
@@ -16,8 +16,8 @@ proto_plugin(
1616
quirks = ["QUIRK_DIRECT_MODE"],
1717
separate_options_flag = True,
1818
tool = select({
19-
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_lint_darwin//file",
20-
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_lint_linux//file",
19+
"@bazel_tools//src/conditions:darwin_x86_64": "@protoc_gen_buf_lint_darwin_x86_64//file",
20+
"@bazel_tools//src/conditions:linux_x86_64": "@protoc_gen_buf_lint_linux_x86_64//file",
2121
}),
2222
visibility = ["//visibility:public"],
2323
)

0 commit comments

Comments
 (0)