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