• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24kt_jvm_library(
25    name = "kotlin",
26    srcs = glob(
27        [
28            "*.java",
29            "*.kt",
30        ],
31        exclude = [
32            "*Test.java",
33            "JavaTestQualifier.java",
34            "FooWithInjectedQualifier.kt",
35        ],
36    ),
37    # TODO(danysantiago): Remove 'plugins' once kt_jvm_library supports 'exported_plugins'.
38    plugins = ["//javatests/dagger/functional/kotlin/processor:plugin"],
39    deps = [
40        ":foo_with_injected_qualifier",
41        ":java_qualifier",
42        "//:dagger_with_compiler",
43        "//javatests/dagger/functional/kotlin/processor:annotation",
44    ],
45)
46
47kt_jvm_library(
48    name = "foo_with_injected_qualifier",
49    srcs = ["FooWithInjectedQualifier.kt"],
50    deps = [
51        ":java_qualifier",
52        "//:dagger_with_compiler",
53    ],
54)
55
56java_library(
57    name = "java_qualifier",
58    srcs = ["JavaTestQualifier.java"],
59    deps = [
60        "//:dagger_with_compiler",
61    ],
62)
63
64GenJavaTests(
65    name = "kotlin_tests",
66    srcs = glob(["*Test.java"]),
67    functional = True,
68    test_only_deps = [
69        "//java/dagger/internal/guava:base",
70        "//java/dagger/internal/guava:collect",
71        "@google_bazel_common//third_party/java/junit",
72        "@google_bazel_common//third_party/java/truth",
73    ],
74    deps = [
75        ":foo_with_injected_qualifier",
76        ":kotlin",
77        "//:dagger_with_compiler",
78    ],
79)
80