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