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