1*e6ba1607SAndroid Build Coastguard Worker//############################################# 2*e6ba1607SAndroid Build Coastguard Worker// Compile Robolectric processor 3*e6ba1607SAndroid Build Coastguard Worker//############################################# 4*e6ba1607SAndroid Build Coastguard Worker 5*e6ba1607SAndroid Build Coastguard Workerpackage { 6*e6ba1607SAndroid Build Coastguard Worker // See: http://go/android-license-faq 7*e6ba1607SAndroid Build Coastguard Worker // A large-scale-change added 'default_applicable_licenses' to import 8*e6ba1607SAndroid Build Coastguard Worker // all of the 'license_kinds' from "external_robolectric_license" 9*e6ba1607SAndroid Build Coastguard Worker // to get the below license kinds: 10*e6ba1607SAndroid Build Coastguard Worker // SPDX-license-identifier-Apache-2.0 11*e6ba1607SAndroid Build Coastguard Worker // SPDX-license-identifier-MIT 12*e6ba1607SAndroid Build Coastguard Worker default_applicable_licenses: ["external_robolectric_license"], 13*e6ba1607SAndroid Build Coastguard Worker} 14*e6ba1607SAndroid Build Coastguard Worker 15*e6ba1607SAndroid Build Coastguard Workerjava_library { 16*e6ba1607SAndroid Build Coastguard Worker name: "libRobolectric_processor_upstream", 17*e6ba1607SAndroid Build Coastguard Worker host_supported: true, 18*e6ba1607SAndroid Build Coastguard Worker device_supported: false, 19*e6ba1607SAndroid Build Coastguard Worker srcs: ["src/main/java/**/*.java"], 20*e6ba1607SAndroid Build Coastguard Worker java_resource_dirs: ["src/main/resources"], 21*e6ba1607SAndroid Build Coastguard Worker //java_resources: ["sdks.txt"], 22*e6ba1607SAndroid Build Coastguard Worker use_tools_jar: true, 23*e6ba1607SAndroid Build Coastguard Worker plugins: [ 24*e6ba1607SAndroid Build Coastguard Worker "auto_service_plugin", 25*e6ba1607SAndroid Build Coastguard Worker ], 26*e6ba1607SAndroid Build Coastguard Worker static_libs: [ 27*e6ba1607SAndroid Build Coastguard Worker "Robolectric_annotations_upstream", 28*e6ba1607SAndroid Build Coastguard Worker "Robolectric_shadowapi_upstream", 29*e6ba1607SAndroid Build Coastguard Worker "Robolectric_shadows_versioning_upstream", 30*e6ba1607SAndroid Build Coastguard Worker "asm-9.6", 31*e6ba1607SAndroid Build Coastguard Worker "asm-commons-9.6", 32*e6ba1607SAndroid Build Coastguard Worker "asm-tree-9.6", 33*e6ba1607SAndroid Build Coastguard Worker "asm-util-9.6", 34*e6ba1607SAndroid Build Coastguard Worker "auto_service_annotations", 35*e6ba1607SAndroid Build Coastguard Worker "auto-common-1.1.2", 36*e6ba1607SAndroid Build Coastguard Worker "gson", 37*e6ba1607SAndroid Build Coastguard Worker "guava", 38*e6ba1607SAndroid Build Coastguard Worker "jsr305", 39*e6ba1607SAndroid Build Coastguard Worker ], 40*e6ba1607SAndroid Build Coastguard Worker 41*e6ba1607SAndroid Build Coastguard Worker openjdk9: { 42*e6ba1607SAndroid Build Coastguard Worker javacflags: [ 43*e6ba1607SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", 44*e6ba1607SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", 45*e6ba1607SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", 46*e6ba1607SAndroid Build Coastguard Worker ], 47*e6ba1607SAndroid Build Coastguard Worker }, 48*e6ba1607SAndroid Build Coastguard Worker} 49*e6ba1607SAndroid Build Coastguard Worker 50*e6ba1607SAndroid Build Coastguard Workerjava_plugin { 51*e6ba1607SAndroid Build Coastguard Worker name: "Robolectric_processor_upstream", 52*e6ba1607SAndroid Build Coastguard Worker processor_class: "org.robolectric.annotation.processing.RobolectricProcessor", 53*e6ba1607SAndroid Build Coastguard Worker static_libs: ["libRobolectric_processor_upstream"], 54*e6ba1607SAndroid Build Coastguard Worker} 55*e6ba1607SAndroid Build Coastguard Worker 56*e6ba1607SAndroid Build Coastguard Worker//############################################# 57*e6ba1607SAndroid Build Coastguard Worker// Compile Robolectric processor tests 58*e6ba1607SAndroid Build Coastguard Worker//############################################# 59*e6ba1607SAndroid Build Coastguard Workerjava_test_host { 60*e6ba1607SAndroid Build Coastguard Worker name: "Robolectric_processor_tests_upstream", 61*e6ba1607SAndroid Build Coastguard Worker srcs: ["src/test/java/**/*.java"], 62*e6ba1607SAndroid Build Coastguard Worker java_resource_dirs: ["src/test/resources"], 63*e6ba1607SAndroid Build Coastguard Worker java_resources: [":Robolectric_processor_tests_resources_upstream"], 64*e6ba1607SAndroid Build Coastguard Worker static_libs: [ 65*e6ba1607SAndroid Build Coastguard Worker "Robolectric_annotations_upstream", 66*e6ba1607SAndroid Build Coastguard Worker "libRobolectric_processor_upstream", 67*e6ba1607SAndroid Build Coastguard Worker "Robolectric_shadowapi_upstream", 68*e6ba1607SAndroid Build Coastguard Worker "robolectric-javax.annotation-api-1.2", 69*e6ba1607SAndroid Build Coastguard Worker "robolectric-compile-testing-0.19", 70*e6ba1607SAndroid Build Coastguard Worker "mockito", 71*e6ba1607SAndroid Build Coastguard Worker "hamcrest", 72*e6ba1607SAndroid Build Coastguard Worker "guava", 73*e6ba1607SAndroid Build Coastguard Worker "objenesis", 74*e6ba1607SAndroid Build Coastguard Worker "junit", 75*e6ba1607SAndroid Build Coastguard Worker "truth", 76*e6ba1607SAndroid Build Coastguard Worker "gson", 77*e6ba1607SAndroid Build Coastguard Worker "jsr305", 78*e6ba1607SAndroid Build Coastguard Worker ], 79*e6ba1607SAndroid Build Coastguard Worker 80*e6ba1607SAndroid Build Coastguard Worker test_suites: ["general-tests"], 81*e6ba1607SAndroid Build Coastguard Worker 82*e6ba1607SAndroid Build Coastguard Worker // Disable annotation processing while compiling tests to avoid executing RobolectricProcessor. 83*e6ba1607SAndroid Build Coastguard Worker javacflags: ["-proc:none"], 84*e6ba1607SAndroid Build Coastguard Worker} 85*e6ba1607SAndroid Build Coastguard Worker 86*e6ba1607SAndroid Build Coastguard Worker// Workaround: java_resource_dirs ignores *.java files 87*e6ba1607SAndroid Build Coastguard Workerfilegroup { 88*e6ba1607SAndroid Build Coastguard Worker name: "Robolectric_processor_tests_resources_upstream", 89*e6ba1607SAndroid Build Coastguard Worker path: "src/test/resources", 90*e6ba1607SAndroid Build Coastguard Worker srcs: ["src/test/resources/**/*.java"], 91*e6ba1607SAndroid Build Coastguard Worker} 92