forked from oppia/oppia-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
111 lines (103 loc) · 4.43 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# TODO(#1532): Rename file to 'BUILD' post-Gradle.
"""
This library contains fake objects used for testing as well as tests for these objects.
"""
load("@dagger//:workspace_defs.bzl", "dagger_rules")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")
load("//testing:testing_test.bzl", "testing_test")
# Source files that have been migrated to their own package-based libraries. Files added to this
# list will automatically be excluded from the top-level utility library. It's recommended to use
# globs here to ensure new files added to migrated packages don't accidentally get included in the
# top-level module library.
MIGRATED_PROD_FILES = glob([
"src/main/java/org/oppia/android/testing/mockito/*.kt",
"src/main/java/org/oppia/android/testing/robolectric/*.kt",
"src/main/java/org/oppia/android/testing/threading/*.kt",
"src/main/java/org/oppia/android/testing/time/*.kt",
])
# Library for general-purpose testing fakes.
kt_android_library(
name = "testing",
testonly = True,
srcs = glob(
["src/main/java/org/oppia/android/testing/**/*.kt"],
exclude = MIGRATED_PROD_FILES,
),
custom_package = "org.oppia.android.testing",
manifest = "src/main/AndroidManifest.xml",
visibility = ["//visibility:public"],
deps = [
":dagger",
"//domain",
"//testing/src/main/java/org/oppia/android/testing/threading:test_coroutine_dispatchers",
"//testing/src/main/java/org/oppia/android/testing/time:fake_oppia_clock",
"//third_party:androidx_core_core-ktx",
"//third_party:androidx_lifecycle_lifecycle-livedata-ktx",
"//third_party:androidx_test_espresso_espresso-contrib",
"//third_party:androidx_test_espresso_espresso-core",
"//third_party:androidx_test_espresso_espresso-intents",
"//third_party:androidx_test_ext_junit",
"//third_party:androidx_test_runner",
"//third_party:com_google_truth_truth",
"//third_party:com_squareup_retrofit2_converter-moshi",
"//third_party:com_squareup_retrofit2_retrofit",
"//third_party:com_squareup_retrofit2_retrofit-mock",
"//third_party:junit_junit",
"//third_party:moshi",
"//third_party:nl_dionsegijn_konfetti",
"//third_party:org_jetbrains_kotlin_kotlin-reflect",
"//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-test",
"//third_party:org_mockito_mockito-core",
"//third_party:org_robolectric_robolectric",
"//utility",
],
)
# keep sorted
TEST_DEPS = [
":assertion_helpers",
":dagger",
":testing",
"//domain",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/threading:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
"//third_party:androidx_lifecycle_lifecycle-livedata-ktx",
"//third_party:androidx_test_espresso_espresso-contrib",
"//third_party:androidx_test_espresso_espresso-core",
"//third_party:androidx_test_espresso_espresso-intents",
"//third_party:androidx_test_ext_junit",
"//third_party:androidx_test_runner",
"//third_party:com_google_truth_truth",
"//third_party:com_squareup_retrofit2_converter-moshi",
"//third_party:com_squareup_retrofit2_retrofit",
"//third_party:com_squareup_retrofit2_retrofit-mock",
"//third_party:junit_junit",
"//third_party:moshi",
"//third_party:org_jetbrains_kotlin_kotlin-reflect",
"//third_party:org_jetbrains_kotlinx_kotlinx-coroutines-test",
"//third_party:org_mockito_mockito-core",
"//third_party:robolectric_android-all",
"//utility/src/main/java/org/oppia/android/util/logging:logger_module",
]
# Qualified file paths for test classes that have been migrated over to their own packages &
# shouldn't be defined as module-level tests.
# keep sorted
MIGRATED_TESTS = glob([
"src/test/java/org/oppia/android/testing/threading/*.kt",
])
[testing_test(
name = test_file_path,
filtered_tests = MIGRATED_TESTS,
deps = TEST_DEPS,
) for test_file_path in glob(["src/test/java/org/oppia/android/testing/**/*Test.kt"])]
kt_android_library(
name = "assertion_helpers",
testonly = True,
srcs = ["src/main/java/org/oppia/android/testing/AssertionHelpers.kt"],
visibility = ["//visibility:public"],
deps = [
"//third_party:junit_junit",
"//third_party:org_jetbrains_kotlin_kotlin-reflect",
],
)
dagger_rules()