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:
@@ -391,10 +391,12 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
|
||||
p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
|
||||
}
|
||||
|
||||
exportedInfo := ctx.SdkModuleContext().OtherModuleProvider(variant, FlagExporterInfoProvider).(FlagExporterInfo)
|
||||
|
||||
// Separate out the generated include dirs (which are arch specific) from the
|
||||
// include dirs (which may not be).
|
||||
exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
|
||||
ccModule.ExportedIncludeDirs(), isGeneratedHeaderDirectory)
|
||||
exportedInfo.IncludeDirs, isGeneratedHeaderDirectory)
|
||||
|
||||
p.name = variant.Name()
|
||||
p.archType = ccModule.Target().Arch.ArchType.String()
|
||||
@@ -405,10 +407,10 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
|
||||
|
||||
// Take a copy before filtering out duplicates to avoid changing the slice owned by the
|
||||
// ccModule.
|
||||
dirs := append(android.Paths(nil), ccModule.ExportedSystemIncludeDirs()...)
|
||||
dirs := append(android.Paths(nil), exportedInfo.SystemIncludeDirs...)
|
||||
p.ExportedSystemIncludeDirs = android.FirstUniquePaths(dirs)
|
||||
|
||||
p.ExportedFlags = ccModule.ExportedFlags()
|
||||
p.ExportedFlags = exportedInfo.Flags
|
||||
if ccModule.linker != nil {
|
||||
specifiedDeps := specifiedDeps{}
|
||||
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
|
||||
@@ -419,7 +421,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
|
||||
}
|
||||
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
|
||||
}
|
||||
p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()
|
||||
p.exportedGeneratedHeaders = exportedInfo.GeneratedHeaders
|
||||
|
||||
if ccModule.HasStubsVariants() {
|
||||
// TODO(b/169373910): 1. Only output the specific version (from
|
||||
|
Reference in New Issue
Block a user