• 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    "JAVA_RELEASE_MIN",
22    "POM_VERSION",
23)
24load("//tools:dejetify.bzl", "dejetified_library")
25load(
26    "//tools/maven:maven.bzl",
27    "dagger_pom_file",
28    "gen_maven_artifact",
29)
30
31package(default_visibility = ["//:src"])
32
33# Work around b/70476182 which prevents Kythe from connecting :producers to the .java files it
34# contains.
35SRCS = glob([
36    "*.java",
37    "internal/*.java",
38])
39
40filegroup(
41    name = "android-srcs",
42    srcs = SRCS,
43)
44
45android_library(
46    name = "android",
47    srcs = SRCS,
48    javacopts = JAVA_RELEASE_MIN + DOCLINT_HTML_AND_SYNTAX,
49    plugins = [
50        "//java/dagger/android/internal/proguard:plugin",
51    ],
52    tags = ["maven_coordinates=com.google.dagger:dagger-android:" + POM_VERSION],
53    exports = [
54        "//java/dagger/lint:lint-android-artifact-lib",
55    ],
56    deps = [
57        "//:dagger_with_compiler",
58        "//third_party/java/auto:value",
59        "//third_party/java/error_prone:annotations",
60        "@maven//:androidx_annotation_annotation",
61    ],
62)
63
64gen_maven_artifact(
65    name = "artifact",
66    artifact_coordinates = "com.google.dagger:dagger-android:" + POM_VERSION,
67    artifact_name = "Dagger Android",
68    artifact_target = ":android",
69    artifact_target_maven_deps = [
70        "androidx.annotation:annotation",
71        "com.google.dagger:dagger",
72        "com.google.dagger:dagger-lint-aar",
73    ],
74    javadoc_android_api_level = 34,
75    javadoc_root_packages = [
76        "dagger.android",
77    ],
78    javadoc_srcs = [":android-srcs"],
79    manifest = "AndroidManifest.xml",
80    packaging = "aar",
81)
82
83dejetified_library(
84    name = "dejetified-android",
85    input = ":artifact.aar",
86    output = "android-legacy.aar",
87)
88
89android_library(
90    name = "legacy-deps",
91    tags = ["maven_coordinates=com.google.dagger:dagger-android-legacy:" + POM_VERSION],
92    exports = [
93        "//:dagger_with_compiler",
94        "//third_party/java/auto:value",
95        "//third_party/java/error_prone:annotations",
96        "@maven//:com_android_support_support_annotations",
97    ],
98)
99
100dagger_pom_file(
101    name = "legacy-pom",
102    artifact_id = "dagger-android-legacy",
103    artifact_name = "Dagger Android Legacy",
104    packaging = "aar",
105    targets = [":legacy-deps"],
106)
107