xref: /aosp_15_r20/external/dagger2/javatests/dagger/functional/kotlin/BUILD (revision f585d8a307d0621d6060bd7e80091fdcbf94fe27)
1# Copyright (C) 2019 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#   Functional test code for Dagger-Android
17
18load("@rules_java//java:defs.bzl", "java_library")
19load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
20load("//:test_defs.bzl", "GenJavaTests")
21
22package(default_visibility = ["//:src"])
23
24GenJavaTests(
25    name = "PropertyQualifierTest",
26    srcs = ["PropertyQualifierTest.java"],
27    functional = True,
28    test_only_deps = [
29        "//third_party/java/guava/base",
30        "//third_party/java/guava/collect",
31        "//third_party/java/junit",
32        "//third_party/java/truth",
33    ],
34    deps = [
35        ":FooWithInjectedQualifier",
36        ":PropertyQualifierClasses",
37    ],
38)
39
40kt_jvm_library(
41    name = "PropertyQualifierClasses",
42    srcs = ["PropertyQualifierClasses.kt"],
43    # TODO(danysantiago): Remove 'plugins' once kt_jvm_library supports 'exported_plugins'.
44    plugins = ["//javatests/dagger/functional/kotlin/processor:plugin"],
45    deps = [
46        ":FooWithInjectedQualifier",
47        ":java_qualifier",
48        "//:dagger_with_compiler",
49        "//javatests/dagger/functional/kotlin/processor:annotation",
50    ],
51)
52
53kt_jvm_library(
54    name = "FooWithInjectedQualifier",
55    srcs = ["FooWithInjectedQualifier.kt"],
56    deps = [
57        ":java_qualifier",
58        "//:dagger_with_compiler",
59    ],
60)
61
62java_library(
63    name = "java_qualifier",
64    srcs = [
65        "JavaTestQualifier.java",
66        "JavaTestQualifierWithTarget.java",
67    ],
68    deps = [
69        "//:dagger_with_compiler",
70    ],
71)
72
73GenJavaTests(
74    name = "ObjectModuleTest",
75    srcs = ["ObjectModuleTest.java"],
76    functional = True,
77    test_only_deps = [
78        "//third_party/java/guava/base",
79        "//third_party/java/guava/collect",
80        "//third_party/java/junit",
81        "//third_party/java/truth",
82    ],
83    deps = [
84        ":ObjectModuleClasses",
85    ],
86)
87
88kt_jvm_library(
89    name = "ObjectModuleClasses",
90    srcs = [
91        "ObjectModuleClasses.kt",
92        "PublicModuleWithNonPublicInclude.java",
93    ],
94    # TODO(danysantiago): Remove 'plugins' once kt_jvm_library supports 'exported_plugins'.
95    plugins = ["//javatests/dagger/functional/kotlin/processor:plugin"],
96    deps = [
97        "//:dagger_with_compiler",
98    ],
99)
100
101GenJavaTests(
102    name = "DependsOnGeneratedCodeTest",
103    srcs = ["DependsOnGeneratedCodeTest.java"],
104    functional = True,
105    test_only_deps = [
106        "//third_party/java/guava/base",
107        "//third_party/java/guava/collect",
108        "//third_party/java/junit",
109        "//third_party/java/truth",
110    ],
111    deps = [
112        ":DependsOnGeneratedCodeClasses",
113    ],
114)
115
116kt_jvm_library(
117    name = "DependsOnGeneratedCodeClasses",
118    srcs = ["DependsOnGeneratedCodeClasses.kt"],
119    # TODO(danysantiago): Remove 'plugins' once kt_jvm_library supports 'exported_plugins'.
120    plugins = ["//javatests/dagger/functional/kotlin/processor:plugin"],
121    deps = [
122        "//:dagger_with_compiler",
123        "//third_party/java/auto:factory",
124    ],
125)
126
127GenJavaTests(
128    name = "CompanionModuleTest",
129    srcs = ["CompanionModuleTest.java"],
130    functional = True,
131    test_only_deps = [
132        "//third_party/java/guava/base",
133        "//third_party/java/guava/collect",
134        "//third_party/java/junit",
135        "//third_party/java/truth",
136    ],
137    deps = [
138        ":CompanionModuleClasses",
139    ],
140)
141
142kt_jvm_library(
143    name = "CompanionModuleClasses",
144    srcs = ["CompanionModuleClasses.kt"],
145    # TODO(danysantiago): Remove 'plugins' once kt_jvm_library supports 'exported_plugins'.
146    plugins = ["//javatests/dagger/functional/kotlin/processor:plugin"],
147    deps = [
148        "//:dagger_with_compiler",
149    ],
150)
151