Refactor cc/rust to prep for Rust stubs
This CL largely handles this refactoring in preparation for Rust stubs
support.
Rust modules need to be able to communicate stubs information to cc, and
certain bits of cc needs to be exported so rust can reuse them.
A new VersionedLinkableInterface is added to capture most of the
stubs-related interface definitions.
Bug: 203478530
Test: m blueprint_tests
Change-Id: I380225402fa85a3c39e7b18deb657054b3a52fbe
diff --git a/cc/linkable.go b/cc/linkable.go
index 78ea71c..d0fda64 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -53,6 +53,9 @@
// SanitizableDepTagChecker returns a SantizableDependencyTagChecker function type.
SanitizableDepTagChecker() SantizableDependencyTagChecker
+
+ // ForceDisableSanitizers sets the ForceDisable sanitize property
+ ForceDisableSanitizers()
}
// SantizableDependencyTagChecker functions check whether or not a dependency
@@ -63,6 +66,26 @@
// implementation should handle tags from both.
type SantizableDependencyTagChecker func(tag blueprint.DependencyTag) bool
+type VersionedLinkableInterface interface {
+ LinkableInterface
+ android.ApexModule
+
+ // VersionedInterface returns the VersionedInterface for this module
+ // (e.g. c.library), or nil if this is module is not a VersionedInterface.
+ VersionedInterface() VersionedInterface
+
+ // HasStubsVariants true if this module is a stub or has a sibling variant
+ // that is a stub.
+ HasStubsVariants() bool
+
+ // SetStl sets the stl property for CC modules. Does not panic if for other module types.
+ SetStl(string)
+ SetSdkVersion(string)
+ SetMinSdkVersion(version string)
+ ApexSdkVersion() android.ApiLevel
+ ImplementationModuleNameForMake(ctx android.BaseModuleContext) string
+}
+
// LinkableInterface is an interface for a type of module that is linkable in a C++ library.
type LinkableInterface interface {
android.Module
@@ -132,28 +155,18 @@
// IsNdk returns true if the library is in the configs known NDK list.
IsNdk(config android.Config) bool
- // HasStubsVariants true if this module is a stub or has a sibling variant
- // that is a stub.
- HasStubsVariants() bool
-
// IsStubs returns true if the this is a stubs library.
IsStubs() bool
// IsLlndk returns true for both LLNDK (public) and LLNDK-private libs.
IsLlndk() bool
- // HasLlndkStubs returns true if this library has a variant that will build LLNDK stubs.
- HasLlndkStubs() bool
-
// NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers.
NeedsLlndkVariants() bool
// NeedsVendorPublicLibraryVariants returns true if this module has vendor public library stubs.
NeedsVendorPublicLibraryVariants() bool
- //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",
@@ -182,6 +195,7 @@
MinSdkVersion() string
AlwaysSdk() bool
IsSdkVariant() bool
+ Multilib() string
SplitPerApiLevel() bool
@@ -250,6 +264,7 @@
// FuzzModule returns the fuzz.FuzzModule associated with the module.
FuzzModuleStruct() fuzz.FuzzModule
+ IsCrt() bool
}
var (