1// Copyright (C) 2019 The Android Open Source Project 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 15package { 16 default_visibility: [":__subpackages__"], 17 default_applicable_licenses: ["external_robolectric-shadows_license"], 18} 19 20// Added automatically by a large-scale-change that took the approach of 21// 'apply every license found to every target'. While this makes sure we respect 22// every license restriction, it may not be entirely correct. 23// 24// e.g. GPL in an MIT project might only apply to the contrib/ directory. 25// 26// Please consider splitting the single license below into multiple licenses, 27// taking care not to lose any license_kind information, and overriding the 28// default license using the 'licenses: [...]' property on targets as needed. 29// 30// For unused files, consider creating a 'fileGroup' with "//visibility:private" 31// to attach the license to, and including a comment whether the files may be 32// used in the current project. 33// See: http://go/android-license-faq 34license { 35 name: "external_robolectric-shadows_license", 36 visibility: [":__subpackages__"], 37 license_kinds: [ 38 "SPDX-license-identifier-Apache-2.0", 39 "SPDX-license-identifier-MIT", 40 ], 41 license_text: [ 42 "LICENSE", 43 ], 44} 45 46// Empty library. Should be removed 47java_library { 48 name: "robolectric_android-all-stub", 49 visibility: ["//visibility:public"], 50} 51 52// build.prop file created by module type defined in soong/robolectric.go 53robolectric_build_props { 54 name: "robolectric_build_props", 55} 56 57// package the framework raw/uncompiled resources and assets into a jar 58// This logic can be removed once the transition to binary resources is complete 59java_library { 60 name: "robolectric_framework_raw_res_orig", 61 java_resources: [":robolectric_framework_raw_res_files"], 62} 63 64// Move the raw/uncompiled resources and assets into raw-res/ 65// This logic can be removed once the transition to binary resources is complete 66java_genrule_host { 67 name: "robolectric_framework_raw_res", 68 out: ["robolectric_framework_raw_res.jar"], 69 srcs: [":robolectric_framework_raw_res_orig"], 70 tools: ["zip2zip"], 71 cmd: "$(location zip2zip) " + 72 "-i $(location :robolectric_framework_raw_res_orig) " + 73 "-o $(location robolectric_framework_raw_res.jar) " + 74 "-x META-INF/**/* " + 75 "**/*:raw-res/", 76} 77 78java_genrule_host { 79 name: "robolectric_framework_res", 80 tools: ["zip2zip"], 81 srcs: [":framework-res"], 82 out: ["robolectric_framework_res.jar"], 83 cmd: "$(location zip2zip) " + 84 "-i $(location :framework-res) " + 85 "-o $(location robolectric_framework_res.jar) " + 86 "-x classes.dex " + 87 "-x META-INF/**/* " + 88 "-0 resources.arsc", 89} 90 91java_device_for_host { 92 name: "robolectric_android-all-device-deps", 93 libs: [ 94 "conscrypt-for-host", 95 "core-icu4j-for-host", 96 "core-libart-for-host", 97 "ext", 98 "framework-all", 99 "icu4j-icudata-jarjar", 100 "icu4j-icutzdata-jarjar", 101 "ims-common", 102 "android.test.base_static", 103 "libphonenumber-platform", 104 "okhttp-for-host", 105 "services", 106 "services.accessibility", 107 "telephony-common", 108 109 ], 110} 111 112java_library_host { 113 name: "robolectric-host-android_all", 114 static_libs: [ 115 "robolectric_android-all-device-deps", 116 "robolectric_tzdata", 117 "robolectric_framework_res", 118 "robolectric_framework_raw_res", 119 ], 120 dist: { 121 targets: [ 122 "sdk", 123 "win_sdk", 124 ], 125 dest: "android-all-robolectric.jar", 126 }, 127 128 java_resources: [ 129 // Copy the build.prop 130 ":robolectric_build_props", 131 ], 132 visibility: [ 133 ":__subpackages__", 134 "//prebuilts/misc/common/robolectric", 135 ], 136} 137 138//############################################# 139// Assemble Robolectric_all 140//############################################# 141 142java_library_host { 143 name: "Robolectric_all", 144 145 static_libs: [ 146 "Robolectric_shadows_androidx_fragment", 147 "Robolectric_shadows_httpclient", 148 "Robolectric_shadows_framework", 149 "Robolectric_shadows_supportv4", 150 "Robolectric_shadows_multidex", 151 "Robolectric_robolectric", 152 "Robolectric_annotations", 153 "Robolectric_resources", 154 "Robolectric_shadowapi", 155 "Robolectric_sandbox", 156 "Robolectric_junit", 157 "Robolectric_utils", 158 "asm-6.0", // if upgrading to ASM 7.0+, unset my_require_v53_or_lower_class_files in robotest-internal.mk (requires robolectric 4.0.x, see b/135459087) 159 "junit", 160 "asm-tree-6.0", 161 "guava", 162 "asm-commons-6.0", 163 "bouncycastle-unbundled", 164 "robolectric-sqlite4java-0.282", 165 "hamcrest", 166 "hamcrest-library", 167 "robolectric-host-androidx-test-runner", 168 "robolectric-host-org_apache_http_legacy", 169 ], 170 171 java_resource_dirs: [ 172 "shadows/framework/src/main/resources", 173 "src/main/resources", 174 ], 175} 176 177// Make Robolectric_all available as a target jar 178java_host_for_device { 179 name: "Robolectric_all-target", 180 libs: ["Robolectric_all"], 181 visibility: ["//visibility:public"], 182} 183 184// Make dependencies available as host jars 185java_device_for_host { 186 name: "robolectric-host-androidx-test-core", 187 libs: ["androidx.test.core"], 188} 189 190java_device_for_host { 191 name: "robolectric-host-androidx-test-ext-junit", 192 libs: ["androidx.test.ext.junit"], 193} 194 195java_device_for_host { 196 name: "robolectric-host-androidx-test-monitor", 197 libs: ["androidx.test.monitor"], 198} 199 200java_device_for_host { 201 name: "robolectric-host-androidx-test-runner", 202 libs: ["androidx.test.runner"], 203} 204 205java_device_for_host { 206 name: "robolectric-host-androidx", 207 libs: ["androidx.fragment_fragment"], 208} 209 210java_device_for_host { 211 name: "robolectric-host-android-support-v4", 212 libs: ["android-support-v4"], 213} 214 215java_device_for_host { 216 name: "robolectric-host-android-support-multidex", 217 libs: ["android-support-multidex"], 218} 219 220java_device_for_host { 221 name: "robolectric-host-org_apache_http_legacy", 222 libs: ["org.apache.http.legacy.stubs"], 223} 224