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
diff --git a/cc/linkable.go b/cc/linkable.go
index a67cd4e..21e6f9b 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -14,13 +14,6 @@
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 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{})