Merge "stub variants also re-exports headers"

This commit is contained in:
Jiyong Park
2020-12-11 08:50:12 +00:00
committed by Gerrit Code Review
3 changed files with 56 additions and 15 deletions

View File

@@ -1892,13 +1892,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
}
}
buildStubs := false
if versioned, ok := c.linker.(versionedInterface); ok {
if versioned.buildStubs() {
buildStubs = true
}
}
rewriteSnapshotLibs := func(lib string, snapshotMap *snapshotMap) string {
// only modules with BOARD_VNDK_VERSION uses snapshot.
if c.VndkVersion() != actx.DeviceConfig().VndkVersion() {
@@ -1921,7 +1914,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
lib = rewriteSnapshotLibs(lib, vendorSnapshotHeaderLibs)
if buildStubs {
if c.IsStubs() {
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
depTag, lib)
} else {
@@ -1929,12 +1922,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
}
}
if buildStubs {
// Stubs lib does not have dependency to other static/shared libraries.
// Don't proceed.
return
}
// sysprop_library has to support both C++ and Java. So sysprop_library internally creates one
// C++ implementation library and one Java implementation library. When a module links against
// sysprop_library, the C++ implementation library has to be linked. syspropImplLibraries is a
@@ -2254,6 +2241,11 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
return false
}
depTag := ctx.OtherModuleDependencyTag(child)
if IsHeaderDepTag(depTag) {
return false
}
// Even if target lib has no vendor variant, keep checking dependency
// graph in case it depends on vendor_available or product_available
// but not double_loadable transtively.
@@ -2505,6 +2497,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
}
// Stubs lib doesn't link to the shared lib dependencies. Don't set
// linkFile, depFile, and ptr.
if c.IsStubs() {
break
}
linkFile = android.OptionalPathForPath(sharedLibraryInfo.SharedLibrary)
depFile = sharedLibraryInfo.TableOfContents
@@ -2532,6 +2530,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
return
}
// Stubs lib doesn't link to the static lib dependencies. Don't set
// linkFile, depFile, and ptr.
if c.IsStubs() {
break
}
staticLibraryInfo := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
if libDepTag.wholeStatic {
@@ -2659,7 +2664,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
c.Properties.AndroidMkStaticLibs, makeLibName)
}
}
} else {
} else if !c.IsStubs() {
// Stubs lib doesn't link to the runtime lib, object, crt, etc. dependencies.
switch depTag {
case runtimeDepTag:
c.Properties.AndroidMkRuntimeLibs = append(