tree: 4946e1226499cfdc6a53797155724a6dcc752559
  1. example/
  2. android_grpc_compile.bzl
  3. android_grpc_library.bzl
  4. android_proto_compile.bzl
  5. android_proto_library.bzl
  6. BUILD.bazel
  7. defs.bzl
  8. deps.bzl
  9. README.md
  10. repositories.bzl
android/README.md

Android rules

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

RuleDescription
android_proto_compileGenerates an Android protobuf .jar artifact
android_grpc_compileGenerates Android protobuf+gRPC .jar artifacts
android_proto_libraryGenerates an Android protobuf library using android_library from rules_android
android_grpc_libraryGenerates Android protobuf+gRPC library using android_library from rules_android

android_proto_compile

Generates an Android protobuf .jar artifact

WORKSPACE

load("@rules_proto_grpc//android:repositories.bzl", rules_proto_grpc_android_repos="android_repos")

rules_proto_grpc_android_repos()

BUILD.bazel

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"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The 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

android_grpc_compile

Generates Android protobuf+gRPC .jar artifacts

WORKSPACE

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()

BUILD.bazel

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"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The 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

android_proto_library

Generates an Android protobuf library using android_library from rules_android

WORKSPACE

# 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()

load("@build_bazel_rules_android//android:sdk_repository.bzl", "android_sdk_repository")

android_sdk_repository(name = "androidsdk")

BUILD.bazel

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"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The 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

android_grpc_library

Generates Android protobuf+gRPC library using android_library from rules_android

WORKSPACE

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()

load("@build_bazel_rules_android//android:sdk_repository.bzl", "android_sdk_repository")

android_sdk_repository(name = "androidsdk")

BUILD.bazel

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"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The 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