Colin Cross | 87224a8 | 2019-04-02 23:04:13 -0700 | [diff] [blame] | 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 | |
| 15 | java_library { |
| 16 | name: "robolectric_android-all-stub", |
| 17 | |
| 18 | static_libs: [ |
| 19 | "conscrypt", |
Victor Chang | fa9de59 | 2019-08-06 16:38:07 +0100 | [diff] [blame] | 20 | "core-icu4j", |
Colin Cross | 87224a8 | 2019-04-02 23:04:13 -0700 | [diff] [blame] | 21 | "core-libart", |
| 22 | "ext", |
Jiyong Park | d6566b0 | 2020-01-06 13:28:58 +0900 | [diff] [blame] | 23 | "framework-all", |
Colin Cross | 87224a8 | 2019-04-02 23:04:13 -0700 | [diff] [blame] | 24 | "icu4j-icudata-jarjar", |
| 25 | "icu4j-icutzdata-jarjar", |
| 26 | "ims-common", |
| 27 | "android.test.base_static", |
| 28 | "libphonenumber-platform", |
| 29 | "okhttp", |
| 30 | "services", |
| 31 | "services.accessibility", |
| 32 | "telephony-common", |
Colin Cross | 87224a8 | 2019-04-02 23:04:13 -0700 | [diff] [blame] | 33 | |
| 34 | "robolectric_tzdata", |
| 35 | "robolectric_framework_res", |
| 36 | "robolectric_framework_raw_res", |
| 37 | ], |
| 38 | |
| 39 | java_resources: [ |
| 40 | // Copy the build.prop |
| 41 | ":robolectric_build_props", |
| 42 | ], |
| 43 | dist: { |
| 44 | targets: [ |
| 45 | "sdk", |
| 46 | "win_sdk", |
| 47 | ], |
| 48 | dest: "android-all-robolectric.jar", |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // build.prop file created by module type defined in soong/robolectric.go |
| 53 | robolectric_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 |
| 59 | java_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 |
| 66 | java_genrule { |
| 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 | |
| 78 | java_genrule { |
| 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 | } |
Colin Cross | 698cc7c | 2019-04-23 15:11:07 -0700 | [diff] [blame] | 90 | |
| 91 | // Make robolectric_android-all-stub available as a host jar |
| 92 | java_device_for_host { |
| 93 | name: "robolectric-host-android_all", |
| 94 | libs: ["robolectric_android-all-stub"], |
| 95 | } |
| 96 | |
| 97 | //############################################# |
| 98 | // Assemble Robolectric_all |
| 99 | //############################################# |
| 100 | |
| 101 | java_library_host { |
| 102 | name: "Robolectric_all", |
| 103 | |
| 104 | static_libs: [ |
| 105 | "Robolectric_shadows_androidx_fragment", |
| 106 | "Robolectric_shadows_httpclient", |
| 107 | "Robolectric_shadows_framework", |
| 108 | "Robolectric_shadows_supportv4", |
| 109 | "Robolectric_shadows_multidex", |
| 110 | "Robolectric_robolectric", |
| 111 | "Robolectric_annotations", |
| 112 | "Robolectric_resources", |
| 113 | "Robolectric_shadowapi", |
| 114 | "Robolectric_sandbox", |
| 115 | "Robolectric_junit", |
| 116 | "Robolectric_utils", |
Pete Gillin | 390294a | 2019-06-20 17:00:30 +0100 | [diff] [blame] | 117 | "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) |
Colin Cross | 698cc7c | 2019-04-23 15:11:07 -0700 | [diff] [blame] | 118 | "junit", |
| 119 | "asm-tree-6.0", |
| 120 | "guava", |
| 121 | "asm-commons-6.0", |
| 122 | "bouncycastle-unbundled", |
| 123 | "robolectric-sqlite4java-0.282", |
| 124 | "hamcrest", |
| 125 | "hamcrest-library", |
| 126 | "robolectric-host-androidx-test-runner", |
| 127 | "robolectric-host-org_apache_http_legacy", |
| 128 | ], |
| 129 | |
| 130 | java_resource_dirs: [ |
| 131 | "shadows/framework/src/main/resources", |
| 132 | "src/main/resources", |
| 133 | ], |
| 134 | } |
| 135 | |
| 136 | // Make Robolectric_all available as a target jar |
| 137 | java_host_for_device { |
| 138 | name: "Robolectric_all-target", |
| 139 | libs: ["Robolectric_all"], |
| 140 | } |
| 141 | |
| 142 | // Make dependencies available as host jars |
| 143 | java_device_for_host { |
| 144 | name: "robolectric-host-androidx-test-core", |
| 145 | libs: ["androidx.test.core"], |
| 146 | } |
| 147 | |
| 148 | java_device_for_host { |
| 149 | name: "robolectric-host-androidx-test-ext-junit", |
| 150 | libs: ["androidx.test.ext.junit"], |
| 151 | } |
| 152 | |
| 153 | java_device_for_host { |
| 154 | name: "robolectric-host-androidx-test-monitor", |
| 155 | libs: ["androidx.test.monitor"], |
| 156 | } |
| 157 | |
| 158 | java_device_for_host { |
| 159 | name: "robolectric-host-androidx-test-runner", |
| 160 | libs: ["androidx.test.runner"], |
| 161 | } |
| 162 | |
| 163 | java_device_for_host { |
| 164 | name: "robolectric-host-androidx", |
| 165 | libs: ["androidx.fragment_fragment"], |
| 166 | } |
| 167 | |
| 168 | java_device_for_host { |
| 169 | name: "robolectric-host-android-support-v4", |
| 170 | libs: ["android-support-v4"], |
| 171 | } |
| 172 | |
| 173 | java_device_for_host { |
| 174 | name: "robolectric-host-android-support-multidex", |
| 175 | libs: ["android-support-multidex"], |
| 176 | } |
| 177 | |
| 178 | java_device_for_host { |
| 179 | name: "robolectric-host-org_apache_http_legacy", |
| 180 | libs: ["org.apache.http.legacy.stubs"], |
| 181 | } |