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