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