Merge "Only store what's used in SharedLibraryInfo" am: 75851d2fb6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1730553

Change-Id: I9ef1100bc430cffaa4d44f8a906ee7f41ec4c16b
This commit is contained in:
Treehugger Robot
2021-06-09 06:06:23 +00:00
committed by Automerger Merge Worker
8 changed files with 23 additions and 31 deletions

View File

@@ -2922,8 +2922,8 @@ func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLi
transitiveStaticLibsBuilder.Transitive(staticDep.TransitiveStaticLibrariesForOrdering) transitiveStaticLibsBuilder.Transitive(staticDep.TransitiveStaticLibrariesForOrdering)
} }
for _, sharedDep := range sharedDeps { for _, sharedDep := range sharedDeps {
if sharedDep.StaticAnalogue != nil { if sharedDep.TransitiveStaticLibrariesForOrdering != nil {
transitiveStaticLibsBuilder.Transitive(sharedDep.StaticAnalogue.TransitiveStaticLibrariesForOrdering) transitiveStaticLibsBuilder.Transitive(sharedDep.TransitiveStaticLibrariesForOrdering)
} }
} }
transitiveStaticLibs := transitiveStaticLibsBuilder.Build() transitiveStaticLibs := transitiveStaticLibsBuilder.Build()

View File

@@ -1354,19 +1354,17 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
library.coverageOutputFile = transformCoverageFilesToZip(ctx, objs, library.getLibName(ctx)) library.coverageOutputFile = transformCoverageFilesToZip(ctx, objs, library.getLibName(ctx))
library.linkSAbiDumpFiles(ctx, objs, fileName, unstrippedOutputFile) library.linkSAbiDumpFiles(ctx, objs, fileName, unstrippedOutputFile)
var staticAnalogue *StaticLibraryInfo var transitiveStaticLibrariesForOrdering *android.DepSet
if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 { if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 {
s := ctx.OtherModuleProvider(static[0], StaticLibraryInfoProvider).(StaticLibraryInfo) s := ctx.OtherModuleProvider(static[0], StaticLibraryInfoProvider).(StaticLibraryInfo)
staticAnalogue = &s transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering
} }
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
TableOfContents: android.OptionalPathForPath(tocFile), TableOfContents: android.OptionalPathForPath(tocFile),
SharedLibrary: unstrippedOutputFile, SharedLibrary: unstrippedOutputFile,
UnstrippedSharedLibrary: library.unstrippedOutputFile, TransitiveStaticLibrariesForOrdering: transitiveStaticLibrariesForOrdering,
CoverageSharedLibrary: library.coverageOutputFile, Target: ctx.Target(),
StaticAnalogue: staticAnalogue,
Target: ctx.Target(),
}) })
stubs := ctx.GetDirectDepsWithTag(stubImplDepTag) stubs := ctx.GetDirectDepsWithTag(stubImplDepTag)

View File

@@ -305,14 +305,13 @@ func HeaderDepTag() blueprint.DependencyTag {
// SharedLibraryInfo is a provider to propagate information about a shared C++ library. // SharedLibraryInfo is a provider to propagate information about a shared C++ library.
type SharedLibraryInfo struct { type SharedLibraryInfo struct {
SharedLibrary android.Path SharedLibrary android.Path
UnstrippedSharedLibrary android.Path Target android.Target
Target android.Target
TableOfContents android.OptionalPath TableOfContents android.OptionalPath
CoverageSharedLibrary android.OptionalPath
StaticAnalogue *StaticLibraryInfo // should be obtained from static analogue
TransitiveStaticLibrariesForOrdering *android.DepSet
} }
var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{}) var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{})

View File

@@ -186,9 +186,8 @@ func (ndk *ndkPrebuiltStlLinker) link(ctx ModuleContext, flags Flags,
}) })
} else { } else {
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: lib, SharedLibrary: lib,
UnstrippedSharedLibrary: lib, Target: ctx.Target(),
Target: ctx.Target(),
}) })
} }

View File

@@ -183,9 +183,8 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
}) })
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: outputFile, SharedLibrary: outputFile,
UnstrippedSharedLibrary: p.unstrippedOutputFile, Target: ctx.Target(),
Target: ctx.Target(),
TableOfContents: p.tocFile, TableOfContents: p.tocFile,
}) })

View File

@@ -642,9 +642,8 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
transformSharedObjectToToc(ctx, in, tocFile, builderFlags) transformSharedObjectToToc(ctx, in, tocFile, builderFlags)
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: in, SharedLibrary: in,
UnstrippedSharedLibrary: p.unstrippedOutputFile, Target: ctx.Target(),
Target: ctx.Target(),
TableOfContents: p.tocFile, TableOfContents: p.tocFile,
}) })

View File

@@ -168,9 +168,8 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
} }
ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: in, SharedLibrary: in,
UnstrippedSharedLibrary: p.unstrippedOutputFile, Target: ctx.Target(),
Target: ctx.Target(),
TableOfContents: p.tocFile, TableOfContents: p.tocFile,
}) })

View File

@@ -503,9 +503,8 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
if library.shared() { if library.shared() {
ctx.SetProvider(cc.SharedLibraryInfoProvider, cc.SharedLibraryInfo{ ctx.SetProvider(cc.SharedLibraryInfoProvider, cc.SharedLibraryInfo{
SharedLibrary: outputFile, SharedLibrary: outputFile,
UnstrippedSharedLibrary: outputFile, Target: ctx.Target(),
Target: ctx.Target(),
}) })
} }