2019-10-18 23:18:45 +02:00
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"android/soong/android"
|
2021-04-12 21:42:51 +02:00
|
|
|
"android/soong/bazel/cquery"
|
2023-02-06 19:31:02 +01:00
|
|
|
"android/soong/fuzz"
|
2021-07-07 05:42:39 +02:00
|
|
|
"android/soong/snapshot"
|
2020-07-28 06:26:48 +02:00
|
|
|
|
|
|
|
"github.com/google/blueprint"
|
2019-10-18 23:18:45 +02:00
|
|
|
)
|
|
|
|
|
2020-12-14 17:27:52 +01:00
|
|
|
// PlatformSanitizeable is an interface for sanitizing platform modules.
|
|
|
|
type PlatformSanitizeable interface {
|
|
|
|
LinkableInterface
|
|
|
|
|
|
|
|
// SanitizePropDefined returns whether the Sanitizer properties struct for this module is defined.
|
|
|
|
SanitizePropDefined() bool
|
|
|
|
|
|
|
|
// IsSanitizerEnabled returns whether a sanitizer is enabled.
|
|
|
|
IsSanitizerEnabled(t SanitizerType) bool
|
|
|
|
|
|
|
|
// IsSanitizerExplicitlyDisabled returns whether a sanitizer has been explicitly disabled (set to false) rather
|
|
|
|
// than left undefined.
|
|
|
|
IsSanitizerExplicitlyDisabled(t SanitizerType) bool
|
|
|
|
|
|
|
|
// SetSanitizer enables or disables the specified sanitizer type if it's supported, otherwise this should panic.
|
|
|
|
SetSanitizer(t SanitizerType, b bool)
|
|
|
|
|
|
|
|
// StaticallyLinked returns true if the module is statically linked.
|
|
|
|
StaticallyLinked() bool
|
|
|
|
|
|
|
|
// SetInSanitizerDir sets the module installation to the sanitizer directory.
|
|
|
|
SetInSanitizerDir()
|
|
|
|
|
|
|
|
// SanitizeNever returns true if this module should never be sanitized.
|
|
|
|
SanitizeNever() bool
|
|
|
|
|
|
|
|
// SanitizerSupported returns true if a sanitizer type is supported by this modules compiler.
|
|
|
|
SanitizerSupported(t SanitizerType) bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// MinimalRuntimeDep returns true if this module needs to link the minimal UBSan runtime,
|
|
|
|
// either because it requires it or because a dependent module which requires it to be linked in this module.
|
|
|
|
MinimalRuntimeDep() bool
|
|
|
|
|
|
|
|
// UbsanRuntimeDep returns true if this module needs to link the full UBSan runtime,
|
|
|
|
// either because it requires it or because a dependent module which requires it to be linked in this module.
|
|
|
|
UbsanRuntimeDep() bool
|
|
|
|
|
|
|
|
// UbsanRuntimeNeeded returns true if the full UBSan runtime is required by this module.
|
|
|
|
UbsanRuntimeNeeded() bool
|
|
|
|
|
|
|
|
// MinimalRuntimeNeeded returns true if the minimal UBSan runtime is required by this module
|
|
|
|
MinimalRuntimeNeeded() bool
|
|
|
|
|
2020-12-14 17:27:52 +01:00
|
|
|
// SanitizableDepTagChecker returns a SantizableDependencyTagChecker function type.
|
|
|
|
SanitizableDepTagChecker() SantizableDependencyTagChecker
|
|
|
|
}
|
|
|
|
|
|
|
|
// SantizableDependencyTagChecker functions check whether or not a dependency
|
|
|
|
// tag can be sanitized. These functions should return true if the tag can be
|
|
|
|
// sanitized, otherwise they should return false. These functions should also
|
|
|
|
// handle all possible dependency tags in the dependency tree. For example,
|
|
|
|
// Rust modules can depend on both Rust and CC libraries, so the Rust module
|
|
|
|
// implementation should handle tags from both.
|
|
|
|
type SantizableDependencyTagChecker func(tag blueprint.DependencyTag) bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// Snapshottable defines those functions necessary for handling module snapshots.
|
|
|
|
type Snapshottable interface {
|
2021-07-07 05:42:39 +02:00
|
|
|
snapshot.VendorSnapshotModuleInterface
|
|
|
|
snapshot.RecoverySnapshotModuleInterface
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// SnapshotHeaders returns a list of header paths provided by this module.
|
|
|
|
SnapshotHeaders() android.Paths
|
|
|
|
|
|
|
|
// SnapshotLibrary returns true if this module is a snapshot library.
|
|
|
|
IsSnapshotLibrary() bool
|
|
|
|
|
2021-06-29 13:34:53 +02:00
|
|
|
// EffectiveLicenseFiles returns the list of License files for this module.
|
|
|
|
EffectiveLicenseFiles() android.Paths
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// SnapshotRuntimeLibs returns a list of libraries needed by this module at runtime but which aren't build dependencies.
|
|
|
|
SnapshotRuntimeLibs() []string
|
|
|
|
|
|
|
|
// SnapshotSharedLibs returns the list of shared library dependencies for this module.
|
|
|
|
SnapshotSharedLibs() []string
|
|
|
|
|
2021-06-29 13:50:37 +02:00
|
|
|
// SnapshotStaticLibs returns the list of static library dependencies for this module.
|
|
|
|
SnapshotStaticLibs() []string
|
|
|
|
|
2023-07-13 17:01:41 +02:00
|
|
|
// SnapshotDylibs returns the list of dylib library dependencies for this module.
|
|
|
|
SnapshotDylibs() []string
|
|
|
|
|
|
|
|
// SnapshotRlibs returns the list of rlib library dependencies for this module.
|
|
|
|
SnapshotRlibs() []string
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// IsSnapshotPrebuilt returns true if this module is a snapshot prebuilt.
|
|
|
|
IsSnapshotPrebuilt() bool
|
2023-08-23 20:20:25 +02:00
|
|
|
|
|
|
|
// IsSnapshotSanitizer returns true if this snapshot module implements SnapshotSanitizer.
|
|
|
|
IsSnapshotSanitizer() bool
|
|
|
|
|
|
|
|
// IsSnapshotSanitizerAvailable returns true if this snapshot module has a sanitizer source available (cfi, hwasan).
|
|
|
|
IsSnapshotSanitizerAvailable(t SanitizerType) bool
|
|
|
|
|
|
|
|
// SetSnapshotSanitizerVariation sets the sanitizer variation type for this snapshot module.
|
|
|
|
SetSnapshotSanitizerVariation(t SanitizerType, enabled bool)
|
|
|
|
|
|
|
|
// IsSnapshotUnsanitizedVariant returns true if this is the unsanitized snapshot module variant.
|
|
|
|
IsSnapshotUnsanitizedVariant() bool
|
2021-04-01 15:49:36 +02:00
|
|
|
}
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// LinkableInterface is an interface for a type of module that is linkable in a C++ library.
|
2019-10-18 23:18:45 +02:00
|
|
|
type LinkableInterface interface {
|
2020-12-02 15:00:51 +01:00
|
|
|
android.Module
|
2021-04-01 15:49:36 +02:00
|
|
|
Snapshottable
|
2020-12-02 15:00:51 +01:00
|
|
|
|
2019-10-18 23:18:45 +02:00
|
|
|
Module() android.Module
|
|
|
|
CcLibrary() bool
|
|
|
|
CcLibraryInterface() bool
|
|
|
|
|
2023-06-09 20:06:44 +02:00
|
|
|
// RustLibraryInterface returns true if this is a Rust library module
|
|
|
|
RustLibraryInterface() bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// BaseModuleName returns the android.ModuleBase.BaseModuleName() value for this module.
|
|
|
|
BaseModuleName() string
|
|
|
|
|
2019-10-18 23:18:45 +02:00
|
|
|
OutputFile() android.OptionalPath
|
2021-10-14 18:22:09 +02:00
|
|
|
UnstrippedOutputFile() android.Path
|
2020-04-09 15:56:02 +02:00
|
|
|
CoverageFiles() android.Paths
|
2019-10-18 23:18:45 +02:00
|
|
|
|
2022-06-27 22:00:26 +02:00
|
|
|
// CoverageOutputFile returns the output archive of gcno coverage information files.
|
|
|
|
CoverageOutputFile() android.OptionalPath
|
|
|
|
|
2019-11-21 21:30:50 +01:00
|
|
|
NonCcVariants() bool
|
|
|
|
|
2019-10-18 23:49:46 +02:00
|
|
|
SelectedStl() string
|
2019-10-18 23:18:45 +02:00
|
|
|
|
|
|
|
BuildStaticVariant() bool
|
|
|
|
BuildSharedVariant() bool
|
|
|
|
SetStatic()
|
|
|
|
SetShared()
|
2020-12-14 17:27:52 +01:00
|
|
|
IsPrebuilt() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
Toc() android.OptionalPath
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
// IsFuzzModule returns true if this a *_fuzz module.
|
|
|
|
IsFuzzModule() bool
|
|
|
|
|
|
|
|
// FuzzPackagedModule returns the fuzz.FuzzPackagedModule for this module.
|
|
|
|
// Expects that IsFuzzModule returns true.
|
|
|
|
FuzzPackagedModule() fuzz.FuzzPackagedModule
|
|
|
|
|
|
|
|
// FuzzSharedLibraries returns the shared library dependencies for this module.
|
|
|
|
// Expects that IsFuzzModule returns true.
|
2023-04-06 00:08:46 +02:00
|
|
|
FuzzSharedLibraries() android.RuleBuilderInstalls
|
2023-02-06 19:31:02 +01:00
|
|
|
|
2021-07-02 15:21:13 +02:00
|
|
|
Device() bool
|
2020-04-10 05:57:24 +02:00
|
|
|
Host() bool
|
|
|
|
|
2020-01-22 00:53:22 +01:00
|
|
|
InRamdisk() bool
|
|
|
|
OnlyInRamdisk() bool
|
|
|
|
|
2020-10-22 00:17:56 +02:00
|
|
|
InVendorRamdisk() bool
|
|
|
|
OnlyInVendorRamdisk() bool
|
|
|
|
|
2019-10-18 23:49:46 +02:00
|
|
|
InRecovery() bool
|
|
|
|
OnlyInRecovery() bool
|
|
|
|
|
2020-12-14 17:27:52 +01:00
|
|
|
InVendor() bool
|
|
|
|
|
2020-04-07 18:50:32 +02:00
|
|
|
UseSdk() bool
|
2021-03-30 18:19:36 +02:00
|
|
|
|
2022-06-27 22:00:26 +02:00
|
|
|
// IsNdk returns true if the library is in the configs known NDK list.
|
|
|
|
IsNdk(config android.Config) bool
|
|
|
|
|
|
|
|
// IsStubs returns true if the this is a stubs library.
|
|
|
|
IsStubs() bool
|
|
|
|
|
2021-03-30 18:19:36 +02:00
|
|
|
// IsLlndk returns true for both LLNDK (public) and LLNDK-private libs.
|
2020-12-17 01:46:01 +01:00
|
|
|
IsLlndk() bool
|
2021-03-30 18:19:36 +02:00
|
|
|
|
|
|
|
// IsLlndkPublic returns true only for LLNDK (public) libs.
|
2020-12-17 01:46:01 +01:00
|
|
|
IsLlndkPublic() bool
|
2021-03-30 18:19:36 +02:00
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// HasLlndkStubs returns true if this library has a variant that will build LLNDK stubs.
|
|
|
|
HasLlndkStubs() bool
|
|
|
|
|
2021-04-27 03:37:44 +02:00
|
|
|
// NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers.
|
|
|
|
NeedsLlndkVariants() bool
|
2021-03-30 18:19:36 +02:00
|
|
|
|
2021-04-27 22:06:04 +02:00
|
|
|
// NeedsVendorPublicLibraryVariants returns true if this module has vendor public library stubs.
|
|
|
|
NeedsVendorPublicLibraryVariants() bool
|
2021-03-30 18:19:36 +02:00
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
//StubsVersion returns the stubs version for this module.
|
|
|
|
StubsVersion() string
|
|
|
|
|
|
|
|
// UseVndk returns true if the module is using VNDK libraries instead of the libraries in /system/lib or /system/lib64.
|
|
|
|
// "product" and "vendor" variant modules return true for this function.
|
|
|
|
// When BOARD_VNDK_VERSION is set, vendor variants of "vendor_available: true", "vendor: true",
|
|
|
|
// "soc_specific: true" and more vendor installed modules are included here.
|
|
|
|
// When PRODUCT_PRODUCT_VNDK_VERSION is set, product variants of "vendor_available: true" or
|
|
|
|
// "product_specific: true" modules are included here.
|
2021-03-30 18:19:36 +02:00
|
|
|
UseVndk() bool
|
2021-04-01 15:49:36 +02:00
|
|
|
|
2021-06-11 10:22:09 +02:00
|
|
|
// Bootstrap tests if this module is allowed to use non-APEX version of libraries.
|
|
|
|
Bootstrap() bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// IsVndkSp returns true if this is a VNDK-SP module.
|
|
|
|
IsVndkSp() bool
|
|
|
|
|
2021-03-30 18:19:36 +02:00
|
|
|
MustUseVendorVariant() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
IsVndk() bool
|
2020-12-02 15:00:51 +01:00
|
|
|
IsVndkExt() bool
|
2020-12-17 01:46:01 +01:00
|
|
|
IsVndkPrivate() bool
|
2022-04-12 19:08:36 +02:00
|
|
|
IsVendorPublicLibrary() bool
|
|
|
|
IsVndkPrebuiltLibrary() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
HasVendorVariant() bool
|
2021-02-03 11:24:13 +01:00
|
|
|
HasProductVariant() bool
|
|
|
|
HasNonSystemVariants() bool
|
2022-04-12 19:08:36 +02:00
|
|
|
ProductSpecific() bool
|
2020-12-02 15:00:51 +01:00
|
|
|
InProduct() bool
|
2022-04-12 19:08:36 +02:00
|
|
|
SdkAndPlatformVariantVisibleToMake() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
|
2021-04-02 18:41:32 +02:00
|
|
|
// SubName returns the modules SubName, used for image and NDK/SDK variations.
|
|
|
|
SubName() string
|
|
|
|
|
2019-10-18 23:49:46 +02:00
|
|
|
SdkVersion() string
|
2021-03-19 14:18:04 +01:00
|
|
|
MinSdkVersion() string
|
2020-04-07 18:50:32 +02:00
|
|
|
AlwaysSdk() bool
|
Don't create version variants for SDK variants
When a lib has sdk_version set, an SDK variant and a platform variant
are created by the sdkMutator. Then by the versionMutator, if the
library had 'stubs.versions' property, one or more versioned variants
and one impl variant are created for each of the two (SDK and platform)
variants. As a concrete example,
cc_library {
name: "foo",
sdk_version: "current",
stubs: { versions: ["1", "2"], },
}
would create 6 variants:
1) (sdk: "", version: "")
2) (sdk: "", version: "1")
3) (sdk: "", version: "2")
4) (sdk: "sdk", version: "")
5) (sdk: "sdk", version: "1")
6) (sdk: "sdk", version: "2")
This is somewhat uncessary because the need for the SDK mutator is to
have the platform variant (sdk:"") of a lib where sdk_version is unset,
which actually makes sens for the impl variant (version:""), but not
the versioned variants (version:"1" or version:"2").
This is not only unncessary, but also causes duplicate module
definitions in the Make side when doing an unbundled build. Specifically,
The #1 and #4 above both are emitted to Make and get the same name
"foo".
To fix the problem and not to create unnecessary variants, the versioned
variants are no longer created for the sdk variant. So, foo now has
the following variants only.
1) (sdk: "", version: "") // not emitted to Make (by versionMutator)
2) (sdk: "", version: "1") // not emitted to Make (by versionMutator)
3) (sdk: "", version: "2") // emitted to Make (by versionMutator)
4) (sdk: "sdk", version: "") // not emitted to Make (by versionMutator)
Bug: 159106705
Test: Add sdk_version:"minimum" to libnativehelper in libnativehelper/Android.bp.
m SOONG_ALLOW_MISSING_DEPENDENCIES=true TARGET_BUILD_UNBUNDLED=true libnativehelper
Change-Id: I6f02f4189e5504286174ccff1642166da82d00c9
2020-06-16 14:58:53 +02:00
|
|
|
IsSdkVariant() bool
|
2019-10-18 23:49:46 +02:00
|
|
|
|
2020-10-01 22:37:16 +02:00
|
|
|
SplitPerApiLevel() bool
|
2020-12-14 17:27:52 +01:00
|
|
|
|
|
|
|
// SetPreventInstall sets the PreventInstall property to 'true' for this module.
|
|
|
|
SetPreventInstall()
|
|
|
|
// SetHideFromMake sets the HideFromMake property to 'true' for this module.
|
|
|
|
SetHideFromMake()
|
2021-03-30 18:19:36 +02:00
|
|
|
|
|
|
|
// KernelHeadersDecorator returns true if this is a kernel headers decorator module.
|
|
|
|
// This is specific to cc and should always return false for all other packages.
|
|
|
|
KernelHeadersDecorator() bool
|
2021-04-01 15:49:36 +02:00
|
|
|
|
|
|
|
// HiddenFromMake returns true if this module is hidden from Make.
|
|
|
|
HiddenFromMake() bool
|
|
|
|
|
|
|
|
// RelativeInstallPath returns the relative install path for this module.
|
|
|
|
RelativeInstallPath() string
|
|
|
|
|
|
|
|
// Binary returns true if this is a binary module.
|
|
|
|
Binary() bool
|
|
|
|
|
|
|
|
// Object returns true if this is an object module.
|
|
|
|
Object() bool
|
|
|
|
|
|
|
|
// Rlib returns true if this is an rlib module.
|
|
|
|
Rlib() bool
|
|
|
|
|
|
|
|
// Dylib returns true if this is an dylib module.
|
|
|
|
Dylib() bool
|
|
|
|
|
2023-07-13 17:01:41 +02:00
|
|
|
// RlibStd returns true if this is an rlib which links against an rlib libstd.
|
|
|
|
RlibStd() bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// Static returns true if this is a static library module.
|
|
|
|
Static() bool
|
|
|
|
|
|
|
|
// Shared returns true if this is a shared library module.
|
|
|
|
Shared() bool
|
|
|
|
|
|
|
|
// Header returns true if this is a library headers module.
|
|
|
|
Header() bool
|
|
|
|
|
2021-06-29 13:50:37 +02:00
|
|
|
// StaticExecutable returns true if this is a binary module with "static_executable: true".
|
|
|
|
StaticExecutable() bool
|
|
|
|
|
2021-04-01 15:49:36 +02:00
|
|
|
// EverInstallable returns true if the module is ever installable
|
|
|
|
EverInstallable() bool
|
|
|
|
|
|
|
|
// PreventInstall returns true if this module is prevented from installation.
|
|
|
|
PreventInstall() bool
|
|
|
|
|
|
|
|
// InstallInData returns true if this module is installed in data.
|
|
|
|
InstallInData() bool
|
|
|
|
|
|
|
|
// Installable returns a bool pointer to the module installable property.
|
|
|
|
Installable() *bool
|
|
|
|
|
|
|
|
// Symlinks returns a list of symlinks that should be created for this module.
|
|
|
|
Symlinks() []string
|
|
|
|
|
|
|
|
// VndkVersion returns the VNDK version string for this module.
|
|
|
|
VndkVersion() string
|
2022-09-02 00:47:07 +02:00
|
|
|
|
|
|
|
// Partition returns the partition string for this module.
|
|
|
|
Partition() string
|
2023-02-06 19:31:02 +01:00
|
|
|
|
|
|
|
// FuzzModule returns the fuzz.FuzzModule associated with the module.
|
|
|
|
FuzzModuleStruct() fuzz.FuzzModule
|
2019-10-18 23:18:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2020-11-20 18:42:07 +01:00
|
|
|
// Dependency tag for crtbegin, an object file responsible for initialization.
|
2020-07-28 06:26:48 +02:00
|
|
|
CrtBeginDepTag = dependencyTag{name: "crtbegin"}
|
2020-11-20 18:42:07 +01:00
|
|
|
// Dependency tag for crtend, an object file responsible for program termination.
|
|
|
|
CrtEndDepTag = dependencyTag{name: "crtend"}
|
|
|
|
// Dependency tag for coverage library.
|
2020-07-28 06:26:48 +02:00
|
|
|
CoverageDepTag = dependencyTag{name: "coverage"}
|
|
|
|
)
|
2019-10-18 23:18:45 +02:00
|
|
|
|
2020-12-14 17:27:52 +01:00
|
|
|
// GetImageVariantType returns the ImageVariantType string value for the given module
|
|
|
|
// (these are defined in cc/image.go).
|
|
|
|
func GetImageVariantType(c LinkableInterface) ImageVariantType {
|
|
|
|
if c.Host() {
|
|
|
|
return hostImageVariant
|
|
|
|
} else if c.InVendor() {
|
|
|
|
return vendorImageVariant
|
|
|
|
} else if c.InProduct() {
|
|
|
|
return productImageVariant
|
|
|
|
} else if c.InRamdisk() {
|
|
|
|
return ramdiskImageVariant
|
|
|
|
} else if c.InVendorRamdisk() {
|
|
|
|
return vendorRamdiskImageVariant
|
|
|
|
} else if c.InRecovery() {
|
|
|
|
return recoveryImageVariant
|
|
|
|
} else {
|
|
|
|
return coreImageVariant
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-02 18:41:32 +02:00
|
|
|
// DepTagMakeSuffix returns the makeSuffix value of a particular library dependency tag.
|
|
|
|
// Returns an empty string if not a library dependency tag.
|
|
|
|
func DepTagMakeSuffix(depTag blueprint.DependencyTag) string {
|
|
|
|
if libDepTag, ok := depTag.(libraryDependencyTag); ok {
|
|
|
|
return libDepTag.makeSuffix
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// SharedDepTag returns the dependency tag for any C++ shared libraries.
|
2020-07-28 06:26:48 +02:00
|
|
|
func SharedDepTag() blueprint.DependencyTag {
|
|
|
|
return libraryDependencyTag{Kind: sharedLibraryDependency}
|
|
|
|
}
|
shared_lib dependency from a static lib crosses the APEX boundary
cc_library_static {
name: "libfoo",
shared_libs: ["libbar"],
}
cc_library {
name: "libbar",
}
If libfoo is part of an APEX, then libbar is no longer considered as a
member of the APEX, because it isn't actually linked to libfoo.
To distinguish such a shared lib dependency from a static library from a
shared lib dependency from a shared library, a new dep type
SharedFromStaticDepTag is introduced. It is treated exactly the same as
SharedDepTag, except when we determine whether a dependency is crossing
the APEX boundary or not.
This allows us to check the apex_available property more correctly.
Previously, modules were incorrectly considered as being used for an
APEX due to the shared lib dependency from a static lib.
As a good side effect, this also reduces the number of APEX variants.
Specifically, on aosp_arm64, the number of the generated modules were
reduced from 44745 to 44180.
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 147671264
Test: m
Merged-In: I899ccb9eae1574effef77ca1bc3a0df145983861
(cherry picked from commit 931b676a69c092451ed25a5dda67accf90ce6457)
Change-Id: I899ccb9eae1574effef77ca1bc3a0df145983861
2020-01-16 09:14:23 +01:00
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// StaticDepTag returns the dependency tag for any C++ static libraries.
|
2021-03-23 20:53:44 +01:00
|
|
|
func StaticDepTag(wholeStatic bool) blueprint.DependencyTag {
|
|
|
|
return libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: wholeStatic}
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsWholeStaticLib whether a dependency tag is a whole static library dependency.
|
|
|
|
func IsWholeStaticLib(depTag blueprint.DependencyTag) bool {
|
|
|
|
if tag, ok := depTag.(libraryDependencyTag); ok {
|
|
|
|
return tag.wholeStatic
|
|
|
|
}
|
|
|
|
return false
|
2020-07-28 06:26:48 +02:00
|
|
|
}
|
2020-09-18 23:15:30 +02:00
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// HeaderDepTag returns the dependency tag for any C++ "header-only" libraries.
|
2020-11-06 20:56:27 +01:00
|
|
|
func HeaderDepTag() blueprint.DependencyTag {
|
|
|
|
return libraryDependencyTag{Kind: headerLibraryDependency}
|
|
|
|
}
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// SharedLibraryInfo is a provider to propagate information about a shared C++ library.
|
2020-09-18 23:15:30 +02:00
|
|
|
type SharedLibraryInfo struct {
|
2021-06-08 21:37:09 +02:00
|
|
|
SharedLibrary android.Path
|
|
|
|
Target android.Target
|
2020-09-18 23:15:30 +02:00
|
|
|
|
2021-06-08 21:37:09 +02:00
|
|
|
TableOfContents android.OptionalPath
|
2020-09-18 23:15:30 +02:00
|
|
|
|
2021-06-08 21:37:09 +02:00
|
|
|
// should be obtained from static analogue
|
2022-04-21 21:50:51 +02:00
|
|
|
TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
2020-09-18 23:15:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{})
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// SharedStubLibrary is a struct containing information about a stub shared library.
|
|
|
|
// Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared
|
|
|
|
// library in another APEX, it must depend on the stub version of that library.
|
|
|
|
type SharedStubLibrary struct {
|
|
|
|
// The version of the stub (corresponding to the stable version of the shared library being
|
|
|
|
// stubbed).
|
2020-09-18 23:15:30 +02:00
|
|
|
Version string
|
|
|
|
SharedLibraryInfo SharedLibraryInfo
|
|
|
|
FlagExporterInfo FlagExporterInfo
|
|
|
|
}
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// SharedLibraryStubsInfo is a provider to propagate information about all shared library stubs
|
|
|
|
// which are dependencies of a library.
|
|
|
|
// Stub libraries are used for cross-APEX dependencies; when a library is to depend on a shared
|
|
|
|
// library in another APEX, it must depend on the stub version of that library.
|
|
|
|
type SharedLibraryStubsInfo struct {
|
|
|
|
SharedStubLibraries []SharedStubLibrary
|
|
|
|
|
|
|
|
IsLLNDK bool
|
|
|
|
}
|
|
|
|
|
|
|
|
var SharedLibraryStubsProvider = blueprint.NewProvider(SharedLibraryStubsInfo{})
|
2020-09-18 23:15:30 +02:00
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// StaticLibraryInfo is a provider to propagate information about a static C++ library.
|
2020-09-18 23:15:30 +02:00
|
|
|
type StaticLibraryInfo struct {
|
|
|
|
StaticLibrary android.Path
|
|
|
|
Objects Objects
|
|
|
|
ReuseObjects Objects
|
|
|
|
|
2022-02-11 22:11:55 +01:00
|
|
|
// A static library may contain prebuilt static libraries included with whole_static_libs
|
|
|
|
// that won't appear in Objects. They are transitively available in
|
|
|
|
// WholeStaticLibsFromPrebuilts.
|
|
|
|
WholeStaticLibsFromPrebuilts android.Paths
|
|
|
|
|
2020-09-18 23:15:30 +02:00
|
|
|
// This isn't the actual transitive DepSet, shared library dependencies have been
|
|
|
|
// converted into static library analogues. It is only used to order the static
|
|
|
|
// library dependencies that were specified for the current module.
|
2022-04-21 21:50:51 +02:00
|
|
|
TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
2020-09-18 23:15:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{})
|
|
|
|
|
2020-12-10 21:30:21 +01:00
|
|
|
// HeaderLibraryInfo is a marker provider that identifies a module as a header library.
|
|
|
|
type HeaderLibraryInfo struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// HeaderLibraryInfoProvider is a marker provider that identifies a module as a header library.
|
|
|
|
var HeaderLibraryInfoProvider = blueprint.NewProvider(HeaderLibraryInfo{})
|
|
|
|
|
2020-11-20 18:42:07 +01:00
|
|
|
// FlagExporterInfo is a provider to propagate transitive library information
|
|
|
|
// pertaining to exported include paths and flags.
|
2020-09-18 23:15:30 +02:00
|
|
|
type FlagExporterInfo struct {
|
2020-11-20 18:42:07 +01:00
|
|
|
IncludeDirs android.Paths // Include directories to be included with -I
|
|
|
|
SystemIncludeDirs android.Paths // System include directories to be included with -isystem
|
|
|
|
Flags []string // Exported raw flags.
|
2020-09-18 23:15:30 +02:00
|
|
|
Deps android.Paths
|
|
|
|
GeneratedHeaders android.Paths
|
|
|
|
}
|
|
|
|
|
|
|
|
var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{})
|
2021-04-12 21:42:51 +02:00
|
|
|
|
|
|
|
// flagExporterInfoFromCcInfo populates FlagExporterInfo provider with information from Bazel.
|
|
|
|
func flagExporterInfoFromCcInfo(ctx android.ModuleContext, ccInfo cquery.CcInfo) FlagExporterInfo {
|
|
|
|
|
|
|
|
includes := android.PathsForBazelOut(ctx, ccInfo.Includes)
|
|
|
|
systemIncludes := android.PathsForBazelOut(ctx, ccInfo.SystemIncludes)
|
2021-12-06 20:56:25 +01:00
|
|
|
headers := android.PathsForBazelOut(ctx, ccInfo.Headers)
|
2021-04-12 21:42:51 +02:00
|
|
|
|
|
|
|
return FlagExporterInfo{
|
2021-04-27 20:48:30 +02:00
|
|
|
IncludeDirs: android.FirstUniquePaths(includes),
|
|
|
|
SystemIncludeDirs: android.FirstUniquePaths(systemIncludes),
|
2021-12-06 20:56:25 +01:00
|
|
|
GeneratedHeaders: headers,
|
|
|
|
// necessary to ensure generated headers are considered implicit deps of dependent actions
|
|
|
|
Deps: headers,
|
2021-04-12 21:42:51 +02:00
|
|
|
}
|
|
|
|
}
|