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