Start using Providers instead of direct module access

Export information about static libraries, shared libraries and
exported flags through Providers instead of accessing the module
directly.  Much more is left to be converted, but this significantly
simplifies the dependencies on libraries with stubs by making it easy
for a module to masquerade as another by simply exporting the
providers from the other module.  Instead of depending on all the
versions of a library and then picking which one to use later, it
can depend only on the implementation variant and then select the
right SharedLibraryInfo from the variant.

Test: m checkbuild
Test: only expected changes to build.ninja
Change-Id: I1fd9eb4d251cf96ed8398d586efc3e0817663c76
This commit is contained in:
Colin Cross
2020-09-18 14:15:30 -07:00
parent ff8838cb86
commit 0de8a1e17b
20 changed files with 509 additions and 560 deletions

View File

@@ -14,13 +14,6 @@ type LinkableInterface interface {
OutputFile() android.OptionalPath
CoverageFiles() android.Paths
IncludeDirs() android.Paths
SetDepsInLinkOrder([]android.Path)
GetDepsInLinkOrder() []android.Path
HasStaticVariant() bool
GetStaticVariant() LinkableInterface
NonCcVariants() bool
StubsVersions() []string
@@ -80,3 +73,54 @@ func SharedDepTag() blueprint.DependencyTag {
func StaticDepTag() blueprint.DependencyTag {
return libraryDependencyTag{Kind: staticLibraryDependency}
}
type SharedLibraryInfo struct {
SharedLibrary android.Path
UnstrippedSharedLibrary android.Path
TableOfContents android.OptionalPath
CoverageSharedLibrary android.OptionalPath
StaticAnalogue *StaticLibraryInfo
}
var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{})
type SharedLibraryImplementationStubsInfo struct {
SharedLibraryStubsInfos []SharedLibraryStubsInfo
IsLLNDK bool
}
var SharedLibraryImplementationStubsInfoProvider = blueprint.NewProvider(SharedLibraryImplementationStubsInfo{})
type SharedLibraryStubsInfo struct {
Version string
SharedLibraryInfo SharedLibraryInfo
FlagExporterInfo FlagExporterInfo
}
var SharedLibraryStubsInfoProvider = blueprint.NewProvider(SharedLibraryStubsInfo{})
type StaticLibraryInfo struct {
StaticLibrary android.Path
Objects Objects
ReuseObjects Objects
// 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.
TransitiveStaticLibrariesForOrdering *android.DepSet
}
var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{})
type FlagExporterInfo struct {
IncludeDirs android.Paths
SystemIncludeDirs android.Paths
Flags []string
Deps android.Paths
GeneratedHeaders android.Paths
}
var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{})