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