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