Rules for generating Android protobuf and gRPC .jar
files and libraries using standard Protocol Buffers and gRPC-Java. Libraries are created with android_library
from rules_android
Rule | Description |
---|---|
android_proto_compile | Generates an Android protobuf .jar artifact |
android_grpc_compile | Generates Android protobuf+gRPC .jar artifacts |
android_proto_library | Generates an Android protobuf library using android_library from rules_android |
android_grpc_library | Generates Android protobuf+gRPC library using android_library from rules_android |
Generates an Android protobuf .jar
artifact
load("@rules_proto_grpc//android:repositories.bzl", rules_proto_grpc_android_repos="android_repos")
rules_proto_grpc_android_repos()
load("@rules_proto_grpc//android:defs.bzl", "android_proto_compile")
android_proto_compile(
name = "person_android_proto",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
)
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
deps |
list<ProtoInfo> |
true | [] |
List of labels that provide a ProtoInfo (such as native.proto_library ) |
verbose |
int |
false | 0 |
The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc |
Generates Android protobuf+gRPC .jar
artifacts
load("@rules_proto_grpc//android:repositories.bzl", rules_proto_grpc_android_repos="android_repos")
rules_proto_grpc_android_repos()
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories(
omit_bazel_skylib = True,
omit_com_google_protobuf = True,
omit_com_google_protobuf_javalite = True,
omit_net_zlib = True,
)
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_compile")
android_grpc_compile(
name = "greeter_android_grpc",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
deps |
list<ProtoInfo> |
true | [] |
List of labels that provide a ProtoInfo (such as native.proto_library ) |
verbose |
int |
false | 0 |
The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc |
Generates an Android protobuf library using android_library
from rules_android
# The set of dependencies loaded here is excessive for android proto alone
# (but simplifies our setup)
load("@rules_proto_grpc//android:repositories.bzl", rules_proto_grpc_android_repos="android_repos")
rules_proto_grpc_android_repos()
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories(
omit_bazel_skylib = True,
omit_com_google_protobuf = True,
omit_com_google_protobuf_javalite = True,
omit_net_zlib = True,
)
load("@build_bazel_rules_android//android:sdk_repository.bzl", "android_sdk_repository")
android_sdk_repository(name = "androidsdk")
load("@rules_proto_grpc//android:defs.bzl", "android_proto_library")
android_proto_library(
name = "person_android_library",
deps = ["@rules_proto_grpc//example/proto:person_proto"],
)
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
deps |
list<ProtoInfo> |
true | [] |
List of labels that provide a ProtoInfo (such as native.proto_library ) |
verbose |
int |
false | 0 |
The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc |
Generates Android protobuf+gRPC library using android_library
from rules_android
load("@rules_proto_grpc//android:repositories.bzl", rules_proto_grpc_android_repos="android_repos")
rules_proto_grpc_android_repos()
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories(
omit_bazel_skylib = True,
omit_com_google_protobuf = True,
omit_com_google_protobuf_javalite = True,
omit_net_zlib = True,
)
load("@build_bazel_rules_android//android:sdk_repository.bzl", "android_sdk_repository")
android_sdk_repository(name = "androidsdk")
load("@rules_proto_grpc//android:defs.bzl", "android_grpc_library")
android_grpc_library(
name = "greeter_android_library",
deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
Name | Type | Mandatory | Default | Description |
---|---|---|---|---|
deps |
list<ProtoInfo> |
true | [] |
List of labels that provide a ProtoInfo (such as native.proto_library ) |
verbose |
int |
false | 0 |
The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc |