| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 1 | package cc | 
|  | 2 |  | 
|  | 3 | import ( | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 4 | "android/soong/android" | 
| Ivan Lozano | 0f9963e | 2023-02-06 13:31:02 -0500 | [diff] [blame] | 5 | "android/soong/fuzz" | 
| Kiyoung Kim | 48f3778 | 2021-07-07 12:42:39 +0900 | [diff] [blame] | 6 | "android/soong/snapshot" | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 7 |  | 
|  | 8 | "github.com/google/blueprint" | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 9 | ) | 
|  | 10 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 11 | // PlatformSanitizeable is an interface for sanitizing platform modules. | 
|  | 12 | type PlatformSanitizeable interface { | 
|  | 13 | LinkableInterface | 
|  | 14 |  | 
|  | 15 | // SanitizePropDefined returns whether the Sanitizer properties struct for this module is defined. | 
|  | 16 | SanitizePropDefined() bool | 
|  | 17 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 18 | // IsSanitizerEnabled returns whether a sanitizer is enabled. | 
|  | 19 | IsSanitizerEnabled(t SanitizerType) bool | 
|  | 20 |  | 
|  | 21 | // IsSanitizerExplicitlyDisabled returns whether a sanitizer has been explicitly disabled (set to false) rather | 
|  | 22 | // than left undefined. | 
|  | 23 | IsSanitizerExplicitlyDisabled(t SanitizerType) bool | 
|  | 24 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 25 | // SetSanitizer enables or disables the specified sanitizer type if it's supported, otherwise this should panic. | 
|  | 26 | SetSanitizer(t SanitizerType, b bool) | 
|  | 27 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 28 | // StaticallyLinked returns true if the module is statically linked. | 
|  | 29 | StaticallyLinked() bool | 
|  | 30 |  | 
|  | 31 | // SetInSanitizerDir sets the module installation to the sanitizer directory. | 
|  | 32 | SetInSanitizerDir() | 
|  | 33 |  | 
|  | 34 | // SanitizeNever returns true if this module should never be sanitized. | 
|  | 35 | SanitizeNever() bool | 
|  | 36 |  | 
|  | 37 | // SanitizerSupported returns true if a sanitizer type is supported by this modules compiler. | 
|  | 38 | SanitizerSupported(t SanitizerType) bool | 
|  | 39 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 40 | // MinimalRuntimeDep returns true if this module needs to link the minimal UBSan runtime, | 
|  | 41 | // either because it requires it or because a dependent module which requires it to be linked in this module. | 
|  | 42 | MinimalRuntimeDep() bool | 
|  | 43 |  | 
|  | 44 | // UbsanRuntimeDep returns true if this module needs to link the full UBSan runtime, | 
|  | 45 | // either because it requires it or because a dependent module which requires it to be linked in this module. | 
|  | 46 | UbsanRuntimeDep() bool | 
|  | 47 |  | 
|  | 48 | // UbsanRuntimeNeeded returns true if the full UBSan runtime is required by this module. | 
|  | 49 | UbsanRuntimeNeeded() bool | 
|  | 50 |  | 
|  | 51 | // MinimalRuntimeNeeded returns true if the minimal UBSan runtime is required by this module | 
|  | 52 | MinimalRuntimeNeeded() bool | 
|  | 53 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 54 | // SanitizableDepTagChecker returns a SantizableDependencyTagChecker function type. | 
|  | 55 | SanitizableDepTagChecker() SantizableDependencyTagChecker | 
|  | 56 | } | 
|  | 57 |  | 
|  | 58 | // SantizableDependencyTagChecker functions check whether or not a dependency | 
|  | 59 | // tag can be sanitized. These functions should return true if the tag can be | 
|  | 60 | // sanitized, otherwise they should return false. These functions should also | 
|  | 61 | // handle all possible dependency tags in the dependency tree. For example, | 
|  | 62 | // Rust modules can depend on both Rust and CC libraries, so the Rust module | 
|  | 63 | // implementation should handle tags from both. | 
|  | 64 | type SantizableDependencyTagChecker func(tag blueprint.DependencyTag) bool | 
|  | 65 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 66 | // Snapshottable defines those functions necessary for handling module snapshots. | 
|  | 67 | type Snapshottable interface { | 
| Kiyoung Kim | 48f3778 | 2021-07-07 12:42:39 +0900 | [diff] [blame] | 68 | snapshot.VendorSnapshotModuleInterface | 
|  | 69 | snapshot.RecoverySnapshotModuleInterface | 
|  | 70 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 71 | // SnapshotHeaders returns a list of header paths provided by this module. | 
|  | 72 | SnapshotHeaders() android.Paths | 
|  | 73 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 74 | // SnapshotLibrary returns true if this module is a snapshot library. | 
|  | 75 | IsSnapshotLibrary() bool | 
|  | 76 |  | 
| Justin Yun | 885a7de | 2021-06-29 20:34:53 +0900 | [diff] [blame] | 77 | // EffectiveLicenseFiles returns the list of License files for this module. | 
|  | 78 | EffectiveLicenseFiles() android.Paths | 
|  | 79 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 80 | // SnapshotRuntimeLibs returns a list of libraries needed by this module at runtime but which aren't build dependencies. | 
|  | 81 | SnapshotRuntimeLibs() []string | 
|  | 82 |  | 
|  | 83 | // SnapshotSharedLibs returns the list of shared library dependencies for this module. | 
|  | 84 | SnapshotSharedLibs() []string | 
|  | 85 |  | 
| Justin Yun | 5e03586 | 2021-06-29 20:50:37 +0900 | [diff] [blame] | 86 | // SnapshotStaticLibs returns the list of static library dependencies for this module. | 
|  | 87 | SnapshotStaticLibs() []string | 
|  | 88 |  | 
| Ivan Lozano | add122a | 2023-07-13 11:01:41 -0400 | [diff] [blame] | 89 | // SnapshotDylibs returns the list of dylib library dependencies for this module. | 
|  | 90 | SnapshotDylibs() []string | 
|  | 91 |  | 
|  | 92 | // SnapshotRlibs returns the list of rlib library dependencies for this module. | 
|  | 93 | SnapshotRlibs() []string | 
|  | 94 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 95 | // IsSnapshotPrebuilt returns true if this module is a snapshot prebuilt. | 
|  | 96 | IsSnapshotPrebuilt() bool | 
| Ivan Lozano | 5467a39 | 2023-08-23 14:20:25 -0400 | [diff] [blame] | 97 |  | 
|  | 98 | // IsSnapshotSanitizer returns true if this snapshot module implements SnapshotSanitizer. | 
|  | 99 | IsSnapshotSanitizer() bool | 
|  | 100 |  | 
|  | 101 | // IsSnapshotSanitizerAvailable returns true if this snapshot module has a sanitizer source available (cfi, hwasan). | 
|  | 102 | IsSnapshotSanitizerAvailable(t SanitizerType) bool | 
|  | 103 |  | 
|  | 104 | // SetSnapshotSanitizerVariation sets the sanitizer variation type for this snapshot module. | 
|  | 105 | SetSnapshotSanitizerVariation(t SanitizerType, enabled bool) | 
|  | 106 |  | 
|  | 107 | // IsSnapshotUnsanitizedVariant returns true if this is the unsanitized snapshot module variant. | 
|  | 108 | IsSnapshotUnsanitizedVariant() bool | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 109 | } | 
|  | 110 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 111 | // LinkableInterface is an interface for a type of module that is linkable in a C++ library. | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 112 | type LinkableInterface interface { | 
| Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 113 | android.Module | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 114 | Snapshottable | 
| Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 115 |  | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 116 | Module() android.Module | 
|  | 117 | CcLibrary() bool | 
|  | 118 | CcLibraryInterface() bool | 
|  | 119 |  | 
| Ivan Lozano | 61c02cc | 2023-06-09 14:06:44 -0400 | [diff] [blame] | 120 | // RustLibraryInterface returns true if this is a Rust library module | 
|  | 121 | RustLibraryInterface() bool | 
|  | 122 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 123 | // BaseModuleName returns the android.ModuleBase.BaseModuleName() value for this module. | 
|  | 124 | BaseModuleName() string | 
|  | 125 |  | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 126 | OutputFile() android.OptionalPath | 
| Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 127 | UnstrippedOutputFile() android.Path | 
| Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 128 | CoverageFiles() android.Paths | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 129 |  | 
| Ivan Lozano | 7f67c2a | 2022-06-27 16:00:26 -0400 | [diff] [blame] | 130 | // CoverageOutputFile returns the output archive of gcno coverage information files. | 
|  | 131 | CoverageOutputFile() android.OptionalPath | 
|  | 132 |  | 
| Ivan Lozano | 2b26297 | 2019-11-21 12:30:50 -0800 | [diff] [blame] | 133 | NonCcVariants() bool | 
|  | 134 |  | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 135 | SelectedStl() string | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 136 |  | 
|  | 137 | BuildStaticVariant() bool | 
|  | 138 | BuildSharedVariant() bool | 
|  | 139 | SetStatic() | 
|  | 140 | SetShared() | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 141 | IsPrebuilt() bool | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 142 | Toc() android.OptionalPath | 
|  | 143 |  | 
| Ivan Lozano | 0f9963e | 2023-02-06 13:31:02 -0500 | [diff] [blame] | 144 | // IsFuzzModule returns true if this a *_fuzz module. | 
|  | 145 | IsFuzzModule() bool | 
|  | 146 |  | 
|  | 147 | // FuzzPackagedModule returns the fuzz.FuzzPackagedModule for this module. | 
|  | 148 | // Expects that IsFuzzModule returns true. | 
|  | 149 | FuzzPackagedModule() fuzz.FuzzPackagedModule | 
|  | 150 |  | 
|  | 151 | // FuzzSharedLibraries returns the shared library dependencies for this module. | 
|  | 152 | // Expects that IsFuzzModule returns true. | 
| Hamzeh Zawawy | 3891749 | 2023-04-05 22:08:46 +0000 | [diff] [blame] | 153 | FuzzSharedLibraries() android.RuleBuilderInstalls | 
| Ivan Lozano | 0f9963e | 2023-02-06 13:31:02 -0500 | [diff] [blame] | 154 |  | 
| Yi-Yo Chiang | 36d8e4e | 2021-07-02 21:21:13 +0800 | [diff] [blame] | 155 | Device() bool | 
| Jooyung Han | 624d35c | 2020-04-10 12:57:24 +0900 | [diff] [blame] | 156 | Host() bool | 
|  | 157 |  | 
| Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 158 | InRamdisk() bool | 
|  | 159 | OnlyInRamdisk() bool | 
|  | 160 |  | 
| Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 161 | InVendorRamdisk() bool | 
|  | 162 | OnlyInVendorRamdisk() bool | 
|  | 163 |  | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 164 | InRecovery() bool | 
|  | 165 | OnlyInRecovery() bool | 
|  | 166 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 167 | InVendor() bool | 
|  | 168 |  | 
| Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 169 | UseSdk() bool | 
| Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 170 |  | 
| Ivan Lozano | 7f67c2a | 2022-06-27 16:00:26 -0400 | [diff] [blame] | 171 | // IsNdk returns true if the library is in the configs known NDK list. | 
|  | 172 | IsNdk(config android.Config) bool | 
|  | 173 |  | 
|  | 174 | // IsStubs returns true if the this is a stubs library. | 
|  | 175 | IsStubs() bool | 
|  | 176 |  | 
| Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 177 | // IsLlndk returns true for both LLNDK (public) and LLNDK-private libs. | 
|  | 178 | IsLlndk() bool | 
|  | 179 |  | 
|  | 180 | // IsLlndkPublic returns true only for LLNDK (public) libs. | 
|  | 181 | IsLlndkPublic() bool | 
|  | 182 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 183 | // HasLlndkStubs returns true if this library has a variant that will build LLNDK stubs. | 
|  | 184 | HasLlndkStubs() bool | 
|  | 185 |  | 
| Colin Cross | 1f3f130 | 2021-04-26 18:37:44 -0700 | [diff] [blame] | 186 | // NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers. | 
|  | 187 | NeedsLlndkVariants() bool | 
| Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 188 |  | 
| Colin Cross | 5271fea | 2021-04-27 13:06:04 -0700 | [diff] [blame] | 189 | // NeedsVendorPublicLibraryVariants returns true if this module has vendor public library stubs. | 
|  | 190 | NeedsVendorPublicLibraryVariants() bool | 
|  | 191 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 192 | //StubsVersion returns the stubs version for this module. | 
|  | 193 | StubsVersion() string | 
|  | 194 |  | 
|  | 195 | // UseVndk returns true if the module is using VNDK libraries instead of the libraries in /system/lib or /system/lib64. | 
|  | 196 | // "product" and "vendor" variant modules return true for this function. | 
|  | 197 | // When BOARD_VNDK_VERSION is set, vendor variants of "vendor_available: true", "vendor: true", | 
|  | 198 | // "soc_specific: true" and more vendor installed modules are included here. | 
|  | 199 | // When PRODUCT_PRODUCT_VNDK_VERSION is set, product variants of "vendor_available: true" or | 
|  | 200 | // "product_specific: true" modules are included here. | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 201 | UseVndk() bool | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 202 |  | 
| Jiyong Park | 7d55b61 | 2021-06-11 17:22:09 +0900 | [diff] [blame] | 203 | // Bootstrap tests if this module is allowed to use non-APEX version of libraries. | 
|  | 204 | Bootstrap() bool | 
|  | 205 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 206 | // IsVndkSp returns true if this is a VNDK-SP module. | 
|  | 207 | IsVndkSp() bool | 
|  | 208 |  | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 209 | MustUseVendorVariant() bool | 
|  | 210 | IsVndk() bool | 
| Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 211 | IsVndkExt() bool | 
| Colin Cross | 127bb8b | 2020-12-16 16:46:01 -0800 | [diff] [blame] | 212 | IsVndkPrivate() bool | 
| Ivan Lozano | f1868af | 2022-04-12 13:08:36 -0400 | [diff] [blame] | 213 | IsVendorPublicLibrary() bool | 
|  | 214 | IsVndkPrebuiltLibrary() bool | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 215 | HasVendorVariant() bool | 
| Justin Yun | cbca373 | 2021-02-03 19:24:13 +0900 | [diff] [blame] | 216 | HasProductVariant() bool | 
|  | 217 | HasNonSystemVariants() bool | 
| Ivan Lozano | f1868af | 2022-04-12 13:08:36 -0400 | [diff] [blame] | 218 | ProductSpecific() bool | 
| Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 219 | InProduct() bool | 
| Ivan Lozano | f1868af | 2022-04-12 13:08:36 -0400 | [diff] [blame] | 220 | SdkAndPlatformVariantVisibleToMake() bool | 
| Kiyoung Kim | aa39480 | 2024-01-08 12:55:45 +0900 | [diff] [blame] | 221 | InVendorOrProduct() bool | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 222 |  | 
| Ivan Lozano | c08897c | 2021-04-02 12:41:32 -0400 | [diff] [blame] | 223 | // SubName returns the modules SubName, used for image and NDK/SDK variations. | 
|  | 224 | SubName() string | 
|  | 225 |  | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 226 | SdkVersion() string | 
| Jiyong Park | fdaa5f7 | 2021-03-19 22:18:04 +0900 | [diff] [blame] | 227 | MinSdkVersion() string | 
| Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 228 | AlwaysSdk() bool | 
| Jiyong Park | 2286afd | 2020-06-16 21:58:53 +0900 | [diff] [blame] | 229 | IsSdkVariant() bool | 
| Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 230 |  | 
| Colin Cross | 1348ce3 | 2020-10-01 13:37:16 -0700 | [diff] [blame] | 231 | SplitPerApiLevel() bool | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 232 |  | 
|  | 233 | // SetPreventInstall sets the PreventInstall property to 'true' for this module. | 
|  | 234 | SetPreventInstall() | 
|  | 235 | // SetHideFromMake sets the HideFromMake property to 'true' for this module. | 
|  | 236 | SetHideFromMake() | 
| Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 237 |  | 
|  | 238 | // KernelHeadersDecorator returns true if this is a kernel headers decorator module. | 
|  | 239 | // This is specific to cc and should always return false for all other packages. | 
|  | 240 | KernelHeadersDecorator() bool | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 241 |  | 
|  | 242 | // HiddenFromMake returns true if this module is hidden from Make. | 
|  | 243 | HiddenFromMake() bool | 
|  | 244 |  | 
|  | 245 | // RelativeInstallPath returns the relative install path for this module. | 
|  | 246 | RelativeInstallPath() string | 
|  | 247 |  | 
|  | 248 | // Binary returns true if this is a binary module. | 
|  | 249 | Binary() bool | 
|  | 250 |  | 
|  | 251 | // Object returns true if this is an object module. | 
|  | 252 | Object() bool | 
|  | 253 |  | 
|  | 254 | // Rlib returns true if this is an rlib module. | 
|  | 255 | Rlib() bool | 
|  | 256 |  | 
|  | 257 | // Dylib returns true if this is an dylib module. | 
|  | 258 | Dylib() bool | 
|  | 259 |  | 
| Ivan Lozano | add122a | 2023-07-13 11:01:41 -0400 | [diff] [blame] | 260 | // RlibStd returns true if this is an rlib which links against an rlib libstd. | 
|  | 261 | RlibStd() bool | 
|  | 262 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 263 | // Static returns true if this is a static library module. | 
|  | 264 | Static() bool | 
|  | 265 |  | 
|  | 266 | // Shared returns true if this is a shared library module. | 
|  | 267 | Shared() bool | 
|  | 268 |  | 
|  | 269 | // Header returns true if this is a library headers module. | 
|  | 270 | Header() bool | 
|  | 271 |  | 
| Justin Yun | 5e03586 | 2021-06-29 20:50:37 +0900 | [diff] [blame] | 272 | // StaticExecutable returns true if this is a binary module with "static_executable: true". | 
|  | 273 | StaticExecutable() bool | 
|  | 274 |  | 
| Ivan Lozano | d7586b6 | 2021-04-01 09:49:36 -0400 | [diff] [blame] | 275 | // EverInstallable returns true if the module is ever installable | 
|  | 276 | EverInstallable() bool | 
|  | 277 |  | 
|  | 278 | // PreventInstall returns true if this module is prevented from installation. | 
|  | 279 | PreventInstall() bool | 
|  | 280 |  | 
|  | 281 | // InstallInData returns true if this module is installed in data. | 
|  | 282 | InstallInData() bool | 
|  | 283 |  | 
|  | 284 | // Installable returns a bool pointer to the module installable property. | 
|  | 285 | Installable() *bool | 
|  | 286 |  | 
|  | 287 | // Symlinks returns a list of symlinks that should be created for this module. | 
|  | 288 | Symlinks() []string | 
|  | 289 |  | 
|  | 290 | // VndkVersion returns the VNDK version string for this module. | 
|  | 291 | VndkVersion() string | 
| Jihoon Kang | f78a890 | 2022-09-01 22:47:07 +0000 | [diff] [blame] | 292 |  | 
|  | 293 | // Partition returns the partition string for this module. | 
|  | 294 | Partition() string | 
| Ivan Lozano | 0f9963e | 2023-02-06 13:31:02 -0500 | [diff] [blame] | 295 |  | 
|  | 296 | // FuzzModule returns the fuzz.FuzzModule associated with the module. | 
|  | 297 | FuzzModuleStruct() fuzz.FuzzModule | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 298 | } | 
|  | 299 |  | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 300 | var ( | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 301 | // Dependency tag for crtbegin, an object file responsible for initialization. | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 302 | CrtBeginDepTag = dependencyTag{name: "crtbegin"} | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 303 | // Dependency tag for crtend, an object file responsible for program termination. | 
|  | 304 | CrtEndDepTag = dependencyTag{name: "crtend"} | 
|  | 305 | // Dependency tag for coverage library. | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 306 | CoverageDepTag = dependencyTag{name: "coverage"} | 
|  | 307 | ) | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 308 |  | 
| Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 309 | // GetImageVariantType returns the ImageVariantType string value for the given module | 
|  | 310 | // (these are defined in cc/image.go). | 
|  | 311 | func GetImageVariantType(c LinkableInterface) ImageVariantType { | 
|  | 312 | if c.Host() { | 
|  | 313 | return hostImageVariant | 
|  | 314 | } else if c.InVendor() { | 
|  | 315 | return vendorImageVariant | 
|  | 316 | } else if c.InProduct() { | 
|  | 317 | return productImageVariant | 
|  | 318 | } else if c.InRamdisk() { | 
|  | 319 | return ramdiskImageVariant | 
|  | 320 | } else if c.InVendorRamdisk() { | 
|  | 321 | return vendorRamdiskImageVariant | 
|  | 322 | } else if c.InRecovery() { | 
|  | 323 | return recoveryImageVariant | 
|  | 324 | } else { | 
|  | 325 | return coreImageVariant | 
|  | 326 | } | 
|  | 327 | } | 
|  | 328 |  | 
| Ivan Lozano | c08897c | 2021-04-02 12:41:32 -0400 | [diff] [blame] | 329 | // DepTagMakeSuffix returns the makeSuffix value of a particular library dependency tag. | 
|  | 330 | // Returns an empty string if not a library dependency tag. | 
|  | 331 | func DepTagMakeSuffix(depTag blueprint.DependencyTag) string { | 
|  | 332 | if libDepTag, ok := depTag.(libraryDependencyTag); ok { | 
|  | 333 | return libDepTag.makeSuffix | 
|  | 334 | } | 
|  | 335 | return "" | 
|  | 336 | } | 
|  | 337 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 338 | // SharedDepTag returns the dependency tag for any C++ shared libraries. | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 339 | func SharedDepTag() blueprint.DependencyTag { | 
|  | 340 | return libraryDependencyTag{Kind: sharedLibraryDependency} | 
| Ivan Lozano | 183a321 | 2019-10-18 14:18:45 -0700 | [diff] [blame] | 341 | } | 
|  | 342 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 343 | // StaticDepTag returns the dependency tag for any C++ static libraries. | 
| Ivan Lozano | 63bb768 | 2021-03-23 15:53:44 -0400 | [diff] [blame] | 344 | func StaticDepTag(wholeStatic bool) blueprint.DependencyTag { | 
|  | 345 | return libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: wholeStatic} | 
|  | 346 | } | 
|  | 347 |  | 
|  | 348 | // IsWholeStaticLib whether a dependency tag is a whole static library dependency. | 
|  | 349 | func IsWholeStaticLib(depTag blueprint.DependencyTag) bool { | 
|  | 350 | if tag, ok := depTag.(libraryDependencyTag); ok { | 
|  | 351 | return tag.wholeStatic | 
|  | 352 | } | 
|  | 353 | return false | 
| Colin Cross | 6e511a9 | 2020-07-27 21:26:48 -0700 | [diff] [blame] | 354 | } | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 355 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 356 | // HeaderDepTag returns the dependency tag for any C++ "header-only" libraries. | 
| Zach Johnson | 3df4e63 | 2020-11-06 11:56:27 -0800 | [diff] [blame] | 357 | func HeaderDepTag() blueprint.DependencyTag { | 
|  | 358 | return libraryDependencyTag{Kind: headerLibraryDependency} | 
|  | 359 | } | 
|  | 360 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 361 | // SharedLibraryInfo is a provider to propagate information about a shared C++ library. | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 362 | type SharedLibraryInfo struct { | 
| Liz Kammer | ef6dfea | 2021-06-08 15:37:09 -0400 | [diff] [blame] | 363 | SharedLibrary android.Path | 
|  | 364 | Target        android.Target | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 365 |  | 
| Liz Kammer | ef6dfea | 2021-06-08 15:37:09 -0400 | [diff] [blame] | 366 | TableOfContents android.OptionalPath | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 367 |  | 
| Liz Kammer | ef6dfea | 2021-06-08 15:37:09 -0400 | [diff] [blame] | 368 | // should be obtained from static analogue | 
| Colin Cross | c85750b | 2022-04-21 12:50:51 -0700 | [diff] [blame] | 369 | TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path] | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 370 | } | 
|  | 371 |  | 
| Colin Cross | bc7d76c | 2023-12-12 16:39:03 -0800 | [diff] [blame] | 372 | var SharedLibraryInfoProvider = blueprint.NewProvider[SharedLibraryInfo]() | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 373 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 374 | // SharedStubLibrary is a struct containing information about a stub shared library. | 
|  | 375 | // Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared | 
|  | 376 | // library in another APEX, it must depend on the stub version of that library. | 
|  | 377 | type SharedStubLibrary struct { | 
|  | 378 | // The version of the stub (corresponding to the stable version of the shared library being | 
|  | 379 | // stubbed). | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 380 | Version           string | 
|  | 381 | SharedLibraryInfo SharedLibraryInfo | 
|  | 382 | FlagExporterInfo  FlagExporterInfo | 
|  | 383 | } | 
|  | 384 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 385 | // SharedLibraryStubsInfo is a provider to propagate information about all shared library stubs | 
|  | 386 | // which are dependencies of a library. | 
|  | 387 | // Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared | 
|  | 388 | // library in another APEX, it must depend on the stub version of that library. | 
|  | 389 | type SharedLibraryStubsInfo struct { | 
|  | 390 | SharedStubLibraries []SharedStubLibrary | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 391 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 392 | IsLLNDK bool | 
|  | 393 | } | 
|  | 394 |  | 
| Colin Cross | bc7d76c | 2023-12-12 16:39:03 -0800 | [diff] [blame] | 395 | var SharedLibraryStubsProvider = blueprint.NewProvider[SharedLibraryStubsInfo]() | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 396 |  | 
|  | 397 | // StaticLibraryInfo is a provider to propagate information about a static C++ library. | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 398 | type StaticLibraryInfo struct { | 
|  | 399 | StaticLibrary android.Path | 
|  | 400 | Objects       Objects | 
|  | 401 | ReuseObjects  Objects | 
|  | 402 |  | 
| Colin Cross | a2bcf2c | 2022-02-11 13:11:55 -0800 | [diff] [blame] | 403 | // A static library may contain prebuilt static libraries included with whole_static_libs | 
|  | 404 | // that won't appear in Objects.  They are transitively available in | 
|  | 405 | // WholeStaticLibsFromPrebuilts. | 
|  | 406 | WholeStaticLibsFromPrebuilts android.Paths | 
|  | 407 |  | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 408 | // This isn't the actual transitive DepSet, shared library dependencies have been | 
|  | 409 | // converted into static library analogues.  It is only used to order the static | 
|  | 410 | // library dependencies that were specified for the current module. | 
| Colin Cross | c85750b | 2022-04-21 12:50:51 -0700 | [diff] [blame] | 411 | TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path] | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 412 | } | 
|  | 413 |  | 
| Colin Cross | bc7d76c | 2023-12-12 16:39:03 -0800 | [diff] [blame] | 414 | var StaticLibraryInfoProvider = blueprint.NewProvider[StaticLibraryInfo]() | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 415 |  | 
| Colin Cross | 649d817 | 2020-12-10 12:30:21 -0800 | [diff] [blame] | 416 | // HeaderLibraryInfo is a marker provider that identifies a module as a header library. | 
|  | 417 | type HeaderLibraryInfo struct { | 
|  | 418 | } | 
|  | 419 |  | 
|  | 420 | // HeaderLibraryInfoProvider is a marker provider that identifies a module as a header library. | 
| Colin Cross | bc7d76c | 2023-12-12 16:39:03 -0800 | [diff] [blame] | 421 | var HeaderLibraryInfoProvider = blueprint.NewProvider[HeaderLibraryInfo]() | 
| Colin Cross | 649d817 | 2020-12-10 12:30:21 -0800 | [diff] [blame] | 422 |  | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 423 | // FlagExporterInfo is a provider to propagate transitive library information | 
|  | 424 | // pertaining to exported include paths and flags. | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 425 | type FlagExporterInfo struct { | 
| Chris Parsons | 3c27ca3 | 2020-11-20 12:42:07 -0500 | [diff] [blame] | 426 | IncludeDirs       android.Paths // Include directories to be included with -I | 
|  | 427 | SystemIncludeDirs android.Paths // System include directories to be included with -isystem | 
|  | 428 | Flags             []string      // Exported raw flags. | 
| Colin Cross | 0de8a1e | 2020-09-18 14:15:30 -0700 | [diff] [blame] | 429 | Deps              android.Paths | 
|  | 430 | GeneratedHeaders  android.Paths | 
|  | 431 | } | 
|  | 432 |  | 
| Colin Cross | bc7d76c | 2023-12-12 16:39:03 -0800 | [diff] [blame] | 433 | var FlagExporterInfoProvider = blueprint.NewProvider[FlagExporterInfo]() |