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