• 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
18package(default_visibility = ["//:src"])
19
20load(
21    "//:build_defs.bzl",
22    "DOCLINT_HTML_AND_SYNTAX",
23    "DOCLINT_REFERENCES",
24    "SOURCE_7_TARGET_7",
25)
26load("//tools:maven.bzl", "POM_VERSION", "pom_file")
27
28# Work around b/70476182 which prevents Kythe from connecting :producers to the .java files it
29# contains.
30SRCS = glob([
31    "*.java",
32    "internal/*.java",
33])
34
35filegroup(
36    name = "android-srcs",
37    srcs = SRCS,
38)
39
40android_library(
41    name = "android",
42    srcs = SRCS,
43    javacopts = SOURCE_7_TARGET_7 + DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
44    manifest = "AndroidManifest.xml",
45    proguard_specs = ["proguard.cfg"],
46    tags = ["maven_coordinates=com.google.dagger:dagger-android:" + POM_VERSION],
47    deps = [
48        ":manual-maven-deps",
49        "//:dagger_with_compiler",
50        "@google_bazel_common//third_party/java/auto:value",
51        "@google_bazel_common//third_party/java/error_prone:annotations",
52    ],
53)
54
55# Our pom.xml generator does not have a way to add manual maven deps. This target exports the
56# targets that don't have the necessary maven_coordinates tags.
57android_library(
58    name = "manual-maven-deps",
59    tags = ["maven_coordinates=com.android.support:support-annotations:25.0.0"],
60    visibility = ["//visibility:private"],
61    exports = [
62        "@androidsdk//com.android.support:support-annotations-25.0.0",
63    ],
64)
65
66pom_file(
67    name = "pom",
68    artifact_id = "dagger-android",
69    artifact_name = "Dagger Android",
70    packaging = "aar",
71    targets = [":android"],
72)
73
74# b/37741866 and https://github.com/google/dagger/issues/715
75pom_file(
76    name = "jarimpl-pom",
77    artifact_id = "dagger-android-jarimpl",
78    artifact_name = "Dagger Android",
79    targets = [":android"],
80)
81
82load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
83
84javadoc_library(
85    name = "android-javadoc",
86    srcs = [":android-srcs"],
87    android_api_level = 26,
88    exclude_packages = ["dagger.android.internal"],
89    root_packages = ["dagger.android"],
90    deps = [":android"],
91)
92