xref: /aosp_15_r20/external/dagger2/java/dagger/android/BUILD (revision f585d8a307d0621d6060bd7e80091fdcbf94fe27)
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    "POM_VERSION",
21)
22load("//tools:dejetify.bzl", "dejetified_library")
23load(
24    "//tools:maven.bzl",
25    "gen_maven_artifact",
26    "pom_file",
27)
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    plugins = [
47        "//java/dagger/android/internal/proguard:plugin",
48    ],
49    tags = ["maven_coordinates=com.google.dagger:dagger-android:" + POM_VERSION],
50    exports = [
51        "//java/dagger/lint:lint-android-artifact-lib",
52    ],
53    deps = [
54        "//:dagger_with_compiler",
55        "//third_party/java/auto:value",
56        "//third_party/java/error_prone:annotations",
57        "@maven//:androidx_annotation_annotation",
58    ],
59)
60
61gen_maven_artifact(
62    name = "artifact",
63    artifact_coordinates = "com.google.dagger:dagger-android:" + POM_VERSION,
64    artifact_name = "Dagger Android",
65    artifact_target = ":android",
66    artifact_target_maven_deps = [
67        "androidx.annotation:annotation",
68        "com.google.dagger:dagger",
69        "com.google.dagger:dagger-lint-aar",
70    ],
71    javadoc_android_api_level = 32,
72    javadoc_root_packages = [
73        "dagger.android",
74    ],
75    javadoc_srcs = [":android-srcs"],
76    manifest = "AndroidManifest.xml",
77    packaging = "aar",
78)
79
80dejetified_library(
81    name = "dejetified-android",
82    input = ":artifact.aar",
83    output = "android-legacy.aar",
84)
85
86android_library(
87    name = "legacy-deps",
88    tags = ["maven_coordinates=com.google.dagger:dagger-android-legacy:" + POM_VERSION],
89    exports = [
90        "//:dagger_with_compiler",
91        "//third_party/java/auto:value",
92        "//third_party/java/error_prone:annotations",
93        "@maven//:com_android_support_support_annotations",
94    ],
95)
96
97pom_file(
98    name = "legacy-pom",
99    artifact_id = "dagger-android-legacy",
100    artifact_name = "Dagger Android Legacy",
101    packaging = "aar",
102    targets = [":legacy-deps"],
103)
104