• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//#############################################
2// Compile Robolectric processor
3//#############################################
4
5package {
6    // See: http://go/android-license-faq
7    // A large-scale-change added 'default_applicable_licenses' to import
8    // all of the 'license_kinds' from "external_robolectric-shadows_license"
9    // to get the below license kinds:
10    //   SPDX-license-identifier-Apache-2.0
11    //   SPDX-license-identifier-MIT
12    default_applicable_licenses: ["external_robolectric-shadows_license"],
13}
14
15java_plugin {
16    name: "Robolectric_processor",
17    processor_class: "org.robolectric.annotation.processing.RobolectricProcessor",
18    srcs: ["src/main/java/**/*.java"],
19    java_resource_dirs: ["src/main/resources"],
20    java_resources: ["sdks.txt"],
21    use_tools_jar: true,
22    static_libs: [
23        "Robolectric_annotations",
24        "Robolectric_shadowapi",
25        "asm-commons-6.0",
26        "guava",
27        "asm-tree-6.0",
28        "gson-prebuilt-jar",
29        "asm-6.0",
30        "jsr305",
31    ],
32
33    openjdk9: {
34        javacflags: [
35            "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
36            "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
37        ],
38    },
39}
40
41//#############################################
42// Compile Robolectric processor tests
43//#############################################
44java_test_host {
45    name: "Robolectric_processor_tests",
46    srcs: ["src/test/java/**/*.java"],
47    java_resource_dirs: ["src/test/resources"],
48    java_resources: [":Robolectric_processor_tests_resources"],
49
50    static_libs: [
51        "Robolectric_annotations",
52        "Robolectric_processor",
53        "Robolectric_shadowapi",
54        "robolectric-javax.annotation-api-1.2",
55        "robolectric-compile-testing-0.19",
56        "mockito",
57        "hamcrest",
58        "guava",
59        "objenesis",
60        "junit",
61        "truth-prebuilt",
62        "gson-prebuilt-jar",
63        "jsr305",
64    ],
65
66    test_suites: ["general-tests"],
67
68    // Disable annotation processing while compiling tests to avoid executing RobolectricProcessor.
69    javacflags: ["-proc:none"],
70}
71
72// Workaround: java_resource_dirs ignores *.java files
73filegroup {
74    name: "Robolectric_processor_tests_resources",
75    path: "src/test/resources",
76    srcs: ["src/test/resources/**/*.java"],
77}
78