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