• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# A framework supporting Dagger-injected gRPC servers.
2
3load("@rules_java//java:defs.bzl", "java_library")
4load(
5    "//:build_defs.bzl",
6    "DOCLINT_HTML_AND_SYNTAX",
7    "DOCLINT_REFERENCES",
8    "POM_VERSION",
9)
10load("//tools:maven.bzl", "pom_file")
11load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
12
13package(default_visibility = ["//:src"])
14
15ANNOTATIONS_SRCS = [
16    "CallScoped.java",
17    "ForGrpcService.java",
18    "GrpcService.java",
19]
20
21java_library(
22    name = "annotations",
23    srcs = ANNOTATIONS_SRCS,
24    javacopts = DOCLINT_HTML_AND_SYNTAX,
25    tags = ["maven_coordinates=com.google.dagger:dagger-grpc-server-annotations:" + POM_VERSION],
26    deps = [
27        "@google_bazel_common//third_party/java/jsr330_inject",
28    ],
29)
30
31# TODO(dpb): Split out the grpc:inprocess and grpc:netty deps into separate libraries.
32java_library(
33    name = "server",
34    srcs = glob(
35        ["*.java"],
36        exclude = ANNOTATIONS_SRCS,
37    ),
38    exported_plugins = ["//java/dagger/grpc/server/processor:plugin"],
39    javacopts = DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
40    tags = ["maven_coordinates=com.google.dagger:dagger-grpc-server:" + POM_VERSION],
41    exports = [":annotations"],
42    deps = [
43        "//:dagger_with_compiler",
44        "//java/dagger/internal/guava:base",
45        "//java/dagger/internal/guava:collect",
46        "@google_bazel_common//third_party/java/auto:value",
47        "@google_bazel_common//third_party/java/grpc:context",
48        "@google_bazel_common//third_party/java/grpc:core",
49        "@google_bazel_common//third_party/java/grpc:netty",
50        "@google_bazel_common//third_party/java/grpc:protobuf",
51        "@google_bazel_common//third_party/java/jsr330_inject",
52        "@google_bazel_common//third_party/java/protobuf",
53    ],
54)
55
56pom_file(
57    name = "annotations-pom",
58    artifact_id = "dagger-grpc-server-annotations",
59    artifact_name = "Dagger gRPC Server Annotations",
60    targets = [":annotations"],
61)
62
63pom_file(
64    name = "server-pom",
65    artifact_id = "dagger-grpc-server",
66    artifact_name = "Dagger gRPC Server",
67    targets = [":server"],
68)
69
70filegroup(
71    name = "javadoc-srcs",
72    srcs = glob(["*.java"]),
73)
74
75javadoc_library(
76    name = "javadoc",
77    srcs = [":javadoc-srcs"],
78    root_packages = ["dagger.grpc.server"],
79    deps = [
80        ":annotations",
81        ":server",
82    ],
83)
84