Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1 | // Copyright (C) 2018 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 | package apex |
| 16 | |
| 17 | import ( |
| 18 | "fmt" |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 19 | "path" |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 20 | "path/filepath" |
Jiyong Park | ab3ceb3 | 2018-10-10 14:05:29 +0900 | [diff] [blame] | 21 | "sort" |
Jooyung Han | 03b5185 | 2020-02-26 22:45:42 +0900 | [diff] [blame] | 22 | "strconv" |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 23 | "strings" |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 24 | "sync" |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 25 | |
| 26 | "android/soong/android" |
| 27 | "android/soong/cc" |
| 28 | "android/soong/java" |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 29 | "android/soong/python" |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 30 | |
| 31 | "github.com/google/blueprint" |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 32 | "github.com/google/blueprint/bootstrap" |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 33 | "github.com/google/blueprint/proptools" |
| 34 | ) |
| 35 | |
Jooyung Han | 72bd2f8 | 2019-10-23 16:46:38 +0900 | [diff] [blame] | 36 | const ( |
| 37 | imageApexSuffix = ".apex" |
| 38 | zipApexSuffix = ".zipapex" |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 39 | flattenedSuffix = ".flattened" |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 40 | |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 41 | imageApexType = "image" |
| 42 | zipApexType = "zip" |
| 43 | flattenedApexType = "flattened" |
Jooyung Han | 72bd2f8 | 2019-10-23 16:46:38 +0900 | [diff] [blame] | 44 | ) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 45 | |
| 46 | type dependencyTag struct { |
| 47 | blueprint.BaseDependencyTag |
| 48 | name string |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 49 | |
| 50 | // determines if the dependent will be part of the APEX payload |
| 51 | payload bool |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | var ( |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 55 | sharedLibTag = dependencyTag{name: "sharedLib", payload: true} |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 56 | jniLibTag = dependencyTag{name: "jniLib", payload: true} |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 57 | executableTag = dependencyTag{name: "executable", payload: true} |
| 58 | javaLibTag = dependencyTag{name: "javaLib", payload: true} |
| 59 | prebuiltTag = dependencyTag{name: "prebuilt", payload: true} |
| 60 | testTag = dependencyTag{name: "test", payload: true} |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 61 | keyTag = dependencyTag{name: "key"} |
| 62 | certificateTag = dependencyTag{name: "certificate"} |
Jooyung Han | 5c998b9 | 2019-06-27 11:30:33 +0900 | [diff] [blame] | 63 | usesTag = dependencyTag{name: "uses"} |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 64 | androidAppTag = dependencyTag{name: "androidApp", payload: true} |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 65 | apexAvailWl = makeApexAvailableWhitelist() |
Paul Duffin | 7d74e7b | 2020-03-06 12:30:13 +0000 | [diff] [blame] | 66 | |
| 67 | inverseApexAvailWl = invertApexWhiteList(apexAvailWl) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 68 | ) |
| 69 | |
Paul Duffin | 7d74e7b | 2020-03-06 12:30:13 +0000 | [diff] [blame] | 70 | // Transform the map of apex -> modules to module -> apexes. |
| 71 | func invertApexWhiteList(m map[string][]string) map[string][]string { |
| 72 | r := make(map[string][]string) |
| 73 | for apex, modules := range m { |
| 74 | for _, module := range modules { |
| 75 | r[module] = append(r[module], apex) |
| 76 | } |
| 77 | } |
| 78 | return r |
| 79 | } |
| 80 | |
| 81 | // Retrieve the while list of apexes to which the supplied module belongs. |
| 82 | func WhitelistedApexAvailable(moduleName string) []string { |
| 83 | return inverseApexAvailWl[normalizeModuleName(moduleName)] |
| 84 | } |
| 85 | |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 86 | // This is a map from apex to modules, which overrides the |
| 87 | // apex_available setting for that particular module to make |
| 88 | // it available for the apex regardless of its setting. |
| 89 | // TODO(b/147364041): remove this |
| 90 | func makeApexAvailableWhitelist() map[string][]string { |
| 91 | // The "Module separator"s below are employed to minimize merge conflicts. |
| 92 | m := make(map[string][]string) |
| 93 | // |
| 94 | // Module separator |
| 95 | // |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 96 | m["com.android.adbd"] = []string{ |
| 97 | "adbd", |
| 98 | "bcm_object", |
| 99 | "fmtlib", |
| 100 | "libadbconnection_server", |
| 101 | "libadbd", |
| 102 | "libadbd_auth", |
| 103 | "libadbd_core", |
| 104 | "libadbd_services", |
| 105 | "libasyncio", |
| 106 | "libbacktrace_headers", |
| 107 | "libbase", |
| 108 | "libbase_headers", |
| 109 | "libbuildversion", |
| 110 | "libc++", |
| 111 | "libcap", |
| 112 | "libcrypto", |
| 113 | "libcrypto_utils", |
| 114 | "libcutils", |
| 115 | "libcutils_headers", |
| 116 | "libdiagnose_usb", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 117 | "liblog_headers", |
| 118 | "libmdnssd", |
| 119 | "libminijail", |
| 120 | "libminijail_gen_constants", |
| 121 | "libminijail_gen_constants_obj", |
| 122 | "libminijail_gen_syscall", |
| 123 | "libminijail_gen_syscall_obj", |
| 124 | "libminijail_generated", |
| 125 | "libpackagelistparser", |
| 126 | "libpcre2", |
| 127 | "libprocessgroup_headers", |
| 128 | "libqemu_pipe", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 129 | "libsystem_headers", |
| 130 | "libutils_headers", |
| 131 | } |
| 132 | // |
| 133 | // Module separator |
| 134 | // |
Paul Duffin | 50cbefd | 2020-03-10 13:44:19 +0000 | [diff] [blame] | 135 | artApexContents := []string{ |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 136 | "art_cmdlineparser_headers", |
| 137 | "art_disassembler_headers", |
| 138 | "art_libartbase_headers", |
| 139 | "bcm_object", |
| 140 | "bionic_libc_platform_headers", |
| 141 | "core-repackaged-icu4j", |
| 142 | "cpp-define-generator-asm-support", |
| 143 | "cpp-define-generator-definitions", |
| 144 | "crtbegin_dynamic", |
| 145 | "crtbegin_dynamic1", |
| 146 | "crtbegin_so1", |
| 147 | "crtbrand", |
| 148 | "conscrypt.module.intra.core.api.stubs", |
| 149 | "dex2oat_headers", |
| 150 | "dt_fd_forward_export", |
| 151 | "fmtlib", |
| 152 | "icu4c_extra_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 153 | "jacocoagent", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 154 | "javavm_headers", |
| 155 | "jni_platform_headers", |
| 156 | "libPlatformProperties", |
| 157 | "libadbconnection_client", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 158 | "libadbconnection_server", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 159 | "libandroidicuinit", |
| 160 | "libart_runtime_headers_ndk", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 161 | "libartd-disassembler", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 162 | "libasync_safe", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 163 | "libbacktrace", |
| 164 | "libbase", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 165 | "libbase_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 166 | "libc++", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 167 | "libc++_static", |
| 168 | "libc++abi", |
| 169 | "libc++demangle", |
| 170 | "libc_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 171 | "libcrypto", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 172 | "libdexfile_all_headers", |
| 173 | "libdexfile_external_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 174 | "libdexfile_support", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 175 | "libdmabufinfo", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 176 | "libexpat", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 177 | "libfdlibm", |
| 178 | "libgtest_prod", |
| 179 | "libicui18n_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 180 | "libicuuc", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 181 | "libicuuc_headers", |
| 182 | "libicuuc_stubdata", |
| 183 | "libjdwp_headers", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 184 | "liblog_headers", |
| 185 | "liblz4", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 186 | "liblzma", |
| 187 | "libmeminfo", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 188 | "libnativebridge-headers", |
| 189 | "libnativehelper_header_only", |
| 190 | "libnativeloader-headers", |
| 191 | "libnpt_headers", |
| 192 | "libopenjdkjvmti_headers", |
| 193 | "libperfetto_client_experimental", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 194 | "libprocinfo", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 195 | "libprotobuf-cpp-lite", |
| 196 | "libunwind_llvm", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 197 | "libunwindstack", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 198 | "libv8", |
| 199 | "libv8base", |
| 200 | "libv8gen", |
| 201 | "libv8platform", |
| 202 | "libv8sampler", |
| 203 | "libv8src", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 204 | "libvixl", |
| 205 | "libvixld", |
| 206 | "libz", |
| 207 | "libziparchive", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 208 | "perfetto_trace_protos", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 209 | } |
Paul Duffin | 50cbefd | 2020-03-10 13:44:19 +0000 | [diff] [blame] | 210 | m["com.android.art.debug"] = artApexContents |
| 211 | m["com.android.art.release"] = artApexContents |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 212 | // |
| 213 | // Module separator |
| 214 | // |
| 215 | m["com.android.bluetooth.updatable"] = []string{ |
| 216 | "android.hardware.audio.common@5.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 217 | "android.hardware.bluetooth.a2dp@1.0", |
| 218 | "android.hardware.bluetooth.audio@2.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 219 | "android.hardware.bluetooth@1.0", |
| 220 | "android.hardware.bluetooth@1.1", |
| 221 | "android.hardware.graphics.bufferqueue@1.0", |
| 222 | "android.hardware.graphics.bufferqueue@2.0", |
| 223 | "android.hardware.graphics.common@1.0", |
| 224 | "android.hardware.graphics.common@1.1", |
| 225 | "android.hardware.graphics.common@1.2", |
| 226 | "android.hardware.media@1.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 227 | "android.hidl.safe_union@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 228 | "android.hidl.token@1.0", |
| 229 | "android.hidl.token@1.0-utils", |
| 230 | "avrcp-target-service", |
| 231 | "avrcp_headers", |
| 232 | "bcm_object", |
| 233 | "bluetooth-protos-lite", |
| 234 | "bluetooth.mapsapi", |
| 235 | "com.android.vcard", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 236 | "dnsresolver_aidl_interface-V2-java", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 237 | "fmtlib", |
| 238 | "guava", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 239 | "ipmemorystore-aidl-interfaces-V5-java", |
| 240 | "ipmemorystore-aidl-interfaces-java", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 241 | "internal_include_headers", |
| 242 | "lib-bt-packets", |
| 243 | "lib-bt-packets-avrcp", |
| 244 | "lib-bt-packets-base", |
| 245 | "libFraunhoferAAC", |
| 246 | "libaudio-a2dp-hw-utils", |
| 247 | "libaudio-hearing-aid-hw-utils", |
| 248 | "libbacktrace_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 249 | "libbase", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 250 | "libbase_headers", |
| 251 | "libbinder_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 252 | "libbluetooth", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 253 | "libbluetooth-types", |
| 254 | "libbluetooth-types-header", |
| 255 | "libbluetooth_gd", |
| 256 | "libbluetooth_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 257 | "libbluetooth_jni", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 258 | "libbt-audio-hal-interface", |
| 259 | "libbt-bta", |
| 260 | "libbt-common", |
| 261 | "libbt-hci", |
| 262 | "libbt-platform-protos-lite", |
| 263 | "libbt-protos-lite", |
| 264 | "libbt-sbc-decoder", |
| 265 | "libbt-sbc-encoder", |
| 266 | "libbt-stack", |
| 267 | "libbt-utils", |
| 268 | "libbtcore", |
| 269 | "libbtdevice", |
| 270 | "libbte", |
| 271 | "libbtif", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 272 | "libc++", |
| 273 | "libchrome", |
| 274 | "libcrypto", |
| 275 | "libcutils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 276 | "libcutils_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 277 | "libevent", |
| 278 | "libfmq", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 279 | "libg722codec", |
| 280 | "libgtest_prod", |
| 281 | "libgui_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 282 | "libhidlbase", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 283 | "libhidlbase-impl-internal", |
| 284 | "libhidltransport-impl-internal", |
| 285 | "libhwbinder-impl-internal", |
| 286 | "libjsoncpp", |
| 287 | "liblog_headers", |
| 288 | "libmedia_headers", |
| 289 | "libmodpb64", |
| 290 | "libosi", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 291 | "libprocessgroup", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 292 | "libprocessgroup_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 293 | "libprotobuf-cpp-lite", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 294 | "libprotobuf-java-lite", |
| 295 | "libprotobuf-java-micro", |
| 296 | "libstagefright_foundation_headers", |
| 297 | "libstagefright_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 298 | "libstatslog", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 299 | "libstatssocket", |
| 300 | "libsystem_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 301 | "libtinyxml2", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 302 | "libudrv-uipc", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 303 | "libutils_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 304 | "libz", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 305 | "media_plugin_headers", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 306 | "net-utils-services-common", |
| 307 | "netd_aidl_interface-unstable-java", |
| 308 | "netd_event_listener_interface-java", |
| 309 | "netlink-client", |
| 310 | "networkstack-aidl-interfaces-unstable-java", |
| 311 | "networkstack-client", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 312 | "sap-api-java-static", |
| 313 | "services.net", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 314 | } |
| 315 | // |
| 316 | // Module separator |
| 317 | // |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 318 | m["com.android.cellbroadcast"] = []string{"CellBroadcastApp", "CellBroadcastServiceModule"} |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 319 | // |
| 320 | // Module separator |
| 321 | // |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 322 | m["com.android.conscrypt"] = []string{ |
| 323 | "bcm_object", |
| 324 | "boringssl_self_test", |
| 325 | "libc++", |
| 326 | "libcrypto", |
| 327 | "libnativehelper_header_only", |
| 328 | "libssl", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 329 | "unsupportedappusage", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 330 | } |
| 331 | // |
| 332 | // Module separator |
| 333 | // |
| 334 | m["com.android.extservices"] = []string{ |
| 335 | "flatbuffer_headers", |
| 336 | "liblua", |
| 337 | "libtextclassifier", |
| 338 | "libtextclassifier_hash_static", |
| 339 | "libtflite_static", |
| 340 | "libutf", |
| 341 | "libz_current", |
| 342 | "tensorflow_headers", |
| 343 | } |
| 344 | // |
| 345 | // Module separator |
| 346 | // |
| 347 | m["com.android.cronet"] = []string{ |
| 348 | "cronet_impl_common_java", |
| 349 | "cronet_impl_native_java", |
| 350 | "cronet_impl_platform_java", |
| 351 | "libcronet.80.0.3986.0", |
| 352 | "org.chromium.net.cronet", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 353 | "org.chromium.net.cronet.xml", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 354 | "prebuilt_libcronet.80.0.3986.0", |
| 355 | } |
| 356 | // |
| 357 | // Module separator |
| 358 | // |
| 359 | m["com.android.neuralnetworks"] = []string{ |
| 360 | "android.hardware.neuralnetworks@1.0", |
| 361 | "android.hardware.neuralnetworks@1.1", |
| 362 | "android.hardware.neuralnetworks@1.2", |
| 363 | "android.hardware.neuralnetworks@1.3", |
| 364 | "android.hidl.allocator@1.0", |
| 365 | "android.hidl.memory.token@1.0", |
| 366 | "android.hidl.memory@1.0", |
| 367 | "android.hidl.safe_union@1.0", |
| 368 | "bcm_object", |
| 369 | "fmtlib", |
| 370 | "gemmlowp_headers", |
| 371 | "libarect", |
| 372 | "libbacktrace_headers", |
| 373 | "libbase", |
| 374 | "libbase_headers", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 375 | "libbuildversion", |
| 376 | "libc++", |
| 377 | "libcrypto", |
| 378 | "libcrypto_static", |
| 379 | "libcutils", |
| 380 | "libcutils_headers", |
| 381 | "libeigen", |
| 382 | "libfmq", |
| 383 | "libhidlbase", |
| 384 | "libhidlbase-impl-internal", |
| 385 | "libhidlmemory", |
| 386 | "libhidltransport-impl-internal", |
| 387 | "libhwbinder-impl-internal", |
| 388 | "libjsoncpp", |
| 389 | "liblog_headers", |
| 390 | "libmath", |
| 391 | "libneuralnetworks_common", |
| 392 | "libneuralnetworks_headers", |
| 393 | "libprocessgroup", |
| 394 | "libprocessgroup_headers", |
| 395 | "libprocpartition", |
| 396 | "libsync", |
| 397 | "libsystem_headers", |
| 398 | "libtextclassifier_hash", |
| 399 | "libtextclassifier_hash_headers", |
| 400 | "libtextclassifier_hash_static", |
| 401 | "libtflite_kernel_utils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 402 | "libutils_headers", |
| 403 | "philox_random", |
| 404 | "philox_random_headers", |
| 405 | "tensorflow_headers", |
| 406 | } |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 407 | // |
| 408 | // Module separator |
| 409 | // |
| 410 | m["com.android.media"] = []string{ |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 411 | "android.frameworks.bufferhub@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 412 | "android.hardware.cas.native@1.0", |
| 413 | "android.hardware.cas@1.0", |
| 414 | "android.hardware.configstore-utils", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 415 | "android.hardware.configstore@1.0", |
| 416 | "android.hardware.configstore@1.1", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 417 | "android.hardware.graphics.allocator@2.0", |
| 418 | "android.hardware.graphics.allocator@3.0", |
| 419 | "android.hardware.graphics.bufferqueue@1.0", |
| 420 | "android.hardware.graphics.bufferqueue@2.0", |
| 421 | "android.hardware.graphics.common@1.0", |
| 422 | "android.hardware.graphics.common@1.1", |
| 423 | "android.hardware.graphics.common@1.2", |
| 424 | "android.hardware.graphics.mapper@2.0", |
| 425 | "android.hardware.graphics.mapper@2.1", |
| 426 | "android.hardware.graphics.mapper@3.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 427 | "android.hardware.media.omx@1.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 428 | "android.hardware.media@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 429 | "android.hidl.allocator@1.0", |
| 430 | "android.hidl.memory.token@1.0", |
| 431 | "android.hidl.memory@1.0", |
| 432 | "android.hidl.token@1.0", |
| 433 | "android.hidl.token@1.0-utils", |
| 434 | "bcm_object", |
| 435 | "bionic_libc_platform_headers", |
| 436 | "fmtlib", |
| 437 | "gl_headers", |
| 438 | "libEGL", |
| 439 | "libEGL_blobCache", |
| 440 | "libEGL_getProcAddress", |
| 441 | "libFLAC", |
| 442 | "libFLAC-config", |
| 443 | "libFLAC-headers", |
| 444 | "libGLESv2", |
| 445 | "libaacextractor", |
| 446 | "libamrextractor", |
| 447 | "libarect", |
| 448 | "libasync_safe", |
| 449 | "libaudio_system_headers", |
| 450 | "libaudioclient", |
| 451 | "libaudioclient_headers", |
| 452 | "libaudiofoundation", |
| 453 | "libaudiofoundation_headers", |
| 454 | "libaudiomanager", |
| 455 | "libaudiopolicy", |
| 456 | "libaudioutils", |
| 457 | "libaudioutils_fixedfft", |
| 458 | "libbacktrace", |
| 459 | "libbacktrace_headers", |
| 460 | "libbase", |
| 461 | "libbase_headers", |
| 462 | "libbinder_headers", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 463 | "libbluetooth-types-header", |
| 464 | "libbufferhub", |
| 465 | "libbufferhub_headers", |
| 466 | "libbufferhubqueue", |
| 467 | "libc++", |
| 468 | "libc_headers", |
| 469 | "libc_malloc_debug_backtrace", |
| 470 | "libcamera_client", |
| 471 | "libcamera_metadata", |
| 472 | "libcrypto", |
| 473 | "libcutils", |
| 474 | "libcutils_headers", |
| 475 | "libdexfile_external_headers", |
| 476 | "libdexfile_support", |
| 477 | "libdvr_headers", |
| 478 | "libexpat", |
| 479 | "libfifo", |
| 480 | "libflacextractor", |
| 481 | "libgrallocusage", |
| 482 | "libgraphicsenv", |
| 483 | "libgui", |
| 484 | "libgui_headers", |
| 485 | "libhardware_headers", |
| 486 | "libhidlbase", |
| 487 | "libhidlbase-impl-internal", |
| 488 | "libhidlmemory", |
| 489 | "libhidltransport-impl-internal", |
| 490 | "libhwbinder-impl-internal", |
| 491 | "libinput", |
| 492 | "libjsoncpp", |
| 493 | "liblog_headers", |
| 494 | "liblzma", |
| 495 | "libmath", |
| 496 | "libmedia", |
| 497 | "libmedia_codeclist", |
| 498 | "libmedia_headers", |
| 499 | "libmedia_helper", |
| 500 | "libmedia_helper_headers", |
| 501 | "libmedia_midiiowrapper", |
| 502 | "libmedia_omx", |
| 503 | "libmediautils", |
| 504 | "libmidiextractor", |
| 505 | "libmkvextractor", |
| 506 | "libmp3extractor", |
| 507 | "libmp4extractor", |
| 508 | "libmpeg2extractor", |
| 509 | "libnativebase_headers", |
| 510 | "libnativebridge-headers", |
| 511 | "libnativebridge_lazy", |
| 512 | "libnativeloader-headers", |
| 513 | "libnativeloader_lazy", |
| 514 | "libnativewindow_headers", |
| 515 | "libnblog", |
| 516 | "liboggextractor", |
| 517 | "libpackagelistparser", |
| 518 | "libpcre2", |
| 519 | "libpdx", |
| 520 | "libpdx_default_transport", |
| 521 | "libpdx_headers", |
| 522 | "libpdx_uds", |
| 523 | "libprocessgroup", |
| 524 | "libprocessgroup_headers", |
| 525 | "libprocinfo", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 526 | "libsonivox", |
| 527 | "libspeexresampler", |
| 528 | "libspeexresampler", |
| 529 | "libstagefright_esds", |
| 530 | "libstagefright_flacdec", |
| 531 | "libstagefright_flacdec", |
| 532 | "libstagefright_foundation", |
| 533 | "libstagefright_foundation_headers", |
| 534 | "libstagefright_foundation_without_imemory", |
| 535 | "libstagefright_headers", |
| 536 | "libstagefright_id3", |
| 537 | "libstagefright_metadatautils", |
| 538 | "libstagefright_mpeg2extractor", |
| 539 | "libstagefright_mpeg2support", |
| 540 | "libsync", |
| 541 | "libsystem_headers", |
| 542 | "libui", |
| 543 | "libui_headers", |
| 544 | "libunwindstack", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 545 | "libutils_headers", |
| 546 | "libvibrator", |
| 547 | "libvorbisidec", |
| 548 | "libwavextractor", |
| 549 | "libwebm", |
| 550 | "media_ndk_headers", |
| 551 | "media_plugin_headers", |
| 552 | "updatable-media", |
| 553 | } |
| 554 | // |
| 555 | // Module separator |
| 556 | // |
| 557 | m["com.android.media.swcodec"] = []string{ |
| 558 | "android.frameworks.bufferhub@1.0", |
| 559 | "android.hardware.common-ndk_platform", |
| 560 | "android.hardware.configstore-utils", |
| 561 | "android.hardware.configstore@1.0", |
| 562 | "android.hardware.configstore@1.1", |
| 563 | "android.hardware.graphics.allocator@2.0", |
| 564 | "android.hardware.graphics.allocator@3.0", |
| 565 | "android.hardware.graphics.bufferqueue@1.0", |
| 566 | "android.hardware.graphics.bufferqueue@2.0", |
| 567 | "android.hardware.graphics.common-ndk_platform", |
| 568 | "android.hardware.graphics.common@1.0", |
| 569 | "android.hardware.graphics.common@1.1", |
| 570 | "android.hardware.graphics.common@1.2", |
| 571 | "android.hardware.graphics.mapper@2.0", |
| 572 | "android.hardware.graphics.mapper@2.1", |
| 573 | "android.hardware.graphics.mapper@3.0", |
| 574 | "android.hardware.graphics.mapper@4.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 575 | "android.hardware.media.bufferpool@2.0", |
| 576 | "android.hardware.media.c2@1.0", |
| 577 | "android.hardware.media.omx@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 578 | "android.hardware.media@1.0", |
| 579 | "android.hardware.media@1.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 580 | "android.hidl.memory.token@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 581 | "android.hidl.memory@1.0", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 582 | "android.hidl.safe_union@1.0", |
| 583 | "android.hidl.token@1.0", |
| 584 | "android.hidl.token@1.0-utils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 585 | "fmtlib", |
| 586 | "libEGL", |
| 587 | "libFLAC", |
| 588 | "libFLAC-config", |
| 589 | "libFLAC-headers", |
| 590 | "libFraunhoferAAC", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 591 | "libLibGuiProperties", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 592 | "libarect", |
| 593 | "libasync_safe", |
| 594 | "libaudio_system_headers", |
| 595 | "libaudioutils", |
| 596 | "libaudioutils", |
| 597 | "libaudioutils_fixedfft", |
| 598 | "libavcdec", |
| 599 | "libavcenc", |
| 600 | "libavservices_minijail", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 601 | "libavservices_minijail", |
| 602 | "libbacktrace", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 603 | "libbacktrace_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 604 | "libbase", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 605 | "libbase_headers", |
| 606 | "libbinder_headers", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 607 | "libbinderthreadstateutils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 608 | "libbluetooth-types-header", |
| 609 | "libbufferhub_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 610 | "libc++", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 611 | "libc_scudo", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 612 | "libcap", |
| 613 | "libcodec2", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 614 | "libcodec2_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 615 | "libcodec2_hidl@1.0", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 616 | "libcodec2_hidl@1.1", |
| 617 | "libcodec2_internal", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 618 | "libcodec2_soft_aacdec", |
| 619 | "libcodec2_soft_aacenc", |
| 620 | "libcodec2_soft_amrnbdec", |
| 621 | "libcodec2_soft_amrnbenc", |
| 622 | "libcodec2_soft_amrwbdec", |
| 623 | "libcodec2_soft_amrwbenc", |
| 624 | "libcodec2_soft_av1dec_gav1", |
| 625 | "libcodec2_soft_avcdec", |
| 626 | "libcodec2_soft_avcenc", |
| 627 | "libcodec2_soft_common", |
| 628 | "libcodec2_soft_flacdec", |
| 629 | "libcodec2_soft_flacenc", |
| 630 | "libcodec2_soft_g711alawdec", |
| 631 | "libcodec2_soft_g711mlawdec", |
| 632 | "libcodec2_soft_gsmdec", |
| 633 | "libcodec2_soft_h263dec", |
| 634 | "libcodec2_soft_h263enc", |
| 635 | "libcodec2_soft_hevcdec", |
| 636 | "libcodec2_soft_hevcenc", |
| 637 | "libcodec2_soft_mp3dec", |
| 638 | "libcodec2_soft_mpeg2dec", |
| 639 | "libcodec2_soft_mpeg4dec", |
| 640 | "libcodec2_soft_mpeg4enc", |
| 641 | "libcodec2_soft_opusdec", |
| 642 | "libcodec2_soft_opusenc", |
| 643 | "libcodec2_soft_rawdec", |
| 644 | "libcodec2_soft_vorbisdec", |
| 645 | "libcodec2_soft_vp8dec", |
| 646 | "libcodec2_soft_vp8enc", |
| 647 | "libcodec2_soft_vp9dec", |
| 648 | "libcodec2_soft_vp9enc", |
| 649 | "libcodec2_vndk", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 650 | "libcutils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 651 | "libcutils_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 652 | "libdexfile_support", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 653 | "libdvr_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 654 | "libfmq", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 655 | "libfmq", |
| 656 | "libgav1", |
| 657 | "libgralloctypes", |
| 658 | "libgrallocusage", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 659 | "libgraphicsenv", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 660 | "libgsm", |
| 661 | "libgui_bufferqueue_static", |
| 662 | "libgui_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 663 | "libhardware", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 664 | "libhardware_headers", |
| 665 | "libhevcdec", |
| 666 | "libhevcenc", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 667 | "libhidlbase", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 668 | "libhidlbase-impl-internal", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 669 | "libhidlmemory", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 670 | "libhidltransport-impl-internal", |
| 671 | "libhwbinder-impl-internal", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 672 | "libion", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 673 | "libjpeg", |
| 674 | "libjsoncpp", |
| 675 | "liblog_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 676 | "liblzma", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 677 | "libmath", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 678 | "libmedia_codecserviceregistrant", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 679 | "libmedia_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 680 | "libminijail", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 681 | "libminijail_gen_constants", |
| 682 | "libminijail_gen_constants_obj", |
| 683 | "libminijail_gen_syscall", |
| 684 | "libminijail_gen_syscall_obj", |
| 685 | "libminijail_generated", |
| 686 | "libmpeg2dec", |
| 687 | "libnativebase_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 688 | "libnativebridge_lazy", |
| 689 | "libnativeloader_lazy", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 690 | "libnativewindow_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 691 | "libopus", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 692 | "libpdx_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 693 | "libprocessgroup", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 694 | "libprocessgroup_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 695 | "libscudo_wrapper", |
| 696 | "libsfplugin_ccodec_utils", |
| 697 | "libstagefright_amrnb_common", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 698 | "libstagefright_amrnbdec", |
| 699 | "libstagefright_amrnbenc", |
| 700 | "libstagefright_amrwbdec", |
| 701 | "libstagefright_amrwbenc", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 702 | "libstagefright_bufferpool@2.0.1", |
| 703 | "libstagefright_bufferqueue_helper", |
| 704 | "libstagefright_enc_common", |
| 705 | "libstagefright_flacdec", |
| 706 | "libstagefright_foundation", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 707 | "libstagefright_foundation_headers", |
| 708 | "libstagefright_headers", |
| 709 | "libstagefright_m4vh263dec", |
| 710 | "libstagefright_m4vh263enc", |
| 711 | "libstagefright_mp3dec", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 712 | "libsync", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 713 | "libsystem_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 714 | "libui", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 715 | "libui_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 716 | "libunwindstack", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 717 | "libutils_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 718 | "libvorbisidec", |
| 719 | "libvpx", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 720 | "libyuv", |
| 721 | "libyuv_static", |
| 722 | "media_ndk_headers", |
| 723 | "media_plugin_headers", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 724 | "mediaswcodec", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 725 | } |
| 726 | // |
| 727 | // Module separator |
| 728 | // |
| 729 | m["com.android.mediaprovider"] = []string{ |
| 730 | "MediaProvider", |
| 731 | "MediaProviderGoogle", |
| 732 | "fmtlib_ndk", |
| 733 | "guava", |
| 734 | "libbase_ndk", |
| 735 | "libfuse", |
| 736 | "libfuse_jni", |
| 737 | "libnativehelper_header_only", |
| 738 | } |
| 739 | // |
| 740 | // Module separator |
| 741 | // |
| 742 | m["com.android.permission"] = []string{ |
| 743 | "androidx.annotation_annotation", |
| 744 | "androidx.annotation_annotation-nodeps", |
| 745 | "androidx.lifecycle_lifecycle-common", |
| 746 | "androidx.lifecycle_lifecycle-common-java8", |
| 747 | "androidx.lifecycle_lifecycle-common-java8-nodeps", |
| 748 | "androidx.lifecycle_lifecycle-common-nodeps", |
| 749 | "kotlin-annotations", |
| 750 | "kotlin-stdlib", |
| 751 | "kotlin-stdlib-jdk7", |
| 752 | "kotlin-stdlib-jdk8", |
| 753 | "kotlinx-coroutines-android", |
| 754 | "kotlinx-coroutines-android-nodeps", |
| 755 | "kotlinx-coroutines-core", |
| 756 | "kotlinx-coroutines-core-nodeps", |
| 757 | "libprotobuf-java-lite", |
| 758 | "permissioncontroller-statsd", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 759 | } |
| 760 | // |
| 761 | // Module separator |
| 762 | // |
| 763 | m["com.android.runtime"] = []string{ |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 764 | "bionic_libc_platform_headers", |
| 765 | "fmtlib", |
| 766 | "libarm-optimized-routines-math", |
| 767 | "libasync_safe", |
| 768 | "libasync_safe_headers", |
| 769 | "libbacktrace_headers", |
| 770 | "libbase", |
| 771 | "libbase_headers", |
| 772 | "libc++", |
| 773 | "libc_aeabi", |
| 774 | "libc_bionic", |
| 775 | "libc_bionic_ndk", |
| 776 | "libc_bootstrap", |
| 777 | "libc_common", |
| 778 | "libc_common_shared", |
| 779 | "libc_common_static", |
| 780 | "libc_dns", |
| 781 | "libc_dynamic_dispatch", |
| 782 | "libc_fortify", |
| 783 | "libc_freebsd", |
| 784 | "libc_freebsd_large_stack", |
| 785 | "libc_gdtoa", |
| 786 | "libc_headers", |
| 787 | "libc_init_dynamic", |
| 788 | "libc_init_static", |
| 789 | "libc_jemalloc_wrapper", |
| 790 | "libc_netbsd", |
| 791 | "libc_nomalloc", |
| 792 | "libc_nopthread", |
| 793 | "libc_openbsd", |
| 794 | "libc_openbsd_large_stack", |
| 795 | "libc_openbsd_ndk", |
| 796 | "libc_pthread", |
| 797 | "libc_static_dispatch", |
| 798 | "libc_syscalls", |
| 799 | "libc_tzcode", |
| 800 | "libc_unwind_static", |
| 801 | "libcutils", |
| 802 | "libcutils_headers", |
| 803 | "libdebuggerd", |
| 804 | "libdebuggerd_common_headers", |
| 805 | "libdebuggerd_handler_core", |
| 806 | "libdebuggerd_handler_fallback", |
| 807 | "libdexfile_external_headers", |
| 808 | "libdexfile_support", |
| 809 | "libdexfile_support_static", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 810 | "libdl_static", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 811 | "libgtest_prod", |
| 812 | "libjemalloc5", |
| 813 | "liblinker_main", |
| 814 | "liblinker_malloc", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 815 | "liblog_headers", |
| 816 | "liblz4", |
| 817 | "liblzma", |
| 818 | "libprocessgroup_headers", |
| 819 | "libprocinfo", |
| 820 | "libpropertyinfoparser", |
| 821 | "libscudo", |
| 822 | "libstdc++", |
| 823 | "libsystem_headers", |
| 824 | "libsystemproperties", |
| 825 | "libtombstoned_client_static", |
| 826 | "libunwindstack", |
| 827 | "libutils_headers", |
| 828 | "libz", |
| 829 | "libziparchive", |
| 830 | } |
| 831 | // |
| 832 | // Module separator |
| 833 | // |
| 834 | m["com.android.resolv"] = []string{ |
| 835 | "bcm_object", |
| 836 | "dnsresolver_aidl_interface-unstable-ndk_platform", |
| 837 | "fmtlib", |
| 838 | "libbacktrace_headers", |
| 839 | "libbase", |
| 840 | "libbase_headers", |
| 841 | "libc++", |
| 842 | "libcrypto", |
| 843 | "libcutils", |
| 844 | "libcutils_headers", |
| 845 | "libgtest_prod", |
| 846 | "libjsoncpp", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 847 | "liblog_headers", |
| 848 | "libnativehelper_header_only", |
| 849 | "libnetd_client_headers", |
| 850 | "libnetd_resolv", |
| 851 | "libnetdutils", |
| 852 | "libprocessgroup", |
| 853 | "libprocessgroup_headers", |
| 854 | "libprotobuf-cpp-lite", |
| 855 | "libssl", |
| 856 | "libstatslog_resolv", |
| 857 | "libstatspush_compat", |
| 858 | "libstatssocket", |
| 859 | "libstatssocket_headers", |
| 860 | "libsystem_headers", |
| 861 | "libsysutils", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 862 | "libutils_headers", |
| 863 | "netd_event_listener_interface-ndk_platform", |
| 864 | "server_configurable_flags", |
| 865 | "stats_proto", |
| 866 | } |
| 867 | // |
| 868 | // Module separator |
| 869 | // |
| 870 | m["com.android.tethering"] = []string{ |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 871 | "libbase", |
| 872 | "libc++", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 873 | "libnativehelper_compat_libc++", |
| 874 | "android.hardware.tetheroffload.config@1.0", |
| 875 | "fmtlib", |
| 876 | "libbacktrace_headers", |
| 877 | "libbase_headers", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 878 | "libcgrouprc", |
| 879 | "libcgrouprc_format", |
| 880 | "libcutils", |
| 881 | "libcutils_headers", |
| 882 | "libhidlbase", |
| 883 | "libhidlbase-impl-internal", |
| 884 | "libhidltransport-impl-internal", |
| 885 | "libhwbinder-impl-internal", |
| 886 | "libjsoncpp", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 887 | "liblog_headers", |
| 888 | "libprocessgroup", |
| 889 | "libprocessgroup_headers", |
| 890 | "libsystem_headers", |
| 891 | "libtetherutilsjni", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 892 | "libutils_headers", |
| 893 | "libvndksupport", |
| 894 | "tethering-aidl-interfaces-java", |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 895 | } |
| 896 | // |
| 897 | // Module separator |
| 898 | // |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 899 | m["com.android.wifi"] = []string{ |
| 900 | "PlatformProperties", |
| 901 | "android.hardware.wifi-V1.0-java", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 902 | "android.hardware.wifi-V1.0-java-constants", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 903 | "android.hardware.wifi-V1.1-java", |
| 904 | "android.hardware.wifi-V1.2-java", |
| 905 | "android.hardware.wifi-V1.3-java", |
| 906 | "android.hardware.wifi-V1.4-java", |
| 907 | "android.hardware.wifi.hostapd-V1.0-java", |
| 908 | "android.hardware.wifi.hostapd-V1.1-java", |
| 909 | "android.hardware.wifi.hostapd-V1.2-java", |
| 910 | "android.hardware.wifi.supplicant-V1.0-java", |
| 911 | "android.hardware.wifi.supplicant-V1.1-java", |
| 912 | "android.hardware.wifi.supplicant-V1.2-java", |
| 913 | "android.hardware.wifi.supplicant-V1.3-java", |
| 914 | "android.hidl.base-V1.0-java", |
| 915 | "android.hidl.manager-V1.0-java", |
| 916 | "android.hidl.manager-V1.1-java", |
| 917 | "android.hidl.manager-V1.2-java", |
| 918 | "androidx.annotation_annotation", |
| 919 | "androidx.annotation_annotation-nodeps", |
| 920 | "bouncycastle-unbundled", |
| 921 | "dnsresolver_aidl_interface-V2-java", |
| 922 | "error_prone_annotations", |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 923 | "framework-wifi-pre-jarjar", |
| 924 | "framework-wifi-util-lib", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 925 | "ipmemorystore-aidl-interfaces-V3-java", |
| 926 | "ipmemorystore-aidl-interfaces-java", |
| 927 | "ksoap2", |
| 928 | "libbacktrace_headers", |
| 929 | "libbase", |
| 930 | "libbase_headers", |
| 931 | "libc++", |
| 932 | "libcutils", |
| 933 | "libcutils_headers", |
| 934 | "liblog_headers", |
| 935 | "libnanohttpd", |
| 936 | "libprocessgroup", |
| 937 | "libprocessgroup_headers", |
| 938 | "libprotobuf-java-lite", |
| 939 | "libprotobuf-java-nano", |
| 940 | "libsystem_headers", |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 941 | "libutils_headers", |
| 942 | "libwifi-jni", |
| 943 | "net-utils-services-common", |
| 944 | "netd_aidl_interface-V2-java", |
| 945 | "netd_aidl_interface-unstable-java", |
| 946 | "netd_event_listener_interface-java", |
| 947 | "netlink-client", |
| 948 | "networkstack-aidl-interfaces-unstable-java", |
| 949 | "networkstack-client", |
| 950 | "services.net", |
| 951 | "wifi-lite-protos", |
| 952 | "wifi-nano-protos", |
| 953 | "wifi-service-pre-jarjar", |
| 954 | "wifi-service-resources", |
| 955 | "prebuilt_androidx.annotation_annotation-nodeps", |
| 956 | } |
| 957 | // |
| 958 | // Module separator |
| 959 | // |
| 960 | m["com.android.sdkext"] = []string{ |
| 961 | "fmtlib_ndk", |
| 962 | "libbase_ndk", |
| 963 | "libprotobuf-cpp-lite-ndk", |
| 964 | } |
| 965 | // |
| 966 | // Module separator |
| 967 | // |
| 968 | m["com.android.os.statsd"] = []string{ |
| 969 | "libbacktrace_headers", |
| 970 | "libbase_headers", |
| 971 | "libc++", |
| 972 | "libcutils", |
| 973 | "libcutils_headers", |
| 974 | "liblog_headers", |
| 975 | "libprocessgroup_headers", |
| 976 | "libstatssocket", |
| 977 | "libsystem_headers", |
| 978 | "libutils_headers", |
| 979 | } |
| 980 | // |
| 981 | // Module separator |
| 982 | // |
Paul Duffin | 7d74e7b | 2020-03-06 12:30:13 +0000 | [diff] [blame] | 983 | m[android.AvailableToAnyApex] = []string{ |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 984 | "crtbegin_dynamic", |
| 985 | "crtbegin_dynamic1", |
| 986 | "crtbegin_so", |
| 987 | "crtbegin_so1", |
| 988 | "crtbegin_static", |
| 989 | "crtbrand", |
| 990 | "crtend_android", |
| 991 | "crtend_so", |
| 992 | "libatomic", |
| 993 | "libc++_static", |
| 994 | "libc++abi", |
| 995 | "libc++demangle", |
| 996 | "libc_headers", |
| 997 | "libclang_rt", |
| 998 | "libgcc_stripped", |
| 999 | "libprofile-clang-extras", |
| 1000 | "libprofile-clang-extras_ndk", |
| 1001 | "libprofile-extras", |
| 1002 | "libprofile-extras_ndk", |
| 1003 | "libunwind_llvm", |
| 1004 | "ndk_crtbegin_dynamic.27", |
| 1005 | "ndk_crtbegin_so.16", |
| 1006 | "ndk_crtbegin_so.19", |
| 1007 | "ndk_crtbegin_so.21", |
| 1008 | "ndk_crtbegin_so.24", |
| 1009 | "ndk_crtbegin_so.27", |
| 1010 | "ndk_crtend_android.27", |
| 1011 | "ndk_crtend_so.16", |
| 1012 | "ndk_crtend_so.19", |
| 1013 | "ndk_crtend_so.21", |
| 1014 | "ndk_crtend_so.24", |
| 1015 | "ndk_crtend_so.27", |
| 1016 | "ndk_libandroid_support", |
| 1017 | "ndk_libc++_static", |
| 1018 | "ndk_libc++abi", |
| 1019 | "ndk_libunwind", |
| 1020 | } |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 1021 | return m |
| 1022 | } |
| 1023 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1024 | func init() { |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1025 | android.RegisterModuleType("apex", BundleFactory) |
Alex Light | 0851b88 | 2019-02-07 13:20:53 -0800 | [diff] [blame] | 1026 | android.RegisterModuleType("apex_test", testApexBundleFactory) |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1027 | android.RegisterModuleType("apex_vndk", vndkApexBundleFactory) |
Jiyong Park | 30ca937 | 2019-02-07 16:27:23 +0900 | [diff] [blame] | 1028 | android.RegisterModuleType("apex_defaults", defaultsFactory) |
Jaewoong Jung | 939ebd5 | 2019-03-26 15:07:36 -0700 | [diff] [blame] | 1029 | android.RegisterModuleType("prebuilt_apex", PrebuiltFactory) |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1030 | android.RegisterModuleType("override_apex", overrideApexFactory) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1031 | |
Jooyung Han | 31c470b | 2019-10-18 16:26:59 +0900 | [diff] [blame] | 1032 | android.PreDepsMutators(RegisterPreDepsMutators) |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1033 | android.PostDepsMutators(RegisterPostDepsMutators) |
Jooyung Han | 7a78a92 | 2019-10-08 21:59:58 +0900 | [diff] [blame] | 1034 | |
| 1035 | android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) { |
| 1036 | apexFileContextsInfos := apexFileContextsInfos(ctx.Config()) |
| 1037 | sort.Strings(*apexFileContextsInfos) |
| 1038 | ctx.Strict("APEX_FILE_CONTEXTS_INFOS", strings.Join(*apexFileContextsInfos, " ")) |
| 1039 | }) |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1040 | } |
| 1041 | |
Jooyung Han | 31c470b | 2019-10-18 16:26:59 +0900 | [diff] [blame] | 1042 | func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) { |
| 1043 | ctx.TopDown("apex_vndk", apexVndkMutator).Parallel() |
| 1044 | ctx.BottomUp("apex_vndk_deps", apexVndkDepsMutator).Parallel() |
| 1045 | } |
| 1046 | |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1047 | func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) { |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1048 | ctx.TopDown("apex_deps", apexDepsMutator) |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1049 | ctx.BottomUp("apex", apexMutator).Parallel() |
| 1050 | ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel() |
| 1051 | ctx.BottomUp("apex_uses", apexUsesMutator).Parallel() |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1052 | } |
| 1053 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1054 | // Mark the direct and transitive dependencies of apex bundles so that they |
| 1055 | // can be built for the apex bundles. |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1056 | func apexDepsMutator(mctx android.TopDownMutatorContext) { |
Peter Collingbourne | dc4f986 | 2020-02-12 17:13:25 -0800 | [diff] [blame] | 1057 | var apexBundles []android.ApexInfo |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1058 | var directDep bool |
Jooyung Han | a57af4a | 2020-01-23 05:36:59 +0000 | [diff] [blame] | 1059 | if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 1060 | apexBundles = []android.ApexInfo{android.ApexInfo{ |
Jooyung Han | 5417f77 | 2020-03-12 18:37:20 +0900 | [diff] [blame] | 1061 | ApexName: mctx.ModuleName(), |
| 1062 | MinSdkVersion: a.minSdkVersion(mctx), |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 1063 | }} |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1064 | directDep = true |
| 1065 | } else if am, ok := mctx.Module().(android.ApexModule); ok { |
Peter Collingbourne | dc4f986 | 2020-02-12 17:13:25 -0800 | [diff] [blame] | 1066 | apexBundles = am.ApexVariations() |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1067 | directDep = false |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1068 | } |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1069 | |
Peter Collingbourne | dc4f986 | 2020-02-12 17:13:25 -0800 | [diff] [blame] | 1070 | if len(apexBundles) == 0 { |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1071 | return |
| 1072 | } |
| 1073 | |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 1074 | cur := mctx.Module().(interface { |
| 1075 | DepIsInSameApex(android.BaseModuleContext, android.Module) bool |
| 1076 | }) |
| 1077 | |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1078 | mctx.VisitDirectDeps(func(child android.Module) { |
| 1079 | depName := mctx.OtherModuleName(child) |
| 1080 | if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 1081 | cur.DepIsInSameApex(mctx, child) { |
Peter Collingbourne | dc4f986 | 2020-02-12 17:13:25 -0800 | [diff] [blame] | 1082 | android.UpdateApexDependency(apexBundles, depName, directDep) |
| 1083 | am.BuildForApexes(apexBundles) |
Jiyong Park | f760cae | 2020-02-12 07:53:12 +0900 | [diff] [blame] | 1084 | } |
| 1085 | }) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1086 | } |
| 1087 | |
| 1088 | // Create apex variations if a module is included in APEX(s). |
| 1089 | func apexMutator(mctx android.BottomUpMutatorContext) { |
| 1090 | if am, ok := mctx.Module().(android.ApexModule); ok && am.CanHaveApexVariants() { |
Jiyong Park | 0ddfcd1 | 2018-12-11 01:35:25 +0900 | [diff] [blame] | 1091 | am.CreateApexVariations(mctx) |
Jooyung Han | a57af4a | 2020-01-23 05:36:59 +0000 | [diff] [blame] | 1092 | } else if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex { |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1093 | // apex bundle itself is mutated so that it and its modules have same |
| 1094 | // apex variant. |
| 1095 | apexBundleName := mctx.ModuleName() |
| 1096 | mctx.CreateVariations(apexBundleName) |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1097 | } else if o, ok := mctx.Module().(*OverrideApex); ok { |
| 1098 | apexBundleName := o.GetOverriddenModuleName() |
| 1099 | if apexBundleName == "" { |
| 1100 | mctx.ModuleErrorf("base property is not set") |
| 1101 | return |
| 1102 | } |
| 1103 | mctx.CreateVariations(apexBundleName) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1104 | } |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1105 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1106 | } |
Sundong Ahn | e9b5572 | 2019-09-06 17:37:42 +0900 | [diff] [blame] | 1107 | |
Jooyung Han | 7a78a92 | 2019-10-08 21:59:58 +0900 | [diff] [blame] | 1108 | var ( |
| 1109 | apexFileContextsInfosKey = android.NewOnceKey("apexFileContextsInfosKey") |
| 1110 | apexFileContextsInfosMutex sync.Mutex |
| 1111 | ) |
| 1112 | |
| 1113 | func apexFileContextsInfos(config android.Config) *[]string { |
| 1114 | return config.Once(apexFileContextsInfosKey, func() interface{} { |
| 1115 | return &[]string{} |
| 1116 | }).(*[]string) |
| 1117 | } |
| 1118 | |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 1119 | func addFlattenedFileContextsInfos(ctx android.BaseModuleContext, fileContextsInfo string) { |
Jooyung Han | 7a78a92 | 2019-10-08 21:59:58 +0900 | [diff] [blame] | 1120 | apexFileContextsInfosMutex.Lock() |
| 1121 | defer apexFileContextsInfosMutex.Unlock() |
| 1122 | apexFileContextsInfos := apexFileContextsInfos(ctx.Config()) |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 1123 | *apexFileContextsInfos = append(*apexFileContextsInfos, fileContextsInfo) |
Jooyung Han | 7a78a92 | 2019-10-08 21:59:58 +0900 | [diff] [blame] | 1124 | } |
| 1125 | |
Sundong Ahn | e9b5572 | 2019-09-06 17:37:42 +0900 | [diff] [blame] | 1126 | func apexFlattenedMutator(mctx android.BottomUpMutatorContext) { |
Sundong Ahn | e8fb724 | 2019-09-17 13:50:45 +0900 | [diff] [blame] | 1127 | if ab, ok := mctx.Module().(*apexBundle); ok { |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1128 | var variants []string |
| 1129 | switch proptools.StringDefault(ab.properties.Payload_type, "image") { |
| 1130 | case "image": |
| 1131 | variants = append(variants, imageApexType, flattenedApexType) |
| 1132 | case "zip": |
| 1133 | variants = append(variants, zipApexType) |
| 1134 | case "both": |
| 1135 | variants = append(variants, imageApexType, zipApexType, flattenedApexType) |
| 1136 | default: |
Sundong Ahn | d95aa2d | 2019-10-08 19:34:03 +0900 | [diff] [blame] | 1137 | mctx.PropertyErrorf("type", "%q is not one of \"image\", \"zip\", or \"both\".", *ab.properties.Payload_type) |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1138 | return |
| 1139 | } |
| 1140 | |
| 1141 | modules := mctx.CreateLocalVariations(variants...) |
| 1142 | |
| 1143 | for i, v := range variants { |
| 1144 | switch v { |
| 1145 | case imageApexType: |
| 1146 | modules[i].(*apexBundle).properties.ApexType = imageApex |
| 1147 | case zipApexType: |
| 1148 | modules[i].(*apexBundle).properties.ApexType = zipApex |
| 1149 | case flattenedApexType: |
| 1150 | modules[i].(*apexBundle).properties.ApexType = flattenedApex |
Jooyung Han | 91df208 | 2019-11-20 01:49:42 +0900 | [diff] [blame] | 1151 | if !mctx.Config().FlattenApex() && ab.Platform() { |
Sundong Ahn | d95aa2d | 2019-10-08 19:34:03 +0900 | [diff] [blame] | 1152 | modules[i].(*apexBundle).MakeAsSystemExt() |
| 1153 | } |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1154 | } |
Sundong Ahn | e9b5572 | 2019-09-06 17:37:42 +0900 | [diff] [blame] | 1155 | } |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1156 | } else if _, ok := mctx.Module().(*OverrideApex); ok { |
| 1157 | mctx.CreateVariations(imageApexType, flattenedApexType) |
Sundong Ahn | e9b5572 | 2019-09-06 17:37:42 +0900 | [diff] [blame] | 1158 | } |
| 1159 | } |
| 1160 | |
Jooyung Han | 5c998b9 | 2019-06-27 11:30:33 +0900 | [diff] [blame] | 1161 | func apexUsesMutator(mctx android.BottomUpMutatorContext) { |
| 1162 | if ab, ok := mctx.Module().(*apexBundle); ok { |
| 1163 | mctx.AddFarVariationDependencies(nil, usesTag, ab.properties.Uses...) |
| 1164 | } |
| 1165 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1166 | |
Jooyung Han | dc78244 | 2019-11-01 03:14:38 +0900 | [diff] [blame] | 1167 | var ( |
| 1168 | useVendorWhitelistKey = android.NewOnceKey("useVendorWhitelist") |
| 1169 | ) |
| 1170 | |
| 1171 | // useVendorWhitelist returns the list of APEXes which are allowed to use_vendor. |
| 1172 | // When use_vendor is used, native modules are built with __ANDROID_VNDK__ and __ANDROID_APEX__, |
| 1173 | // which may cause compatibility issues. (e.g. libbinder) |
| 1174 | // Even though libbinder restricts its availability via 'apex_available' property and relies on |
| 1175 | // yet another macro __ANDROID_APEX_<NAME>__, we restrict usage of "use_vendor:" from other APEX modules |
| 1176 | // to avoid similar problems. |
| 1177 | func useVendorWhitelist(config android.Config) []string { |
| 1178 | return config.Once(useVendorWhitelistKey, func() interface{} { |
| 1179 | return []string{ |
| 1180 | // swcodec uses "vendor" variants for smaller size |
| 1181 | "com.android.media.swcodec", |
| 1182 | "test_com.android.media.swcodec", |
| 1183 | } |
| 1184 | }).([]string) |
| 1185 | } |
| 1186 | |
| 1187 | // setUseVendorWhitelistForTest overrides useVendorWhitelist and must be |
| 1188 | // called before the first call to useVendorWhitelist() |
| 1189 | func setUseVendorWhitelistForTest(config android.Config, whitelist []string) { |
| 1190 | config.Once(useVendorWhitelistKey, func() interface{} { |
| 1191 | return whitelist |
| 1192 | }) |
| 1193 | } |
| 1194 | |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1195 | type ApexNativeDependencies struct { |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1196 | // List of native libraries |
| 1197 | Native_shared_libs []string |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1198 | |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1199 | // List of JNI libraries |
| 1200 | Jni_libs []string |
| 1201 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1202 | // List of native executables |
| 1203 | Binaries []string |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1204 | |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 1205 | // List of native tests |
| 1206 | Tests []string |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1207 | } |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1208 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1209 | type apexMultilibProperties struct { |
| 1210 | // Native dependencies whose compile_multilib is "first" |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1211 | First ApexNativeDependencies |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1212 | |
| 1213 | // Native dependencies whose compile_multilib is "both" |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1214 | Both ApexNativeDependencies |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1215 | |
| 1216 | // Native dependencies whose compile_multilib is "prefer32" |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1217 | Prefer32 ApexNativeDependencies |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1218 | |
| 1219 | // Native dependencies whose compile_multilib is "32" |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1220 | Lib32 ApexNativeDependencies |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1221 | |
| 1222 | // Native dependencies whose compile_multilib is "64" |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1223 | Lib64 ApexNativeDependencies |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1224 | } |
| 1225 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1226 | type apexBundleProperties struct { |
| 1227 | // Json manifest file describing meta info of this APEX bundle. Default: |
Dario Freni | 4abb1dc | 2018-11-20 18:04:58 +0000 | [diff] [blame] | 1228 | // "apex_manifest.json" |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 1229 | Manifest *string `android:"path"` |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1230 | |
Jiyong Park | 40e26a2 | 2019-02-08 02:53:06 +0900 | [diff] [blame] | 1231 | // AndroidManifest.xml file used for the zip container of this APEX bundle. |
| 1232 | // If unspecified, a default one is automatically generated. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 1233 | AndroidManifest *string `android:"path"` |
Jiyong Park | 40e26a2 | 2019-02-08 02:53:06 +0900 | [diff] [blame] | 1234 | |
Roland Levillain | 411c584 | 2019-09-19 16:37:20 +0100 | [diff] [blame] | 1235 | // Canonical name of the APEX bundle. Used to determine the path to the activated APEX on |
| 1236 | // device (/apex/<apex_name>). |
| 1237 | // If unspecified, defaults to the value of name. |
Jiyong Park | 05e70dd | 2019-03-18 14:26:32 +0900 | [diff] [blame] | 1238 | Apex_name *string |
| 1239 | |
Jiyong Park | d0a65ba | 2018-11-10 06:37:15 +0900 | [diff] [blame] | 1240 | // Determines the file contexts file for setting security context to each file in this APEX bundle. |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 1241 | // For platform APEXes, this should points to a file under /system/sepolicy |
| 1242 | // Default: /system/sepolicy/apex/<module_name>_file_contexts. |
| 1243 | File_contexts *string `android:"path"` |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1244 | |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1245 | ApexNativeDependencies |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1246 | |
| 1247 | // List of java libraries that are embedded inside this APEX bundle |
| 1248 | Java_libs []string |
| 1249 | |
| 1250 | // List of prebuilt files that are embedded inside this APEX bundle |
| 1251 | Prebuilts []string |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 1252 | |
| 1253 | // Name of the apex_key module that provides the private key to sign APEX |
| 1254 | Key *string |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1255 | |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1256 | // The type of APEX to build. Controls what the APEX payload is. Either |
| 1257 | // 'image', 'zip' or 'both'. Default: 'image'. |
| 1258 | Payload_type *string |
| 1259 | |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 1260 | // The name of a certificate in the default certificate directory, blank to use the default product certificate, |
| 1261 | // or an android_app_certificate module name in the form ":module". |
| 1262 | Certificate *string |
| 1263 | |
Jiyong Park | 92c0f9c | 2018-12-13 23:14:57 +0900 | [diff] [blame] | 1264 | // Whether this APEX is installable to one of the partitions. Default: true. |
| 1265 | Installable *bool |
| 1266 | |
Jiyong Park | da6eb59 | 2018-12-19 17:12:36 +0900 | [diff] [blame] | 1267 | // For native libraries and binaries, use the vendor variant instead of the core (platform) variant. |
| 1268 | // Default is false. |
| 1269 | Use_vendor *bool |
| 1270 | |
Alex Light | fc0bd7c | 2019-01-29 18:31:59 -0800 | [diff] [blame] | 1271 | // For telling the apex to ignore special handling for system libraries such as bionic. Default is false. |
| 1272 | Ignore_system_library_special_case *bool |
| 1273 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1274 | Multilib apexMultilibProperties |
Jiyong Park | 235e67c | 2019-02-09 11:50:56 +0900 | [diff] [blame] | 1275 | |
Jiyong Park | f97782b | 2019-02-13 20:28:58 +0900 | [diff] [blame] | 1276 | // List of sanitizer names that this APEX is enabled for |
| 1277 | SanitizerNames []string `blueprint:"mutated"` |
Jooyung Han | 5c998b9 | 2019-06-27 11:30:33 +0900 | [diff] [blame] | 1278 | |
Jiyong Park | ee9a98d | 2019-08-09 14:44:36 +0900 | [diff] [blame] | 1279 | PreventInstall bool `blueprint:"mutated"` |
| 1280 | |
| 1281 | HideFromMake bool `blueprint:"mutated"` |
| 1282 | |
Jooyung Han | 5c998b9 | 2019-06-27 11:30:33 +0900 | [diff] [blame] | 1283 | // Indicates this APEX provides C++ shared libaries to other APEXes. Default: false. |
| 1284 | Provide_cpp_shared_libs *bool |
| 1285 | |
| 1286 | // List of providing APEXes' names so that this APEX can depend on provided shared libraries. |
| 1287 | Uses []string |
Nikita Ioffe | 5d5ae76 | 2019-08-31 14:38:05 +0100 | [diff] [blame] | 1288 | |
| 1289 | // A txt file containing list of files that are whitelisted to be included in this APEX. |
| 1290 | Whitelisted_files *string |
Sundong Ahn | e1f05aa | 2019-08-27 13:55:42 +0900 | [diff] [blame] | 1291 | |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1292 | // package format of this apex variant; could be non-flattened, flattened, or zip. |
| 1293 | // imageApex, zipApex or flattened |
| 1294 | ApexType apexPackaging `blueprint:"mutated"` |
Sundong Ahn | e8fb724 | 2019-09-17 13:50:45 +0900 | [diff] [blame] | 1295 | |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1296 | // List of SDKs that are used to build this APEX. A reference to an SDK should be either |
| 1297 | // `name#version` or `name` which is an alias for `name#current`. If left empty, `platform#current` |
| 1298 | // is implied. This value affects all modules included in this APEX. In other words, they are |
| 1299 | // also built with the SDKs specified here. |
| 1300 | Uses_sdks []string |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1301 | |
Nikita Ioffe | c72b5dd | 2019-12-07 17:30:22 +0000 | [diff] [blame] | 1302 | // Whenever apex_payload.img of the APEX should include dm-verity hashtree. |
| 1303 | // Should be only used in tests#. |
| 1304 | Test_only_no_hashtree *bool |
Jooyung Han | 214bf37 | 2019-11-12 13:03:50 +0900 | [diff] [blame] | 1305 | |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 1306 | IsCoverageVariant bool `blueprint:"mutated"` |
Jiyong Park | 9d67720 | 2020-02-19 16:29:35 +0900 | [diff] [blame] | 1307 | |
| 1308 | // Whether this APEX is considered updatable or not. When set to true, this will enforce additional |
| 1309 | // rules for making sure that the APEX is truely updatable. This will also disable the size optimizations |
| 1310 | // like symlinking to the system libs. Default is false. |
| 1311 | Updatable *bool |
Colin Cross | 5031787 | 2020-02-19 20:41:10 -0800 | [diff] [blame] | 1312 | |
| 1313 | // The minimum SDK version that this apex must be compatibile with. |
| 1314 | Min_sdk_version *string |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1315 | } |
| 1316 | |
| 1317 | type apexTargetBundleProperties struct { |
| 1318 | Target struct { |
| 1319 | // Multilib properties only for android. |
| 1320 | Android struct { |
| 1321 | Multilib apexMultilibProperties |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1322 | } |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1323 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1324 | // Multilib properties only for host. |
| 1325 | Host struct { |
| 1326 | Multilib apexMultilibProperties |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1327 | } |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1328 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1329 | // Multilib properties only for host linux_bionic. |
| 1330 | Linux_bionic struct { |
| 1331 | Multilib apexMultilibProperties |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1332 | } |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 1333 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1334 | // Multilib properties only for host linux_glibc. |
| 1335 | Linux_glibc struct { |
| 1336 | Multilib apexMultilibProperties |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1337 | } |
| 1338 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1339 | } |
| 1340 | |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1341 | type overridableProperties struct { |
| 1342 | // List of APKs to package inside APEX |
| 1343 | Apps []string |
Jaewoong Jung | 7abcf8e | 2019-12-19 17:32:06 -0800 | [diff] [blame] | 1344 | |
| 1345 | // Names of modules to be overridden. Listed modules can only be other binaries |
| 1346 | // (in Make or Soong). |
| 1347 | // This does not completely prevent installation of the overridden binaries, but if both |
| 1348 | // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed |
| 1349 | // from PRODUCT_PACKAGES. |
| 1350 | Overrides []string |
Baligh Uddin | 004d717 | 2020-02-19 21:29:28 -0800 | [diff] [blame] | 1351 | |
| 1352 | // Logging Parent value |
| 1353 | Logging_parent string |
Baligh Uddin | 5b57dba | 2020-03-15 13:01:05 -0700 | [diff] [blame] | 1354 | |
| 1355 | // Apex Container Package Name. |
| 1356 | // Override value for attribute package:name in AndroidManifest.xml |
| 1357 | Package_name string |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1358 | } |
| 1359 | |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1360 | type apexPackaging int |
| 1361 | |
| 1362 | const ( |
| 1363 | imageApex apexPackaging = iota |
| 1364 | zipApex |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1365 | flattenedApex |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1366 | ) |
| 1367 | |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1368 | // The suffix for the output "file", not the module |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1369 | func (a apexPackaging) suffix() string { |
| 1370 | switch a { |
| 1371 | case imageApex: |
| 1372 | return imageApexSuffix |
| 1373 | case zipApex: |
| 1374 | return zipApexSuffix |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1375 | default: |
Roland Levillain | 4644b22 | 2019-07-31 14:09:17 +0100 | [diff] [blame] | 1376 | panic(fmt.Errorf("unknown APEX type %d", a)) |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | func (a apexPackaging) name() string { |
| 1381 | switch a { |
| 1382 | case imageApex: |
| 1383 | return imageApexType |
| 1384 | case zipApex: |
| 1385 | return zipApexType |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1386 | default: |
Roland Levillain | 4644b22 | 2019-07-31 14:09:17 +0100 | [diff] [blame] | 1387 | panic(fmt.Errorf("unknown APEX type %d", a)) |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 1388 | } |
| 1389 | } |
| 1390 | |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1391 | type apexFileClass int |
| 1392 | |
| 1393 | const ( |
| 1394 | etc apexFileClass = iota |
| 1395 | nativeSharedLib |
| 1396 | nativeExecutable |
| 1397 | shBinary |
| 1398 | pyBinary |
| 1399 | goBinary |
| 1400 | javaSharedLib |
| 1401 | nativeTest |
| 1402 | app |
| 1403 | ) |
| 1404 | |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1405 | func (class apexFileClass) NameInMake() string { |
| 1406 | switch class { |
| 1407 | case etc: |
| 1408 | return "ETC" |
| 1409 | case nativeSharedLib: |
| 1410 | return "SHARED_LIBRARIES" |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 1411 | case nativeExecutable, shBinary, pyBinary, goBinary: |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1412 | return "EXECUTABLES" |
| 1413 | case javaSharedLib: |
| 1414 | return "JAVA_LIBRARIES" |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 1415 | case nativeTest: |
| 1416 | return "NATIVE_TESTS" |
Sundong Ahn | e1f05aa | 2019-08-27 13:55:42 +0900 | [diff] [blame] | 1417 | case app: |
Jiyong Park | f383f7c | 2019-10-11 20:46:25 +0900 | [diff] [blame] | 1418 | // b/142537672 Why isn't this APP? We want to have full control over |
| 1419 | // the paths and file names of the apk file under the flattend APEX. |
| 1420 | // If this is set to APP, then the paths and file names are modified |
| 1421 | // by the Make build system. For example, it is installed to |
| 1422 | // /system/apex/<apexname>/app/<Appname>/<apexname>.<Appname>/ instead of |
| 1423 | // /system/apex/<apexname>/app/<Appname> because the build system automatically |
| 1424 | // appends module name (which is <apexname>.<Appname> to the path. |
| 1425 | return "ETC" |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1426 | default: |
Roland Levillain | 4644b22 | 2019-07-31 14:09:17 +0100 | [diff] [blame] | 1427 | panic(fmt.Errorf("unknown class %d", class)) |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1428 | } |
| 1429 | } |
| 1430 | |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1431 | // apexFile represents a file in an APEX bundle |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1432 | type apexFile struct { |
| 1433 | builtFile android.Path |
| 1434 | moduleName string |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1435 | installDir string |
| 1436 | class apexFileClass |
Jiyong Park | a889484 | 2018-12-19 17:36:39 +0900 | [diff] [blame] | 1437 | module android.Module |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1438 | // list of symlinks that will be created in installDir that point to this apexFile |
| 1439 | symlinks []string |
| 1440 | transitiveDep bool |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1441 | moduleDir string |
Jiyong Park | 7afd107 | 2019-12-30 16:56:33 +0900 | [diff] [blame] | 1442 | |
| 1443 | requiredModuleNames []string |
| 1444 | targetRequiredModuleNames []string |
| 1445 | hostRequiredModuleNames []string |
Jiyong Park | 618922e | 2020-01-08 13:35:43 +0900 | [diff] [blame] | 1446 | |
Colin Cross | 503c1d0 | 2020-01-28 14:00:53 -0800 | [diff] [blame] | 1447 | jacocoReportClassesFile android.Path // only for javalibs and apps |
| 1448 | certificate java.Certificate // only for apps |
Jiyong Park | cfaa164 | 2020-02-28 16:51:07 +0900 | [diff] [blame] | 1449 | overriddenPackageName string // only for apps |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1450 | |
| 1451 | isJniLib bool |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1452 | } |
| 1453 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1454 | func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile { |
| 1455 | ret := apexFile{ |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1456 | builtFile: builtFile, |
| 1457 | moduleName: moduleName, |
| 1458 | installDir: installDir, |
| 1459 | class: class, |
| 1460 | module: module, |
| 1461 | } |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1462 | if module != nil { |
| 1463 | ret.moduleDir = ctx.OtherModuleDir(module) |
Jiyong Park | 7afd107 | 2019-12-30 16:56:33 +0900 | [diff] [blame] | 1464 | ret.requiredModuleNames = module.RequiredModuleNames() |
| 1465 | ret.targetRequiredModuleNames = module.TargetRequiredModuleNames() |
| 1466 | ret.hostRequiredModuleNames = module.HostRequiredModuleNames() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1467 | } |
| 1468 | return ret |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1469 | } |
| 1470 | |
| 1471 | func (af *apexFile) Ok() bool { |
Jiyong Park | 479321d | 2019-12-16 11:47:12 +0900 | [diff] [blame] | 1472 | return af.builtFile != nil && af.builtFile.String() != "" |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1473 | } |
| 1474 | |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 1475 | // Path() returns path of this apex file relative to the APEX root |
| 1476 | func (af *apexFile) Path() string { |
| 1477 | return filepath.Join(af.installDir, af.builtFile.Base()) |
| 1478 | } |
| 1479 | |
| 1480 | // SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root |
| 1481 | func (af *apexFile) SymlinkPaths() []string { |
| 1482 | var ret []string |
| 1483 | for _, symlink := range af.symlinks { |
| 1484 | ret = append(ret, filepath.Join(af.installDir, symlink)) |
| 1485 | } |
| 1486 | return ret |
| 1487 | } |
| 1488 | |
| 1489 | func (af *apexFile) AvailableToPlatform() bool { |
| 1490 | if af.module == nil { |
| 1491 | return false |
| 1492 | } |
| 1493 | if am, ok := af.module.(android.ApexModule); ok { |
| 1494 | return am.AvailableFor(android.AvailableToPlatform) |
| 1495 | } |
| 1496 | return false |
| 1497 | } |
| 1498 | |
Jiyong Park | 678c881 | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 1499 | type depInfo struct { |
| 1500 | to string |
| 1501 | from []string |
| 1502 | isExternal bool |
| 1503 | } |
| 1504 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1505 | type apexBundle struct { |
| 1506 | android.ModuleBase |
| 1507 | android.DefaultableModuleBase |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1508 | android.OverridableModuleBase |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1509 | android.SdkBase |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1510 | |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1511 | properties apexBundleProperties |
| 1512 | targetProperties apexTargetBundleProperties |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1513 | overridableProperties overridableProperties |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1514 | |
Jooyung Han | f21c797 | 2019-12-16 22:32:06 +0900 | [diff] [blame] | 1515 | // specific to apex_vndk modules |
| 1516 | vndkProperties apexVndkProperties |
| 1517 | |
Colin Cross | a492590 | 2018-11-16 11:36:28 -0800 | [diff] [blame] | 1518 | bundleModuleFile android.WritablePath |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1519 | outputFile android.WritablePath |
Colin Cross | 70dda7e | 2019-10-01 22:05:35 -0700 | [diff] [blame] | 1520 | installDir android.InstallPath |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1521 | |
Jiyong Park | 03b68dd | 2019-07-26 23:20:40 +0900 | [diff] [blame] | 1522 | prebuiltFileToDelete string |
| 1523 | |
Jiyong Park | 42cca6c | 2019-04-01 11:15:50 +0900 | [diff] [blame] | 1524 | public_key_file android.Path |
| 1525 | private_key_file android.Path |
Jiyong Park | 0ca3ce8 | 2019-02-18 15:25:04 +0900 | [diff] [blame] | 1526 | |
| 1527 | container_certificate_file android.Path |
| 1528 | container_private_key_file android.Path |
| 1529 | |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 1530 | fileContexts android.Path |
| 1531 | |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 1532 | // list of files to be included in this apex |
| 1533 | filesInfo []apexFile |
| 1534 | |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 1535 | // list of module names that should be installed along with this APEX |
| 1536 | requiredDeps []string |
| 1537 | |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 1538 | // list of module names that this APEX is including (to be shown via *-deps-info target) |
Jiyong Park | 678c881 | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 1539 | depInfos map[string]depInfo |
Jiyong Park | ac2bacd | 2019-02-20 21:49:26 +0900 | [diff] [blame] | 1540 | |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1541 | testApex bool |
| 1542 | vndkApex bool |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 1543 | artApex bool |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1544 | primaryApexType bool |
Jooyung Han | e163303 | 2019-08-01 17:41:43 +0900 | [diff] [blame] | 1545 | |
Jooyung Han | 214bf37 | 2019-11-12 13:03:50 +0900 | [diff] [blame] | 1546 | manifestJsonOut android.WritablePath |
| 1547 | manifestPbOut android.WritablePath |
Jooyung Han | 72bd2f8 | 2019-10-23 16:46:38 +0900 | [diff] [blame] | 1548 | |
Jooyung Han | 002ab68 | 2020-01-08 01:57:58 +0900 | [diff] [blame] | 1549 | // list of commands to create symlinks for backward compatibility. |
Jooyung Han | 72bd2f8 | 2019-10-23 16:46:38 +0900 | [diff] [blame] | 1550 | // these commands will be attached as LOCAL_POST_INSTALL_CMD to |
Jooyung Han | 002ab68 | 2020-01-08 01:57:58 +0900 | [diff] [blame] | 1551 | // apex package itself(for unflattened build) or apex_manifest(for flattened build) |
Jooyung Han | 72bd2f8 | 2019-10-23 16:46:38 +0900 | [diff] [blame] | 1552 | // so that compat symlinks are always installed regardless of TARGET_FLATTEN_APEX setting. |
| 1553 | compatSymlinks []string |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1554 | |
| 1555 | // Suffix of module name in Android.mk |
| 1556 | // ".flattened", ".apex", ".zipapex", or "" |
| 1557 | suffix string |
Jiyong Park | 3a1602e | 2020-01-14 14:39:19 +0900 | [diff] [blame] | 1558 | |
| 1559 | installedFilesFile android.WritablePath |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 1560 | |
| 1561 | // Whether to create symlink to the system file instead of having a file |
| 1562 | // inside the apex or not |
| 1563 | linkToSystemLib bool |
Jiyong Park | 19972c7 | 2020-01-28 20:05:29 +0900 | [diff] [blame] | 1564 | |
| 1565 | // Struct holding the merged notice file paths in different formats |
| 1566 | mergedNotices android.NoticeOutputs |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1567 | } |
| 1568 | |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1569 | func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1570 | nativeModules ApexNativeDependencies, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1571 | target android.Target, imageVariation string) { |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1572 | // Use *FarVariation* to be able to depend on modules having |
| 1573 | // conflicting variations with this module. This is required since |
| 1574 | // arch variant of an APEX bundle is 'common' but it is 'arm' or 'arm64' |
| 1575 | // for native shared libs. |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1576 | ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{ |
Jiyong Park | da6eb59 | 2018-12-19 17:12:36 +0900 | [diff] [blame] | 1577 | {Mutator: "image", Variation: imageVariation}, |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1578 | {Mutator: "link", Variation: "shared"}, |
Jiyong Park | 28d395a | 2018-12-07 22:42:47 +0900 | [diff] [blame] | 1579 | {Mutator: "version", Variation: ""}, // "" is the non-stub variant |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1580 | }...), sharedLibTag, nativeModules.Native_shared_libs...) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1581 | |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1582 | ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{ |
| 1583 | {Mutator: "image", Variation: imageVariation}, |
| 1584 | {Mutator: "link", Variation: "shared"}, |
| 1585 | {Mutator: "version", Variation: ""}, // "" is the non-stub variant |
| 1586 | }...), jniLibTag, nativeModules.Jni_libs...) |
| 1587 | |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1588 | ctx.AddFarVariationDependencies(append(target.Variations(), |
| 1589 | blueprint.Variation{Mutator: "image", Variation: imageVariation}), |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1590 | executableTag, nativeModules.Binaries...) |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 1591 | |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1592 | ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{ |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 1593 | {Mutator: "image", Variation: imageVariation}, |
Roland Levillain | 9b5fde9 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 1594 | {Mutator: "test_per_src", Variation: ""}, // "" is the all-tests variant |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1595 | }...), testTag, nativeModules.Tests...) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1596 | } |
| 1597 | |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1598 | func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) { |
| 1599 | if ctx.Os().Class == android.Device { |
| 1600 | proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Android.Multilib, nil) |
| 1601 | } else { |
| 1602 | proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Host.Multilib, nil) |
| 1603 | if ctx.Os().Bionic() { |
| 1604 | proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_bionic.Multilib, nil) |
| 1605 | } else { |
| 1606 | proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_glibc.Multilib, nil) |
| 1607 | } |
| 1608 | } |
| 1609 | } |
| 1610 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1611 | func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { |
Jooyung Han | dc78244 | 2019-11-01 03:14:38 +0900 | [diff] [blame] | 1612 | if proptools.Bool(a.properties.Use_vendor) && !android.InList(a.Name(), useVendorWhitelist(ctx.Config())) { |
| 1613 | ctx.PropertyErrorf("use_vendor", "not allowed to set use_vendor: true") |
| 1614 | } |
| 1615 | |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1616 | targets := ctx.MultiTargets() |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1617 | config := ctx.DeviceConfig() |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 1618 | |
| 1619 | a.combineProperties(ctx) |
| 1620 | |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1621 | has32BitTarget := false |
| 1622 | for _, target := range targets { |
| 1623 | if target.Arch.ArchType.Multilib == "lib32" { |
| 1624 | has32BitTarget = true |
| 1625 | } |
| 1626 | } |
| 1627 | for i, target := range targets { |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1628 | // When multilib.* is omitted for native_shared_libs/jni_libs/tests, it implies |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1629 | // multilib.both |
| 1630 | addDependenciesForNativeModules(ctx, |
| 1631 | ApexNativeDependencies{ |
| 1632 | Native_shared_libs: a.properties.Native_shared_libs, |
| 1633 | Tests: a.properties.Tests, |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1634 | Jni_libs: a.properties.Jni_libs, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1635 | Binaries: nil, |
| 1636 | }, |
| 1637 | target, a.getImageVariation(config)) |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 1638 | |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1639 | // Add native modules targetting both ABIs |
| 1640 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1641 | a.properties.Multilib.Both, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1642 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1643 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1644 | |
Alex Light | 3d67359 | 2019-01-18 14:37:31 -0800 | [diff] [blame] | 1645 | isPrimaryAbi := i == 0 |
| 1646 | if isPrimaryAbi { |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1647 | // When multilib.* is omitted for binaries, it implies |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1648 | // multilib.first |
| 1649 | addDependenciesForNativeModules(ctx, |
| 1650 | ApexNativeDependencies{ |
| 1651 | Native_shared_libs: nil, |
| 1652 | Tests: nil, |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1653 | Jni_libs: nil, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1654 | Binaries: a.properties.Binaries, |
| 1655 | }, |
| 1656 | target, a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1657 | |
| 1658 | // Add native modules targetting the first ABI |
| 1659 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1660 | a.properties.Multilib.First, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1661 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1662 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1663 | } |
| 1664 | |
| 1665 | switch target.Arch.ArchType.Multilib { |
| 1666 | case "lib32": |
| 1667 | // Add native modules targetting 32-bit ABI |
| 1668 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1669 | a.properties.Multilib.Lib32, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1670 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1671 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1672 | |
| 1673 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1674 | a.properties.Multilib.Prefer32, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1675 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1676 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1677 | case "lib64": |
| 1678 | // Add native modules targetting 64-bit ABI |
| 1679 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1680 | a.properties.Multilib.Lib64, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1681 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1682 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1683 | |
| 1684 | if !has32BitTarget { |
| 1685 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1686 | a.properties.Multilib.Prefer32, |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1687 | target, |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1688 | a.getImageVariation(config)) |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1689 | } |
Peter Collingbourne | 3478bb2 | 2019-04-24 14:41:12 -0700 | [diff] [blame] | 1690 | |
| 1691 | if strings.HasPrefix(ctx.ModuleName(), "com.android.runtime") && target.Os.Class == android.Device { |
| 1692 | for _, sanitizer := range ctx.Config().SanitizeDevice() { |
| 1693 | if sanitizer == "hwaddress" { |
| 1694 | addDependenciesForNativeModules(ctx, |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 1695 | ApexNativeDependencies{[]string{"libclang_rt.hwasan-aarch64-android"}, nil, nil, nil}, |
Jooyung Han | 01a868d | 2020-02-27 13:40:44 +0900 | [diff] [blame] | 1696 | target, a.getImageVariation(config)) |
Peter Collingbourne | 3478bb2 | 2019-04-24 14:41:12 -0700 | [diff] [blame] | 1697 | break |
| 1698 | } |
| 1699 | } |
| 1700 | } |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 1701 | } |
| 1702 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1703 | } |
| 1704 | |
Jiyong Park | ce6aadc | 2019-11-20 13:58:28 +0900 | [diff] [blame] | 1705 | // For prebuilt_etc, use the first variant (64 on 64/32bit device, |
| 1706 | // 32 on 32bit device) regardless of the TARGET_PREFER_* setting. |
| 1707 | // b/144532908 |
| 1708 | archForPrebuiltEtc := config.Arches()[0] |
| 1709 | for _, arch := range config.Arches() { |
| 1710 | // Prefer 64-bit arch if there is any |
| 1711 | if arch.ArchType.Multilib == "lib64" { |
| 1712 | archForPrebuiltEtc = arch |
| 1713 | break |
| 1714 | } |
| 1715 | } |
| 1716 | ctx.AddFarVariationDependencies([]blueprint.Variation{ |
| 1717 | {Mutator: "os", Variation: ctx.Os().String()}, |
| 1718 | {Mutator: "arch", Variation: archForPrebuiltEtc.String()}, |
| 1719 | }, prebuiltTag, a.properties.Prebuilts...) |
| 1720 | |
Colin Cross | 0f7d2ef | 2019-10-16 11:03:10 -0700 | [diff] [blame] | 1721 | ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), |
| 1722 | javaLibTag, a.properties.Java_libs...) |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 1723 | |
Ulya Trafimovich | 4456188 | 2020-01-03 13:25:54 +0000 | [diff] [blame] | 1724 | // With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library. |
| 1725 | if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { |
| 1726 | ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), |
| 1727 | javaLibTag, "jacocoagent") |
| 1728 | } |
| 1729 | |
Jiyong Park | 23c52b0 | 2019-02-02 13:13:47 +0900 | [diff] [blame] | 1730 | if String(a.properties.Key) == "" { |
| 1731 | ctx.ModuleErrorf("key is missing") |
| 1732 | return |
| 1733 | } |
| 1734 | ctx.AddDependency(ctx.Module(), keyTag, String(a.properties.Key)) |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 1735 | |
Jiyong Park | b2742fd | 2019-02-11 11:38:15 +0900 | [diff] [blame] | 1736 | cert := android.SrcIsModule(a.getCertString(ctx)) |
Jiyong Park | 23c52b0 | 2019-02-02 13:13:47 +0900 | [diff] [blame] | 1737 | if cert != "" { |
| 1738 | ctx.AddDependency(ctx.Module(), certificateTag, cert) |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 1739 | } |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 1740 | |
| 1741 | // TODO(jiyong): ensure that all apexes are with non-empty uses_sdks |
| 1742 | if len(a.properties.Uses_sdks) > 0 { |
| 1743 | sdkRefs := []android.SdkRef{} |
| 1744 | for _, str := range a.properties.Uses_sdks { |
| 1745 | parsed := android.ParseSdkRef(ctx, str, "uses_sdks") |
| 1746 | sdkRefs = append(sdkRefs, parsed) |
| 1747 | } |
| 1748 | a.BuildWithSdks(sdkRefs) |
| 1749 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1750 | } |
| 1751 | |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 1752 | func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) { |
| 1753 | ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), |
| 1754 | androidAppTag, a.overridableProperties.Apps...) |
| 1755 | } |
| 1756 | |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 1757 | func (a *apexBundle) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { |
| 1758 | // direct deps of an APEX bundle are all part of the APEX bundle |
| 1759 | return true |
| 1760 | } |
| 1761 | |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 1762 | func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string { |
Jooyung Han | 27151d9 | 2019-12-16 17:45:32 +0900 | [diff] [blame] | 1763 | moduleName := ctx.ModuleName() |
| 1764 | // VNDK APEXes share the same certificate. To avoid adding a new VNDK version to the OVERRIDE_* list, |
| 1765 | // we check with the pseudo module name to see if its certificate is overridden. |
| 1766 | if a.vndkApex { |
| 1767 | moduleName = vndkApexName |
| 1768 | } |
| 1769 | certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(moduleName) |
Jiyong Park | b2742fd | 2019-02-11 11:38:15 +0900 | [diff] [blame] | 1770 | if overridden { |
Jaewoong Jung | acb6db3 | 2019-02-28 16:22:30 +0000 | [diff] [blame] | 1771 | return ":" + certificate |
Jiyong Park | b2742fd | 2019-02-11 11:38:15 +0900 | [diff] [blame] | 1772 | } |
| 1773 | return String(a.properties.Certificate) |
| 1774 | } |
| 1775 | |
Colin Cross | 41955e8 | 2019-05-29 14:40:35 -0700 | [diff] [blame] | 1776 | func (a *apexBundle) OutputFiles(tag string) (android.Paths, error) { |
| 1777 | switch tag { |
| 1778 | case "": |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 1779 | return android.Paths{a.outputFile}, nil |
Colin Cross | 41955e8 | 2019-05-29 14:40:35 -0700 | [diff] [blame] | 1780 | default: |
| 1781 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) |
Jiyong Park | 5a83202 | 2018-12-20 09:54:35 +0900 | [diff] [blame] | 1782 | } |
Jiyong Park | 74e240b | 2018-11-27 21:27:08 +0900 | [diff] [blame] | 1783 | } |
| 1784 | |
Jiyong Park | 92c0f9c | 2018-12-13 23:14:57 +0900 | [diff] [blame] | 1785 | func (a *apexBundle) installable() bool { |
Jiyong Park | ee9a98d | 2019-08-09 14:44:36 +0900 | [diff] [blame] | 1786 | return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable)) |
Jiyong Park | 92c0f9c | 2018-12-13 23:14:57 +0900 | [diff] [blame] | 1787 | } |
| 1788 | |
Nikita Ioffe | c72b5dd | 2019-12-07 17:30:22 +0000 | [diff] [blame] | 1789 | func (a *apexBundle) testOnlyShouldSkipHashtreeGeneration() bool { |
| 1790 | return proptools.Bool(a.properties.Test_only_no_hashtree) |
| 1791 | } |
| 1792 | |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1793 | func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { |
Jooyung Han | 31c470b | 2019-10-18 16:26:59 +0900 | [diff] [blame] | 1794 | if a.vndkApex { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 1795 | return cc.VendorVariationPrefix + a.vndkVersion(config) |
Jooyung Han | 31c470b | 2019-10-18 16:26:59 +0900 | [diff] [blame] | 1796 | } |
Jiyong Park | 7c1dc61 | 2019-01-05 11:15:24 +0900 | [diff] [blame] | 1797 | if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 1798 | return cc.VendorVariationPrefix + config.PlatformVndkVersion() |
Jiyong Park | da6eb59 | 2018-12-19 17:12:36 +0900 | [diff] [blame] | 1799 | } else { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 1800 | return android.CoreVariation |
Jiyong Park | da6eb59 | 2018-12-19 17:12:36 +0900 | [diff] [blame] | 1801 | } |
| 1802 | } |
| 1803 | |
Jiyong Park | f97782b | 2019-02-13 20:28:58 +0900 | [diff] [blame] | 1804 | func (a *apexBundle) EnableSanitizer(sanitizerName string) { |
| 1805 | if !android.InList(sanitizerName, a.properties.SanitizerNames) { |
| 1806 | a.properties.SanitizerNames = append(a.properties.SanitizerNames, sanitizerName) |
| 1807 | } |
| 1808 | } |
| 1809 | |
Jiyong Park | 388ef3f | 2019-01-28 19:47:32 +0900 | [diff] [blame] | 1810 | func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool { |
Jiyong Park | f97782b | 2019-02-13 20:28:58 +0900 | [diff] [blame] | 1811 | if android.InList(sanitizerName, a.properties.SanitizerNames) { |
| 1812 | return true |
Jiyong Park | 235e67c | 2019-02-09 11:50:56 +0900 | [diff] [blame] | 1813 | } |
| 1814 | |
| 1815 | // Then follow the global setting |
Jiyong Park | 388ef3f | 2019-01-28 19:47:32 +0900 | [diff] [blame] | 1816 | globalSanitizerNames := []string{} |
| 1817 | if a.Host() { |
| 1818 | globalSanitizerNames = ctx.Config().SanitizeHost() |
| 1819 | } else { |
| 1820 | arches := ctx.Config().SanitizeDeviceArch() |
| 1821 | if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) { |
| 1822 | globalSanitizerNames = ctx.Config().SanitizeDevice() |
| 1823 | } |
| 1824 | } |
| 1825 | return android.InList(sanitizerName, globalSanitizerNames) |
Jiyong Park | 379de2f | 2018-12-19 02:47:14 +0900 | [diff] [blame] | 1826 | } |
| 1827 | |
Jiyong Park | ee9a98d | 2019-08-09 14:44:36 +0900 | [diff] [blame] | 1828 | func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool { |
Oliver Nguyen | 1382ab6 | 2019-12-06 15:22:41 -0800 | [diff] [blame] | 1829 | return ctx.Device() && (ctx.DeviceConfig().NativeCoverageEnabled() || ctx.DeviceConfig().ClangCoverageEnabled()) |
Jiyong Park | ee9a98d | 2019-08-09 14:44:36 +0900 | [diff] [blame] | 1830 | } |
| 1831 | |
| 1832 | func (a *apexBundle) PreventInstall() { |
| 1833 | a.properties.PreventInstall = true |
| 1834 | } |
| 1835 | |
| 1836 | func (a *apexBundle) HideFromMake() { |
| 1837 | a.properties.HideFromMake = true |
| 1838 | } |
| 1839 | |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 1840 | func (a *apexBundle) MarkAsCoverageVariant(coverage bool) { |
| 1841 | a.properties.IsCoverageVariant = coverage |
| 1842 | } |
| 1843 | |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1844 | // TODO(jiyong) move apexFileFor* close to the apexFile type definition |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1845 | func apexFileForNativeLibrary(ctx android.BaseModuleContext, ccMod *cc.Module, handleSpecialLibs bool) apexFile { |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1846 | // Decide the APEX-local directory by the multilib of the library |
| 1847 | // In the future, we may query this to the module. |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1848 | var dirInApex string |
Martin Stjernholm | 279de57 | 2019-09-10 23:18:20 +0100 | [diff] [blame] | 1849 | switch ccMod.Arch().ArchType.Multilib { |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1850 | case "lib32": |
| 1851 | dirInApex = "lib" |
| 1852 | case "lib64": |
| 1853 | dirInApex = "lib64" |
| 1854 | } |
Colin Cross | 3b19f5d | 2019-09-17 14:45:31 -0700 | [diff] [blame] | 1855 | if ccMod.Target().NativeBridge == android.NativeBridgeEnabled { |
Martin Stjernholm | 279de57 | 2019-09-10 23:18:20 +0100 | [diff] [blame] | 1856 | dirInApex = filepath.Join(dirInApex, ccMod.Target().NativeBridgeRelativePath) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1857 | } |
Jooyung Han | 35155c4 | 2020-02-06 17:33:20 +0900 | [diff] [blame] | 1858 | dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath()) |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1859 | if handleSpecialLibs && cc.InstallToBootstrap(ccMod.BaseModuleName(), ctx.Config()) { |
Martin Stjernholm | 279de57 | 2019-09-10 23:18:20 +0100 | [diff] [blame] | 1860 | // Special case for Bionic libs and other libs installed with them. This is |
| 1861 | // to prevent those libs from being included in the search path |
| 1862 | // /apex/com.android.runtime/${LIB}. This exclusion is required because |
| 1863 | // those libs in the Runtime APEX are available via the legacy paths in |
| 1864 | // /system/lib/. By the init process, the libs in the APEX are bind-mounted |
| 1865 | // to the legacy paths and thus will be loaded into the default linker |
| 1866 | // namespace (aka "platform" namespace). If the libs are directly in |
| 1867 | // /apex/com.android.runtime/${LIB} then the same libs will be loaded again |
| 1868 | // into the runtime linker namespace, which will result in double loading of |
| 1869 | // them, which isn't supported. |
| 1870 | dirInApex = filepath.Join(dirInApex, "bionic") |
Jiyong Park | b078857 | 2018-12-20 22:10:17 +0900 | [diff] [blame] | 1871 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1872 | |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1873 | fileToCopy := ccMod.OutputFile().Path() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1874 | return newApexFile(ctx, fileToCopy, ccMod.Name(), dirInApex, nativeSharedLib, ccMod) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1875 | } |
| 1876 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1877 | func apexFileForExecutable(ctx android.BaseModuleContext, cc *cc.Module) apexFile { |
Jooyung Han | 35155c4 | 2020-02-06 17:33:20 +0900 | [diff] [blame] | 1878 | dirInApex := "bin" |
Colin Cross | 3b19f5d | 2019-09-17 14:45:31 -0700 | [diff] [blame] | 1879 | if cc.Target().NativeBridge == android.NativeBridgeEnabled { |
dimitry | 8d6dde8 | 2019-07-11 10:23:53 +0200 | [diff] [blame] | 1880 | dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath) |
Jiyong Park | acbf6c7 | 2019-07-09 16:19:16 +0900 | [diff] [blame] | 1881 | } |
Jooyung Han | 35155c4 | 2020-02-06 17:33:20 +0900 | [diff] [blame] | 1882 | dirInApex = filepath.Join(dirInApex, cc.RelativeInstallPath()) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1883 | fileToCopy := cc.OutputFile().Path() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1884 | af := newApexFile(ctx, fileToCopy, cc.Name(), dirInApex, nativeExecutable, cc) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1885 | af.symlinks = cc.Symlinks() |
| 1886 | return af |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1887 | } |
| 1888 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1889 | func apexFileForPyBinary(ctx android.BaseModuleContext, py *python.Module) apexFile { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1890 | dirInApex := "bin" |
| 1891 | fileToCopy := py.HostToolPath().Path() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1892 | return newApexFile(ctx, fileToCopy, py.Name(), dirInApex, pyBinary, py) |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 1893 | } |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1894 | func apexFileForGoBinary(ctx android.BaseModuleContext, depName string, gb bootstrap.GoBinaryTool) apexFile { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1895 | dirInApex := "bin" |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 1896 | s, err := filepath.Rel(android.PathForOutput(ctx).String(), gb.InstallPath()) |
| 1897 | if err != nil { |
| 1898 | ctx.ModuleErrorf("Unable to use compiled binary at %s", gb.InstallPath()) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1899 | return apexFile{} |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 1900 | } |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1901 | fileToCopy := android.PathForOutput(ctx, s) |
| 1902 | // NB: Since go binaries are static we don't need the module for anything here, which is |
| 1903 | // good since the go tool is a blueprint.Module not an android.Module like we would |
| 1904 | // normally use. |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1905 | return newApexFile(ctx, fileToCopy, depName, dirInApex, goBinary, nil) |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 1906 | } |
| 1907 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1908 | func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) apexFile { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1909 | dirInApex := filepath.Join("bin", sh.SubDir()) |
| 1910 | fileToCopy := sh.OutputFile() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1911 | af := newApexFile(ctx, fileToCopy, sh.Name(), dirInApex, shBinary, sh) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1912 | af.symlinks = sh.Symlinks() |
| 1913 | return af |
Jiyong Park | 04480cf | 2019-02-06 00:16:29 +0900 | [diff] [blame] | 1914 | } |
| 1915 | |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 1916 | // TODO(b/146586360): replace javaLibrary(in apex/apex.go) with java.Dependency |
| 1917 | type javaLibrary interface { |
| 1918 | android.Module |
| 1919 | java.Dependency |
| 1920 | } |
| 1921 | |
| 1922 | func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1923 | dirInApex := "javalib" |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 1924 | fileToCopy := lib.DexJar() |
Jiyong Park | 618922e | 2020-01-08 13:35:43 +0900 | [diff] [blame] | 1925 | af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib) |
| 1926 | af.jacocoReportClassesFile = lib.JacocoReportClassesFile() |
| 1927 | return af |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1928 | } |
| 1929 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1930 | func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1931 | dirInApex := filepath.Join("etc", prebuilt.SubDir()) |
| 1932 | fileToCopy := prebuilt.OutputFile() |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1933 | return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, prebuilt) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 1934 | } |
| 1935 | |
atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 1936 | func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.PlatformCompatConfigIntf, depName string) apexFile { |
| 1937 | dirInApex := filepath.Join("etc", config.SubDir()) |
| 1938 | fileToCopy := config.CompatConfig() |
| 1939 | return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, config) |
| 1940 | } |
| 1941 | |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 1942 | func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1943 | android.Module |
| 1944 | Privileged() bool |
| 1945 | OutputFile() android.Path |
Jiyong Park | 618922e | 2020-01-08 13:35:43 +0900 | [diff] [blame] | 1946 | JacocoReportClassesFile() android.Path |
Colin Cross | 503c1d0 | 2020-01-28 14:00:53 -0800 | [diff] [blame] | 1947 | Certificate() java.Certificate |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1948 | }, pkgName string) apexFile { |
Jiyong Park | f748731 | 2019-10-17 12:54:30 +0900 | [diff] [blame] | 1949 | appDir := "app" |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1950 | if aapp.Privileged() { |
Jiyong Park | f748731 | 2019-10-17 12:54:30 +0900 | [diff] [blame] | 1951 | appDir = "priv-app" |
| 1952 | } |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 1953 | dirInApex := filepath.Join(appDir, pkgName) |
| 1954 | fileToCopy := aapp.OutputFile() |
Jiyong Park | 618922e | 2020-01-08 13:35:43 +0900 | [diff] [blame] | 1955 | af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp) |
| 1956 | af.jacocoReportClassesFile = aapp.JacocoReportClassesFile() |
Colin Cross | 503c1d0 | 2020-01-28 14:00:53 -0800 | [diff] [blame] | 1957 | af.certificate = aapp.Certificate() |
Jiyong Park | cfaa164 | 2020-02-28 16:51:07 +0900 | [diff] [blame] | 1958 | |
| 1959 | if app, ok := aapp.(interface { |
| 1960 | OverriddenManifestPackageName() string |
| 1961 | }); ok { |
| 1962 | af.overriddenPackageName = app.OverriddenManifestPackageName() |
| 1963 | } |
Jiyong Park | 618922e | 2020-01-08 13:35:43 +0900 | [diff] [blame] | 1964 | return af |
Dario Freni | cde2a03 | 2019-10-27 00:29:22 +0100 | [diff] [blame] | 1965 | } |
| 1966 | |
Roland Levillain | 935639d | 2019-08-13 14:55:28 +0100 | [diff] [blame] | 1967 | // Context "decorator", overriding the InstallBypassMake method to always reply `true`. |
| 1968 | type flattenedApexContext struct { |
| 1969 | android.ModuleContext |
| 1970 | } |
| 1971 | |
| 1972 | func (c *flattenedApexContext) InstallBypassMake() bool { |
| 1973 | return true |
| 1974 | } |
| 1975 | |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 1976 | // Visit dependencies that contributes to the payload of this APEX |
| 1977 | func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext, |
| 1978 | do func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool)) { |
Paul Duffin | df915ff | 2020-03-30 17:58:21 +0100 | [diff] [blame] | 1979 | ctx.WalkDeps(func(child, parent android.Module) bool { |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 1980 | am, ok := child.(android.ApexModule) |
| 1981 | if !ok || !am.CanHaveApexVariants() { |
| 1982 | return false |
| 1983 | } |
| 1984 | |
| 1985 | // Check for the direct dependencies that contribute to the payload |
| 1986 | if dt, ok := ctx.OtherModuleDependencyTag(child).(dependencyTag); ok { |
| 1987 | if dt.payload { |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 1988 | do(ctx, parent, am, false /* externalDep */) |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 1989 | return true |
| 1990 | } |
| 1991 | return false |
| 1992 | } |
| 1993 | |
| 1994 | // Check for the indirect dependencies if it is considered as part of the APEX |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 1995 | if am.ApexName() != "" { |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 1996 | do(ctx, parent, am, false /* externalDep */) |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 1997 | return true |
| 1998 | } |
| 1999 | |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2000 | do(ctx, parent, am, true /* externalDep */) |
| 2001 | |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 2002 | // As soon as the dependency graph crosses the APEX boundary, don't go further. |
| 2003 | return false |
| 2004 | }) |
| 2005 | } |
| 2006 | |
Jooyung Han | 03b5185 | 2020-02-26 22:45:42 +0900 | [diff] [blame] | 2007 | func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) int { |
| 2008 | ver := proptools.StringDefault(a.properties.Min_sdk_version, "current") |
| 2009 | if ver != "current" { |
| 2010 | minSdkVersion, err := strconv.Atoi(ver) |
| 2011 | if err != nil { |
| 2012 | ctx.PropertyErrorf("min_sdk_version", "should be \"current\" or <number>, but %q", ver) |
| 2013 | } |
| 2014 | return minSdkVersion |
| 2015 | } |
| 2016 | return android.FutureApiLevel |
| 2017 | } |
| 2018 | |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2019 | // Ensures that the dependencies are marked as available for this APEX |
| 2020 | func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { |
| 2021 | // Let's be practical. Availability for test, host, and the VNDK apex isn't important |
| 2022 | if ctx.Host() || a.testApex || a.vndkApex { |
| 2023 | return |
| 2024 | } |
| 2025 | |
Jiyong Park | 58d1090 | 2020-03-28 14:43:19 +0900 | [diff] [blame] | 2026 | // Coverage build adds additional dependencies for the coverage-only runtime libraries. |
| 2027 | // Requiring them and their transitive depencies with apex_available is not right |
| 2028 | // because they just add noise. |
| 2029 | if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT") || a.IsNativeCoverageNeeded(ctx) { |
| 2030 | return |
| 2031 | } |
| 2032 | |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2033 | a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { |
| 2034 | apexName := ctx.ModuleName() |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 2035 | fromName := ctx.OtherModuleName(from) |
| 2036 | toName := ctx.OtherModuleName(to) |
| 2037 | if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) { |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2038 | return |
| 2039 | } |
Paul Duffin | df915ff | 2020-03-30 17:58:21 +0100 | [diff] [blame] | 2040 | message := "" |
| 2041 | for _, m := range ctx.GetWalkPath()[1:] { |
| 2042 | message = fmt.Sprintf("%s\n -> %s", message, m.String()) |
| 2043 | } |
| 2044 | ctx.ModuleErrorf("%q requires %q that is not available for the APEX. Dependency path:%s", fromName, toName, message) |
Jiyong Park | 201cedd | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2045 | }) |
| 2046 | } |
| 2047 | |
Jiyong Park | 678c881 | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2048 | // Collects the list of module names that directly or indirectly contributes to the payload of this APEX |
| 2049 | func (a *apexBundle) collectDepsInfo(ctx android.ModuleContext) { |
| 2050 | a.depInfos = make(map[string]depInfo) |
| 2051 | a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) { |
| 2052 | if from.Name() == to.Name() { |
| 2053 | // This can happen for cc.reuseObjTag. We are not interested in tracking this. |
| 2054 | return |
| 2055 | } |
| 2056 | |
| 2057 | if info, exists := a.depInfos[to.Name()]; exists { |
| 2058 | if !android.InList(from.Name(), info.from) { |
| 2059 | info.from = append(info.from, from.Name()) |
| 2060 | } |
| 2061 | info.isExternal = info.isExternal && externalDep |
| 2062 | a.depInfos[to.Name()] = info |
| 2063 | } else { |
| 2064 | a.depInfos[to.Name()] = depInfo{ |
| 2065 | to: to.Name(), |
| 2066 | from: []string{from.Name()}, |
| 2067 | isExternal: externalDep, |
| 2068 | } |
| 2069 | } |
| 2070 | }) |
| 2071 | } |
| 2072 | |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2073 | func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 2074 | buildFlattenedAsDefault := ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() |
| 2075 | switch a.properties.ApexType { |
| 2076 | case imageApex: |
| 2077 | if buildFlattenedAsDefault { |
| 2078 | a.suffix = imageApexSuffix |
| 2079 | } else { |
| 2080 | a.suffix = "" |
| 2081 | a.primaryApexType = true |
Jooyung Han | 3ab2c3e | 2019-12-05 16:27:44 +0900 | [diff] [blame] | 2082 | |
| 2083 | if ctx.Config().InstallExtraFlattenedApexes() { |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 2084 | a.requiredDeps = append(a.requiredDeps, a.Name()+flattenedSuffix) |
Jooyung Han | 3ab2c3e | 2019-12-05 16:27:44 +0900 | [diff] [blame] | 2085 | } |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 2086 | } |
| 2087 | case zipApex: |
| 2088 | if proptools.String(a.properties.Payload_type) == "zip" { |
| 2089 | a.suffix = "" |
| 2090 | a.primaryApexType = true |
| 2091 | } else { |
| 2092 | a.suffix = zipApexSuffix |
| 2093 | } |
| 2094 | case flattenedApex: |
| 2095 | if buildFlattenedAsDefault { |
| 2096 | a.suffix = "" |
| 2097 | a.primaryApexType = true |
| 2098 | } else { |
| 2099 | a.suffix = flattenedSuffix |
| 2100 | } |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 2101 | } |
| 2102 | |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 2103 | if len(a.properties.Tests) > 0 && !a.testApex { |
| 2104 | ctx.PropertyErrorf("tests", "property not allowed in apex module type") |
| 2105 | return |
| 2106 | } |
| 2107 | |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 2108 | a.checkApexAvailability(ctx) |
| 2109 | |
Jiyong Park | 678c881 | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2110 | a.collectDepsInfo(ctx) |
| 2111 | |
Alex Light | fc0bd7c | 2019-01-29 18:31:59 -0800 | [diff] [blame] | 2112 | handleSpecialLibs := !android.Bool(a.properties.Ignore_system_library_special_case) |
| 2113 | |
Jooyung Han | e163303 | 2019-08-01 17:41:43 +0900 | [diff] [blame] | 2114 | // native lib dependencies |
| 2115 | var provideNativeLibs []string |
| 2116 | var requireNativeLibs []string |
| 2117 | |
Jooyung Han | 5c998b9 | 2019-06-27 11:30:33 +0900 | [diff] [blame] | 2118 | // Check if "uses" requirements are met with dependent apexBundles |
| 2119 | var providedNativeSharedLibs []string |
| 2120 | useVendor := proptools.Bool(a.properties.Use_vendor) |
| 2121 | ctx.VisitDirectDepsBlueprint(func(m blueprint.Module) { |
| 2122 | if ctx.OtherModuleDependencyTag(m) != usesTag { |
| 2123 | return |
| 2124 | } |
| 2125 | otherName := ctx.OtherModuleName(m) |
| 2126 | other, ok := m.(*apexBundle) |
| 2127 | if !ok { |
| 2128 | ctx.PropertyErrorf("uses", "%q is not a provider", otherName) |
| 2129 | return |
| 2130 | } |
| 2131 | if proptools.Bool(other.properties.Use_vendor) != useVendor { |
| 2132 | ctx.PropertyErrorf("use_vendor", "%q has different value of use_vendor", otherName) |
| 2133 | return |
| 2134 | } |
| 2135 | if !proptools.Bool(other.properties.Provide_cpp_shared_libs) { |
| 2136 | ctx.PropertyErrorf("uses", "%q does not provide native_shared_libs", otherName) |
| 2137 | return |
| 2138 | } |
| 2139 | providedNativeSharedLibs = append(providedNativeSharedLibs, other.properties.Native_shared_libs...) |
| 2140 | }) |
| 2141 | |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2142 | var filesInfo []apexFile |
Jiyong Park | 678c881 | 2020-02-07 17:25:49 +0900 | [diff] [blame] | 2143 | // TODO(jiyong) do this using walkPayloadDeps |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 2144 | ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2145 | depTag := ctx.OtherModuleDependencyTag(child) |
| 2146 | depName := ctx.OtherModuleName(child) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2147 | if _, isDirectDep := parent.(*apexBundle); isDirectDep { |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2148 | switch depTag { |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 2149 | case sharedLibTag, jniLibTag: |
| 2150 | isJniLib := depTag == jniLibTag |
Jooyung Han | faa2d5f | 2020-02-06 17:42:40 +0900 | [diff] [blame] | 2151 | if c, ok := child.(*cc.Module); ok { |
| 2152 | // bootstrap bionic libs are treated as provided by system |
| 2153 | if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) { |
| 2154 | provideNativeLibs = append(provideNativeLibs, c.OutputFile().Path().Base()) |
Jooyung Han | e163303 | 2019-08-01 17:41:43 +0900 | [diff] [blame] | 2155 | } |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 2156 | fi := apexFileForNativeLibrary(ctx, c, handleSpecialLibs) |
| 2157 | fi.isJniLib = isJniLib |
| 2158 | filesInfo = append(filesInfo, fi) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2159 | return true // track transitive dependencies |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2160 | } else { |
Jooyung Han | 643adc4 | 2020-02-27 13:50:06 +0900 | [diff] [blame] | 2161 | propertyName := "native_shared_libs" |
| 2162 | if isJniLib { |
| 2163 | propertyName = "jni_libs" |
| 2164 | } |
| 2165 | ctx.PropertyErrorf(propertyName, "%q is not a cc_library or cc_library_shared module", depName) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2166 | } |
| 2167 | case executableTag: |
| 2168 | if cc, ok := child.(*cc.Module); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2169 | filesInfo = append(filesInfo, apexFileForExecutable(ctx, cc)) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2170 | return true // track transitive dependencies |
Jiyong Park | 04480cf | 2019-02-06 00:16:29 +0900 | [diff] [blame] | 2171 | } else if sh, ok := child.(*android.ShBinary); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2172 | filesInfo = append(filesInfo, apexFileForShBinary(ctx, sh)) |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 2173 | } else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2174 | filesInfo = append(filesInfo, apexFileForPyBinary(ctx, py)) |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 2175 | } else if gb, ok := child.(bootstrap.GoBinaryTool); ok && a.Host() { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2176 | filesInfo = append(filesInfo, apexFileForGoBinary(ctx, depName, gb)) |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2177 | } else { |
Alex Light | 778127a | 2019-02-27 14:19:50 -0800 | [diff] [blame] | 2178 | ctx.PropertyErrorf("binaries", "%q is neither cc_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2179 | } |
| 2180 | case javaLibTag: |
Jiyong Park | 9e6c242 | 2019-08-09 20:39:45 +0900 | [diff] [blame] | 2181 | if javaLib, ok := child.(*java.Library); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2182 | af := apexFileForJavaLibrary(ctx, javaLib) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2183 | if !af.Ok() { |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2184 | ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName) |
| 2185 | } else { |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2186 | filesInfo = append(filesInfo, af) |
| 2187 | return true // track transitive dependencies |
Jiyong Park | 9e6c242 | 2019-08-09 20:39:45 +0900 | [diff] [blame] | 2188 | } |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 2189 | } else if sdkLib, ok := child.(*java.SdkLibrary); ok { |
| 2190 | af := apexFileForJavaLibrary(ctx, sdkLib) |
| 2191 | if !af.Ok() { |
| 2192 | ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName) |
| 2193 | return false |
| 2194 | } |
| 2195 | filesInfo = append(filesInfo, af) |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 2196 | return true // track transitive dependencies |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2197 | } else { |
Jiyong Park | 9e6c242 | 2019-08-09 20:39:45 +0900 | [diff] [blame] | 2198 | ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child)) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2199 | } |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2200 | case androidAppTag: |
| 2201 | pkgName := ctx.DeviceConfig().OverridePackageNameFor(depName) |
| 2202 | if ap, ok := child.(*java.AndroidApp); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2203 | filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName)) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2204 | return true // track transitive dependencies |
| 2205 | } else if ap, ok := child.(*java.AndroidAppImport); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2206 | filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName)) |
Dario Freni | 6f3937c | 2019-12-20 22:58:03 +0000 | [diff] [blame] | 2207 | } else if ap, ok := child.(*java.AndroidTestHelperApp); ok { |
| 2208 | filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName)) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2209 | } else { |
| 2210 | ctx.PropertyErrorf("apps", "%q is not an android_app module", depName) |
| 2211 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2212 | case prebuiltTag: |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 2213 | if prebuilt, ok := child.(android.PrebuiltEtcModule); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2214 | filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName)) |
atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 2215 | } else if prebuilt, ok := child.(java.PlatformCompatConfigIntf); ok { |
| 2216 | filesInfo = append(filesInfo, apexFileForCompatConfig(ctx, prebuilt, depName)) |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2217 | } else { |
atrost | 6e12625 | 2020-01-27 17:01:16 +0000 | [diff] [blame] | 2218 | ctx.PropertyErrorf("prebuilts", "%q is not a prebuilt_etc and not a platform_compat_config module", depName) |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2219 | } |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 2220 | case testTag: |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2221 | if ccTest, ok := child.(*cc.Module); ok { |
| 2222 | if ccTest.IsTestPerSrcAllTestsVariation() { |
| 2223 | // Multiple-output test module (where `test_per_src: true`). |
| 2224 | // |
| 2225 | // `ccTest` is the "" ("all tests") variation of a `test_per_src` module. |
| 2226 | // We do not add this variation to `filesInfo`, as it has no output; |
| 2227 | // however, we do add the other variations of this module as indirect |
| 2228 | // dependencies (see below). |
| 2229 | return true |
Roland Levillain | 9b5fde9 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 2230 | } else { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2231 | // Single-output test module (where `test_per_src: false`). |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2232 | af := apexFileForExecutable(ctx, ccTest) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2233 | af.class = nativeTest |
| 2234 | filesInfo = append(filesInfo, af) |
Roland Levillain | 9b5fde9 | 2019-06-28 15:41:19 +0100 | [diff] [blame] | 2235 | } |
Roland Levillain | 630846d | 2019-06-26 12:48:34 +0100 | [diff] [blame] | 2236 | } else { |
| 2237 | ctx.PropertyErrorf("tests", "%q is not a cc module", depName) |
| 2238 | } |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2239 | case keyTag: |
| 2240 | if key, ok := child.(*apexKey); ok { |
Jiyong Park | 0ca3ce8 | 2019-02-18 15:25:04 +0900 | [diff] [blame] | 2241 | a.private_key_file = key.private_key_file |
| 2242 | a.public_key_file = key.public_key_file |
Jiyong Park | ff1458f | 2018-10-12 21:49:38 +0900 | [diff] [blame] | 2243 | } else { |
| 2244 | ctx.PropertyErrorf("key", "%q is not an apex_key module", depName) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2245 | } |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2246 | return false |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 2247 | case certificateTag: |
| 2248 | if dep, ok := child.(*java.AndroidAppCertificate); ok { |
Jiyong Park | 0ca3ce8 | 2019-02-18 15:25:04 +0900 | [diff] [blame] | 2249 | a.container_certificate_file = dep.Certificate.Pem |
| 2250 | a.container_private_key_file = dep.Certificate.Key |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 2251 | } else { |
| 2252 | ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", depName) |
| 2253 | } |
Jiyong Park | 03b68dd | 2019-07-26 23:20:40 +0900 | [diff] [blame] | 2254 | case android.PrebuiltDepTag: |
| 2255 | // If the prebuilt is force disabled, remember to delete the prebuilt file |
| 2256 | // that might have been installed in the previous builds |
| 2257 | if prebuilt, ok := child.(*Prebuilt); ok && prebuilt.isForceDisabled() { |
| 2258 | a.prebuiltFileToDelete = prebuilt.InstallFilename() |
| 2259 | } |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2260 | } |
Jooyung Han | 8aee204 | 2019-10-29 05:08:31 +0900 | [diff] [blame] | 2261 | } else if !a.vndkApex { |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2262 | // indirect dependencies |
Jooyung Han | 9c80bae | 2019-08-20 17:30:57 +0900 | [diff] [blame] | 2263 | if am, ok := child.(android.ApexModule); ok { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2264 | // We cannot use a switch statement on `depTag` here as the checked |
| 2265 | // tags used below are private (e.g. `cc.sharedDepTag`). |
Jiyong Park | 52cd06f | 2019-11-11 10:14:32 +0900 | [diff] [blame] | 2266 | if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2267 | if cc, ok := child.(*cc.Module); ok { |
| 2268 | if android.InList(cc.Name(), providedNativeSharedLibs) { |
| 2269 | // If we're using a shared library which is provided from other APEX, |
| 2270 | // don't include it in this APEX |
| 2271 | return false |
Jiyong Park | ac2bacd | 2019-02-20 21:49:26 +0900 | [diff] [blame] | 2272 | } |
Jooyung Han | 671f1ce | 2019-12-17 12:47:13 +0900 | [diff] [blame] | 2273 | if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2274 | // If the dependency is a stubs lib, don't include it in this APEX, |
| 2275 | // but make sure that the lib is installed on the device. |
| 2276 | // In case no APEX is having the lib, the lib is installed to the system |
| 2277 | // partition. |
| 2278 | // |
| 2279 | // Always include if we are a host-apex however since those won't have any |
| 2280 | // system libraries. |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 2281 | if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.requiredDeps) { |
| 2282 | a.requiredDeps = append(a.requiredDeps, cc.Name()) |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2283 | } |
Jooyung Han | e163303 | 2019-08-01 17:41:43 +0900 | [diff] [blame] | 2284 | requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base()) |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2285 | // Don't track further |
| 2286 | return false |
| 2287 | } |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2288 | af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2289 | af.transitiveDep = true |
| 2290 | filesInfo = append(filesInfo, af) |
| 2291 | return true // track transitive dependencies |
Jiyong Park | 25fc6a9 | 2018-11-18 18:02:45 +0900 | [diff] [blame] | 2292 | } |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2293 | } else if cc.IsTestPerSrcDepTag(depTag) { |
| 2294 | if cc, ok := child.(*cc.Module); ok { |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2295 | af := apexFileForExecutable(ctx, cc) |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2296 | // Handle modules created as `test_per_src` variations of a single test module: |
| 2297 | // use the name of the generated test binary (`fileToCopy`) instead of the name |
| 2298 | // of the original test module (`depName`, shared by all `test_per_src` |
| 2299 | // variations of that module). |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2300 | af.moduleName = filepath.Base(af.builtFile.String()) |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 2301 | // these are not considered transitive dep |
| 2302 | af.transitiveDep = false |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2303 | filesInfo = append(filesInfo, af) |
| 2304 | return true // track transitive dependencies |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2305 | } |
Jiyong Park | 52cd06f | 2019-11-11 10:14:32 +0900 | [diff] [blame] | 2306 | } else if java.IsJniDepTag(depTag) { |
Jooyung Han | b7bebe2 | 2020-02-25 16:59:29 +0900 | [diff] [blame] | 2307 | // Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps |
| 2308 | return false |
Jiyong Park | e383388 | 2020-02-17 17:28:10 +0900 | [diff] [blame] | 2309 | } else if java.IsXmlPermissionsFileDepTag(depTag) { |
| 2310 | if prebuilt, ok := child.(android.PrebuiltEtcModule); ok { |
| 2311 | filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName)) |
| 2312 | } |
Jooyung Han | 9c80bae | 2019-08-20 17:30:57 +0900 | [diff] [blame] | 2313 | } else if am.CanHaveApexVariants() && am.IsInstallableToApex() { |
Roland Levillain | f89cd09 | 2019-07-29 16:22:59 +0100 | [diff] [blame] | 2314 | ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2315 | } |
| 2316 | } |
| 2317 | } |
| 2318 | return false |
| 2319 | }) |
| 2320 | |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 2321 | // Specific to the ART apex: dexpreopt artifacts for libcore Java libraries. |
| 2322 | // Build rules are generated by the dexpreopt singleton, and here we access build artifacts |
| 2323 | // via the global boot image config. |
| 2324 | if a.artApex { |
Tim Joines | c1ef1bb | 2020-03-18 18:00:41 +0000 | [diff] [blame] | 2325 | for arch, files := range java.DexpreoptedArtApexJars(ctx) { |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 2326 | dirInApex := filepath.Join("javalib", arch.String()) |
| 2327 | for _, f := range files { |
| 2328 | localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String()) |
Jiyong Park | 1833cef | 2019-12-13 13:28:36 +0900 | [diff] [blame] | 2329 | af := newApexFile(ctx, f, localModule, dirInApex, etc, nil) |
Jiyong Park | f653b05 | 2019-11-18 15:39:01 +0900 | [diff] [blame] | 2330 | filesInfo = append(filesInfo, af) |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 2331 | } |
| 2332 | } |
| 2333 | } |
| 2334 | |
Jiyong Park | 0ca3ce8 | 2019-02-18 15:25:04 +0900 | [diff] [blame] | 2335 | if a.private_key_file == nil { |
Jiyong Park | fa0a373 | 2018-11-09 05:52:26 +0900 | [diff] [blame] | 2336 | ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key)) |
| 2337 | return |
| 2338 | } |
| 2339 | |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2340 | // remove duplicates in filesInfo |
| 2341 | removeDup := func(filesInfo []apexFile) []apexFile { |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 2342 | encountered := make(map[string]apexFile) |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2343 | for _, f := range filesInfo { |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2344 | dest := filepath.Join(f.installDir, f.builtFile.Base()) |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 2345 | if e, ok := encountered[dest]; !ok { |
| 2346 | encountered[dest] = f |
| 2347 | } else { |
| 2348 | // If a module is directly included and also transitively depended on |
| 2349 | // consider it as directly included. |
| 2350 | e.transitiveDep = e.transitiveDep && f.transitiveDep |
| 2351 | encountered[dest] = e |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2352 | } |
| 2353 | } |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 2354 | var result []apexFile |
| 2355 | for _, v := range encountered { |
| 2356 | result = append(result, v) |
| 2357 | } |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2358 | return result |
| 2359 | } |
| 2360 | filesInfo = removeDup(filesInfo) |
| 2361 | |
| 2362 | // to have consistent build rules |
| 2363 | sort.Slice(filesInfo, func(i, j int) bool { |
| 2364 | return filesInfo[i].builtFile.String() < filesInfo[j].builtFile.String() |
| 2365 | }) |
| 2366 | |
Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 2367 | a.installDir = android.PathForModuleInstall(ctx, "apex") |
| 2368 | a.filesInfo = filesInfo |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 2369 | |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 2370 | if a.properties.ApexType != zipApex { |
| 2371 | if a.properties.File_contexts == nil { |
| 2372 | a.fileContexts = android.PathForSource(ctx, "system/sepolicy/apex", ctx.ModuleName()+"-file_contexts") |
| 2373 | } else { |
| 2374 | a.fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts) |
| 2375 | if a.Platform() { |
| 2376 | if matched, err := path.Match("system/sepolicy/**/*", a.fileContexts.String()); err != nil || !matched { |
| 2377 | ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but %q", a.fileContexts) |
| 2378 | } |
| 2379 | } |
| 2380 | } |
| 2381 | if !android.ExistentPathForSource(ctx, a.fileContexts.String()).Valid() { |
| 2382 | ctx.PropertyErrorf("file_contexts", "cannot find file_contexts file: %q", a.fileContexts) |
| 2383 | return |
| 2384 | } |
| 2385 | } |
Jiyong Park | 7cd10e3 | 2020-01-14 09:22:18 +0900 | [diff] [blame] | 2386 | // Optimization. If we are building bundled APEX, for the files that are gathered due to the |
| 2387 | // transitive dependencies, don't place them inside the APEX, but place a symlink pointing |
| 2388 | // the same library in the system partition, thus effectively sharing the same libraries |
| 2389 | // across the APEX boundary. For unbundled APEX, all the gathered files are actually placed |
| 2390 | // in the APEX. |
| 2391 | a.linkToSystemLib = !ctx.Config().UnbundledBuild() && |
| 2392 | a.installable() && |
| 2393 | !proptools.Bool(a.properties.Use_vendor) |
Jooyung Han | 54aca7b | 2019-11-20 02:26:02 +0900 | [diff] [blame] | 2394 | |
Jiyong Park | 9d67720 | 2020-02-19 16:29:35 +0900 | [diff] [blame] | 2395 | // We don't need the optimization for updatable APEXes, as it might give false signal |
| 2396 | // to the system health when the APEXes are still bundled (b/149805758) |
| 2397 | if proptools.Bool(a.properties.Updatable) && a.properties.ApexType == imageApex { |
| 2398 | a.linkToSystemLib = false |
| 2399 | } |
| 2400 | |
Jiyong Park | 638d30e | 2020-02-26 18:27:19 +0900 | [diff] [blame] | 2401 | // We also don't want the optimization for host APEXes, because it doesn't make sense. |
| 2402 | if ctx.Host() { |
| 2403 | a.linkToSystemLib = false |
| 2404 | } |
| 2405 | |
Jooyung Han | d15aa1f | 2019-09-27 00:38:03 +0900 | [diff] [blame] | 2406 | // prepare apex_manifest.json |
Jooyung Han | 01a3ee2 | 2019-11-02 02:52:25 +0900 | [diff] [blame] | 2407 | a.buildManifest(ctx, provideNativeLibs, requireNativeLibs) |
| 2408 | |
| 2409 | a.setCertificateAndPrivateKey(ctx) |
| 2410 | if a.properties.ApexType == flattenedApex { |
| 2411 | a.buildFlattenedApex(ctx) |
| 2412 | } else { |
| 2413 | a.buildUnflattenedApex(ctx) |
| 2414 | } |
| 2415 | |
Jooyung Han | 002ab68 | 2020-01-08 01:57:58 +0900 | [diff] [blame] | 2416 | a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx) |
Jiyong Park | 956305c | 2020-01-09 12:32:06 +0900 | [diff] [blame] | 2417 | |
| 2418 | a.buildApexDependencyInfo(ctx) |
Jooyung Han | 01a3ee2 | 2019-11-02 02:52:25 +0900 | [diff] [blame] | 2419 | } |
| 2420 | |
Jooyung Han | 5e9013b | 2020-03-10 06:23:13 +0900 | [diff] [blame] | 2421 | func whitelistedApexAvailable(apex, moduleName string) bool { |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 2422 | key := apex |
Paul Duffin | 7d74e7b | 2020-03-06 12:30:13 +0000 | [diff] [blame] | 2423 | moduleName = normalizeModuleName(moduleName) |
| 2424 | |
| 2425 | if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) { |
| 2426 | return true |
| 2427 | } |
| 2428 | |
| 2429 | key = android.AvailableToAnyApex |
| 2430 | if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) { |
| 2431 | return true |
| 2432 | } |
| 2433 | |
| 2434 | return false |
| 2435 | } |
| 2436 | |
| 2437 | func normalizeModuleName(moduleName string) string { |
Jiyong Park | 0f80c18 | 2020-01-31 02:49:53 +0900 | [diff] [blame] | 2438 | // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build |
| 2439 | // system. Trim the prefix for the check since they are confusing |
| 2440 | moduleName = strings.TrimPrefix(moduleName, "prebuilt_") |
| 2441 | if strings.HasPrefix(moduleName, "libclang_rt.") { |
| 2442 | // This module has many arch variants that depend on the product being built. |
| 2443 | // We don't want to list them all |
| 2444 | moduleName = "libclang_rt" |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 2445 | } |
Paul Duffin | 7d74e7b | 2020-03-06 12:30:13 +0000 | [diff] [blame] | 2446 | return moduleName |
Anton Hansson | eec79eb | 2020-01-10 15:12:39 +0000 | [diff] [blame] | 2447 | } |
| 2448 | |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2449 | func newApexBundle() *apexBundle { |
Sundong Ahn | abb6443 | 2019-10-22 13:58:29 +0900 | [diff] [blame] | 2450 | module := &apexBundle{} |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2451 | module.AddProperties(&module.properties) |
Alex Light | 9670d33 | 2019-01-29 18:07:33 -0800 | [diff] [blame] | 2452 | module.AddProperties(&module.targetProperties) |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 2453 | module.AddProperties(&module.overridableProperties) |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 2454 | module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool { |
Jiyong Park | 397e55e | 2018-10-24 21:09:55 +0900 | [diff] [blame] | 2455 | return class == android.Device && ctx.Config().DevicePrefer32BitExecutables() |
| 2456 | }) |
Alex Light | 5098a61 | 2018-11-29 17:12:15 -0800 | [diff] [blame] | 2457 | android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2458 | android.InitDefaultableModule(module) |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 2459 | android.InitSdkAwareModule(module) |
Jaewoong Jung | 7abcf8e | 2019-12-19 17:32:06 -0800 | [diff] [blame] | 2460 | android.InitOverridableModule(module, &module.overridableProperties.Overrides) |
Jiyong Park | 48ca7dc | 2018-10-10 14:01:00 +0900 | [diff] [blame] | 2461 | return module |
| 2462 | } |
Jiyong Park | 30ca937 | 2019-02-07 16:27:23 +0900 | [diff] [blame] | 2463 | |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 2464 | func ApexBundleFactory(testApex bool, artApex bool) android.Module { |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2465 | bundle := newApexBundle() |
| 2466 | bundle.testApex = testApex |
Ulyana Trafimovich | de53441 | 2019-11-08 10:51:01 +0000 | [diff] [blame] | 2467 | bundle.artApex = artApex |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2468 | return bundle |
| 2469 | } |
| 2470 | |
Jiyong Park | fce0b42 | 2020-02-11 03:56:06 +0900 | [diff] [blame] | 2471 | // apex_test is an APEX for testing. The difference from the ordinary apex module type is that |
| 2472 | // certain compatibility checks such as apex_available are not done for apex_test. |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2473 | func testApexBundleFactory() android.Module { |
| 2474 | bundle := newApexBundle() |
| 2475 | bundle.testApex = true |
| 2476 | return bundle |
| 2477 | } |
| 2478 | |
Jiyong Park | fce0b42 | 2020-02-11 03:56:06 +0900 | [diff] [blame] | 2479 | // apex packages other modules into an APEX file which is a packaging format for system-level |
| 2480 | // components like binaries, shared libraries, etc. |
Jiyong Park | d1063c1 | 2019-07-17 20:08:41 +0900 | [diff] [blame] | 2481 | func BundleFactory() android.Module { |
Jooyung Han | 344d543 | 2019-08-23 11:17:39 +0900 | [diff] [blame] | 2482 | return newApexBundle() |
| 2483 | } |
| 2484 | |
Jiyong Park | 30ca937 | 2019-02-07 16:27:23 +0900 | [diff] [blame] | 2485 | // |
| 2486 | // Defaults |
| 2487 | // |
| 2488 | type Defaults struct { |
| 2489 | android.ModuleBase |
| 2490 | android.DefaultsModuleBase |
| 2491 | } |
| 2492 | |
Jiyong Park | 30ca937 | 2019-02-07 16:27:23 +0900 | [diff] [blame] | 2493 | func defaultsFactory() android.Module { |
| 2494 | return DefaultsFactory() |
| 2495 | } |
| 2496 | |
| 2497 | func DefaultsFactory(props ...interface{}) android.Module { |
| 2498 | module := &Defaults{} |
| 2499 | |
| 2500 | module.AddProperties(props...) |
| 2501 | module.AddProperties( |
| 2502 | &apexBundleProperties{}, |
| 2503 | &apexTargetBundleProperties{}, |
Jooyung Han | f21c797 | 2019-12-16 22:32:06 +0900 | [diff] [blame] | 2504 | &overridableProperties{}, |
Jiyong Park | 30ca937 | 2019-02-07 16:27:23 +0900 | [diff] [blame] | 2505 | ) |
| 2506 | |
| 2507 | android.InitDefaultsModule(module) |
| 2508 | return module |
| 2509 | } |
Jiyong Park | 5d790c3 | 2019-11-15 18:40:32 +0900 | [diff] [blame] | 2510 | |
| 2511 | // |
| 2512 | // OverrideApex |
| 2513 | // |
| 2514 | type OverrideApex struct { |
| 2515 | android.ModuleBase |
| 2516 | android.OverrideModuleBase |
| 2517 | } |
| 2518 | |
| 2519 | func (o *OverrideApex) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 2520 | // All the overrides happen in the base module. |
| 2521 | } |
| 2522 | |
| 2523 | // override_apex is used to create an apex module based on another apex module |
| 2524 | // by overriding some of its properties. |
| 2525 | func overrideApexFactory() android.Module { |
| 2526 | m := &OverrideApex{} |
| 2527 | m.AddProperties(&overridableProperties{}) |
| 2528 | |
| 2529 | android.InitAndroidMultiTargetsArchModule(m, android.DeviceSupported, android.MultilibCommon) |
| 2530 | android.InitOverrideModule(m) |
| 2531 | return m |
| 2532 | } |