1load("//third_party/java/android/android_sdk_linux/extras/android/compatibility/jetify:jetify.bzl", "jetify_android_library", "jetify_android_local_test")
2
3package(
4    default_applicable_licenses = ["//third_party/java_src/robolectric:license"],
5    default_visibility = ["//third_party/java_src/robolectric:__subpackages__"],
6)
7
8licenses(["notice"])
9
10#==============================================================================
11# Test resources library
12#==============================================================================
13jetify_android_library(
14    name = "test_resources",
15    custom_package = "org.robolectric.shadows.androidx.fragment",
16    manifest = "src/test/AndroidManifest.xml",
17    resource_files = glob(
18        ["src/test/resources/**/*"],
19    ),
20)
21
22#==============================================================================
23# AndroidX fragment module library
24#==============================================================================
25jetify_android_library(
26    name = "androidx_fragment",
27    testonly = 1,
28    srcs = glob(
29        ["src/main/java/**"],
30    ),
31    custom_package = "org.robolectric.shadows.androidx.fragment",
32    javacopts = [
33        "-Aorg.robolectric.annotation.processing.shadowPackage=org.robolectric.shadows.androidx.fragment",
34    ],
35    jetify_sources = True,
36    plugins = [
37        "//java/com/google/thirdparty/robolectric/processor",
38    ],
39    deps = [
40        "//third_party/java/androidx/core",
41        "//third_party/java/androidx/fragment",
42        "//third_party/java/androidx/lifecycle",
43        "//third_party/java_src/robolectric/shadowapi",
44        "//third_party/java_src/robolectric/shadows/framework",
45    ],
46)
47
48[
49    jetify_android_local_test(
50        name = "test_" + src.rstrip(".java"),
51        size = "small",
52        srcs = glob(
53            ["src/test/java/**/*.java"],
54        ),
55        jetify_sources = True,
56        deps = [
57            ":androidx_fragment",
58            ":test_resources",
59            "//third_party/java/androidx/fragment",
60            "//third_party/java/androidx/loader",
61            "//third_party/java/mockito",
62            "//third_party/java/robolectric",
63            "//third_party/java/truth",
64        ],
65    )
66    for src in glob(
67        ["src/test/java/**/*Test.java"],
68    )
69]
70