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) 25load("//tools:maven.bzl", "POM_VERSION", "pom_file") 26 27filegroup( 28 name = "srcs", 29 srcs = glob(["*.java"]), 30) 31 32java_library( 33 name = "processor", 34 srcs = [":srcs"], 35 javacopts = DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES, 36 tags = ["maven_coordinates=com.google.dagger:dagger-android-processor:" + POM_VERSION], 37 deps = [ 38 "@google_bazel_common//third_party/java/guava", 39 "@google_bazel_common//third_party/java/auto:service", 40 "@google_bazel_common//third_party/java/auto:value", 41 "@google_bazel_common//third_party/java/auto:common", 42 "@google_bazel_common//third_party/java/incap", 43 "@google_bazel_common//third_party/java/javapoet", 44 "@google_bazel_common//third_party/java/google_java_format", 45 "//java/dagger:core", 46 "//java/dagger/model", 47 "//java/dagger/spi", 48 # https://github.com/bazelbuild/bazel/issues/2517 49 ":dagger-android-jar", 50 ], 51) 52 53# https://github.com/bazelbuild/bazel/issues/2517 54# This target serves two (related) purposes: 55# 1. Bazel does not allow a java_library to depend on an android_library, even if that java_library 56# will be used in a java_plugin. 57# 2. It stores the metadata for the "jarimpl" target that we use to work-around Gradle not loading 58# aar artifacts that are declared as deps of an annotation processor. Our pom.xml generator reads 59# the tags and includes them apppropriately. 60java_import( 61 name = "dagger-android-jar", 62 jars = ["//java/dagger/android:libandroid.jar"], 63 tags = ["maven_coordinates=com.google.dagger:dagger-android-jarimpl:" + POM_VERSION], 64 visibility = ["//visibility:private"], 65) 66 67pom_file( 68 name = "pom", 69 artifact_id = "dagger-android-processor", 70 artifact_name = "Dagger Android Processor", 71 targets = [":processor"], 72) 73 74java_plugin( 75 name = "plugin", 76 generates_api = 1, 77 processor_class = "dagger.android.processor.AndroidProcessor", 78 deps = [":processor"], 79) 80 81load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library") 82 83javadoc_library( 84 name = "processor-javadoc", 85 srcs = [":srcs"], 86 root_packages = ["dagger.android.processor"], 87 deps = [":processor"], 88) 89