• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2017 The Dagger Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Description:
16#   Public Dagger API for Android
17
18load(
19    "//:build_defs.bzl",
20    "DOCLINT_HTML_AND_SYNTAX",
21    "DOCLINT_REFERENCES",
22    "POM_VERSION",
23    "SOURCE_7_TARGET_7",
24)
25load("//tools:dejetify.bzl", "dejetified_library")
26load("//tools:maven.bzl", "pom_file")
27load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
28
29package(default_visibility = ["//:src"])
30
31# Work around b/70476182 which prevents Kythe from connecting :producers to the .java files it
32# contains.
33SRCS = glob([
34    "*.java",
35    "internal/*.java",
36])
37
38filegroup(
39    name = "android-srcs",
40    srcs = SRCS,
41)
42
43android_library(
44    name = "android",
45    srcs = SRCS,
46    javacopts = SOURCE_7_TARGET_7 + DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
47    manifest = "AndroidManifest.xml",
48    plugins = [
49        "//java/dagger/android/internal/proguard:plugin",
50    ],
51    tags = ["maven_coordinates=com.google.dagger:dagger-android:" + POM_VERSION],
52    exports = [
53        "//java/dagger/lint:lint-android-artifact-lib",
54    ],
55    deps = [
56        "//:dagger_with_compiler",
57        "//third_party/java/auto:value",
58        "//third_party/java/error_prone:annotations",
59        "@maven//:androidx_annotation_annotation",
60    ],
61)
62
63pom_file(
64    name = "pom",
65    artifact_id = "dagger-android",
66    artifact_name = "Dagger Android",
67    packaging = "aar",
68    targets = [":android"],
69)
70
71dejetified_library(
72    name = "dejetified-android",
73    input = ":android.aar",
74    output = "android-legacy.aar",
75)
76
77android_library(
78    name = "legacy-deps",
79    tags = ["maven_coordinates=com.google.dagger:dagger-android-legacy:" + POM_VERSION],
80    exports = [
81        "//:dagger_with_compiler",
82        "//third_party/java/auto:value",
83        "//third_party/java/error_prone:annotations",
84        "@maven//:com_android_support_support_annotations",
85    ],
86)
87
88pom_file(
89    name = "legacy-pom",
90    artifact_id = "dagger-android-legacy",
91    artifact_name = "Dagger Android Legacy",
92    packaging = "aar",
93    targets = [":legacy-deps"],
94)
95
96javadoc_library(
97    name = "android-javadoc",
98    srcs = [":android-srcs"],
99    android_api_level = 30,
100    exclude_packages = ["dagger.android.internal"],
101    root_packages = ["dagger.android"],
102    deps = [":android"],
103)
104