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