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