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