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