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