xref: /aosp_15_r20/external/dagger2/java/dagger/android/support/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 that interacts with the Android support libraries
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
31filegroup(
32    name = "support-srcs",
33    srcs = glob(["*.java"]),
34)
35
36android_library(
37    name = "support",
38    srcs = glob(["*.java"]),
39    tags = ["maven_coordinates=com.google.dagger:dagger-android-support:" + POM_VERSION],
40    deps = [
41        "//:dagger_with_compiler",
42        "//java/dagger/android",
43        "//third_party/java/error_prone:annotations",
44        "@maven//:androidx_activity_activity",
45        "@maven//:androidx_annotation_annotation",
46        "@maven//:androidx_appcompat_appcompat",
47        "@maven//:androidx_fragment_fragment",
48        "@maven//:androidx_lifecycle_lifecycle_common",
49        "@maven//:androidx_lifecycle_lifecycle_viewmodel",
50        "@maven//:androidx_lifecycle_lifecycle_viewmodel_savedstate",
51    ],
52)
53
54gen_maven_artifact(
55    name = "artifact",
56    artifact_coordinates = "com.google.dagger:dagger-android-support:" + POM_VERSION,
57    artifact_name = "Dagger Android Support",
58    artifact_target = ":support",
59    artifact_target_maven_deps = [
60        "androidx.activity:activity",
61        "androidx.annotation:annotation",
62        "androidx.appcompat:appcompat",
63        "androidx.fragment:fragment",
64        "androidx.lifecycle:lifecycle-common",
65        "androidx.lifecycle:lifecycle-viewmodel",
66        "androidx.lifecycle:lifecycle-viewmodel-savedstate",
67        "com.google.dagger:dagger",
68        "com.google.dagger:dagger-android",
69    ],
70    javadoc_android_api_level = 32,
71    javadoc_root_packages = [
72        "dagger.android.support",
73    ],
74    javadoc_srcs = [":support-srcs"],
75    manifest = "AndroidManifest.xml",
76    packaging = "aar",
77)
78
79dejetified_library(
80    name = "dejetified-support",
81    input = ":artifact.aar",
82    output = "support-legacy.aar",
83)
84
85android_library(
86    name = "legacy-deps",
87    tags = ["maven_coordinates=com.google.dagger:dagger-android-support-legacy:" + POM_VERSION],
88    exports = [
89        "//:dagger_with_compiler",
90        "//java/dagger/android:legacy-deps",
91        "//third_party/java/error_prone:annotations",
92        "@maven//:com_android_support_appcompat_v7",
93        "@maven//:com_android_support_support_annotations",
94        "@maven//:com_android_support_support_fragment",
95    ],
96)
97
98pom_file(
99    name = "legacy-pom",
100    artifact_id = "dagger-android-support-legacy",
101    artifact_name = "Dagger Android Legacy Support",
102    packaging = "aar",
103    targets = [":legacy-deps"],
104)
105