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# A JSR-330 compliant dependency injection system for android and java 17 18load("@rules_java//java:defs.bzl", "java_library", "java_plugin") 19load( 20 "//:build_defs.bzl", 21 "POM_VERSION", 22) 23load("//tools:maven.bzl", "gen_maven_artifact") 24 25package(default_visibility = ["//:src"]) 26 27java_library( 28 name = "processor", 29 srcs = glob( 30 ["*.java"], 31 exclude = ["package-info.java"], 32 ), 33 plugins = [ 34 "//java/dagger/internal/codegen/bootstrap", 35 ], 36 tags = ["maven_coordinates=com.google.dagger:dagger-compiler:" + POM_VERSION], 37 exports = [ 38 "@google_bazel_common//third_party/java/jsr250_annotations", # Export for @Generated 39 ], 40 deps = [ 41 ":package_info", 42 "//java/dagger:core", 43 "//java/dagger/internal/codegen/base", 44 "//java/dagger/internal/codegen/binding", 45 "//java/dagger/internal/codegen/bindinggraphvalidation", 46 "//java/dagger/internal/codegen/compileroption", 47 "//java/dagger/internal/codegen/componentgenerator", 48 "//java/dagger/internal/codegen/extension", 49 "//java/dagger/internal/codegen/javapoet", 50 "//java/dagger/internal/codegen/kotlin", 51 "//java/dagger/internal/codegen/langmodel", 52 "//java/dagger/internal/codegen/validation", 53 "//java/dagger/internal/codegen/writing", 54 "//java/dagger/internal/guava:collect", 55 "//java/dagger/producers", 56 "//java/dagger/spi", 57 "@google_bazel_common//third_party/java/auto:service", 58 "@google_bazel_common//third_party/java/auto:value", 59 "@google_bazel_common//third_party/java/error_prone:annotations", 60 "@google_bazel_common//third_party/java/google_java_format", 61 "@google_bazel_common//third_party/java/incap", 62 "@google_bazel_common//third_party/java/javapoet", 63 "@google_bazel_common//third_party/java/jsr330_inject", 64 "@maven//:com_google_auto_auto_common", 65 ], 66) 67 68java_library( 69 name = "package_info", 70 srcs = ["package-info.java"], 71 tags = ["maven:merged"], 72 deps = ["@google_bazel_common//third_party/java/error_prone:annotations"], 73) 74 75gen_maven_artifact( 76 name = "artifact", 77 artifact_coordinates = "com.google.dagger:dagger-compiler:" + POM_VERSION, 78 artifact_name = "Dagger Compiler", 79 artifact_target = ":processor", 80 artifact_target_libs = [ 81 ":package_info", 82 "//java/dagger/internal/codegen/base", 83 "//java/dagger/internal/codegen/base:shared", 84 "//java/dagger/internal/codegen/binding", 85 "//java/dagger/internal/codegen/bindinggraphvalidation", 86 "//java/dagger/internal/codegen/compileroption", 87 "//java/dagger/internal/codegen/componentgenerator", 88 "//java/dagger/internal/codegen/javapoet", 89 "//java/dagger/internal/codegen/kotlin", 90 "//java/dagger/internal/codegen/langmodel", 91 "//java/dagger/internal/codegen/validation", 92 "//java/dagger/internal/codegen/writing", 93 "//java/dagger/model:internal-proxies", 94 ], 95 artifact_target_maven_deps = [ 96 "com.google.auto:auto-common", 97 "com.google.code.findbugs:jsr305", 98 "com.google.dagger:dagger-producers", 99 "com.google.dagger:dagger-spi", 100 "com.google.dagger:dagger", 101 "com.google.googlejavaformat:google-java-format", 102 "com.google.guava:failureaccess", 103 "com.google.guava:guava", 104 "com.squareup:javapoet", 105 "javax.annotation:jsr250-api", 106 "javax.inject:javax.inject", 107 "net.ltgt.gradle.incap:incap", 108 "org.checkerframework:checker-compat-qual", 109 "org.jetbrains.kotlin:kotlin-stdlib", 110 "org.jetbrains.kotlinx:kotlinx-metadata-jvm", 111 ], 112 javadoc_root_packages = ["dagger.internal.codegen"], 113 # The javadocs should only include ComponentProcessor.java, since that is the only class used 114 # externally. Specifically, ComponentProcessor.forTesting() is required for testing SPI plugins. 115 javadoc_srcs = ["ComponentProcessor.java"], 116 shaded_deps = ["@maven//:com_google_auto_auto_common"], 117 shaded_rules = ["rule com.google.auto.common.** dagger.shaded.auto.common.@1"], 118) 119 120java_plugin( 121 name = "component-codegen", 122 generates_api = 1, 123 output_licenses = ["unencumbered"], 124 processor_class = "dagger.internal.codegen.ComponentProcessor", 125 tags = [ 126 "annotation=dagger.Component;" + 127 "genclass=${package}.Dagger${outerclasses}${classname}", 128 "annotation=dagger.producers.ProductionComponent;" + 129 "genclass=${package}.Dagger${outerclasses}${classname}", 130 ], 131 deps = [":processor"], 132) 133