1# Copyright (C) 2020 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# Tests for internal code for implementing Hilt processors. 17 18load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library") 19load("//java/dagger/testing/compile:macros.bzl", "kt_compiler_test") 20 21package(default_visibility = ["//:src"]) 22 23java_test( 24 name = "ViewModelProcessorTest", 25 runtime_deps = [ 26 ":ViewModelProcessorTestLib", 27 "//java/dagger/hilt/android/lifecycle", 28 "@androidsdk//:platforms/android-30/android.jar", 29 "@google_bazel_common//third_party/java/compile_testing", 30 "@google_bazel_common//third_party/java/truth", 31 "@maven//:androidx_lifecycle_lifecycle_viewmodel", 32 "@maven//:androidx_lifecycle_lifecycle_viewmodel_savedstate", 33 ], 34) 35 36kt_jvm_library( 37 name = "ViewModelProcessorTestLib", 38 srcs = [ 39 "ViewModelProcessorTest.kt", 40 ], 41 deps = [ 42 ":test_utils", 43 "//java/dagger/hilt/android/processor/internal/viewmodel:processor_lib", 44 "@google_bazel_common//third_party/java/compile_testing", 45 "@google_bazel_common//third_party/java/junit", 46 "@google_bazel_common//third_party/java/truth", 47 ], 48) 49 50java_test( 51 name = "ViewModelGeneratorTest", 52 runtime_deps = [ 53 ":ViewModelGeneratorTestLib", 54 "//java/dagger/hilt/android/lifecycle", 55 "@androidsdk//:platforms/android-30/android.jar", 56 "@google_bazel_common//third_party/java/compile_testing", 57 "@google_bazel_common//third_party/java/truth", 58 "@maven//:androidx_lifecycle_lifecycle_viewmodel", 59 "@maven//:androidx_lifecycle_lifecycle_viewmodel_savedstate", 60 ], 61) 62 63kt_jvm_library( 64 name = "ViewModelGeneratorTestLib", 65 srcs = [ 66 "ViewModelGeneratorTest.kt", 67 ], 68 deps = [ 69 ":test_utils", 70 "//java/dagger/hilt/android/processor/internal/viewmodel:processor_lib", 71 "@google_bazel_common//third_party/java/compile_testing", 72 "@google_bazel_common//third_party/java/junit", 73 "@google_bazel_common//third_party/java/truth", 74 ], 75) 76 77kt_compiler_test( 78 name = "ViewModelValidationPluginTest", 79 srcs = [ 80 "ViewModelValidationPluginTest.kt", 81 ], 82 compiler_deps = [ 83 "@androidsdk//:platforms/android-30/android.jar", 84 "@maven//:androidx_lifecycle_lifecycle_viewmodel", 85 "@maven//:androidx_lifecycle_lifecycle_viewmodel_savedstate", 86 "@google_bazel_common//third_party/java/compile_testing", 87 "@google_bazel_common//third_party/java/truth", 88 "//java/dagger/hilt/android/lifecycle", 89 "//java/dagger/hilt/android:android_entry_point", 90 "//java/dagger/hilt/android:hilt_android_app", 91 ], 92 deps = [ 93 ":test_utils", 94 "//:compiler_internals", 95 "//java/dagger/hilt/android/processor/internal/viewmodel:processor_lib", 96 "//java/dagger/hilt/android/processor/internal/viewmodel:validation_plugin_lib", 97 "//javatests/dagger/hilt/android/processor:android_compilers", 98 "@google_bazel_common//third_party/java/compile_testing", 99 "@google_bazel_common//third_party/java/junit", 100 "@google_bazel_common//third_party/java/truth", 101 ], 102) 103 104kt_jvm_library( 105 name = "test_utils", 106 srcs = [ 107 "TestUtils.kt", 108 ], 109 deps = [ 110 "@google_bazel_common//third_party/java/compile_testing", 111 ], 112) 113