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