Merge "stub variants also re-exports headers"
This commit is contained in:
commit
6f05a73e3e
3 changed files with 56 additions and 15 deletions
|
@ -1723,6 +1723,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
filesInfo = append(filesInfo, af)
|
filesInfo = append(filesInfo, af)
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
}
|
}
|
||||||
|
} else if cc.IsHeaderDepTag(depTag) {
|
||||||
|
// nothing
|
||||||
} else if java.IsJniDepTag(depTag) {
|
} else if java.IsJniDepTag(depTag) {
|
||||||
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
|
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
|
||||||
return false
|
return false
|
||||||
|
|
37
cc/cc.go
37
cc/cc.go
|
@ -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 {
|
rewriteSnapshotLibs := func(lib string, snapshotMap *snapshotMap) string {
|
||||||
// only modules with BOARD_VNDK_VERSION uses snapshot.
|
// only modules with BOARD_VNDK_VERSION uses snapshot.
|
||||||
if c.VndkVersion() != actx.DeviceConfig().VndkVersion() {
|
if c.VndkVersion() != actx.DeviceConfig().VndkVersion() {
|
||||||
|
@ -1921,7 +1914,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
|
|
||||||
lib = rewriteSnapshotLibs(lib, vendorSnapshotHeaderLibs)
|
lib = rewriteSnapshotLibs(lib, vendorSnapshotHeaderLibs)
|
||||||
|
|
||||||
if buildStubs {
|
if c.IsStubs() {
|
||||||
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
||||||
depTag, lib)
|
depTag, lib)
|
||||||
} else {
|
} 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
|
// 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
|
// 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
|
// sysprop_library, the C++ implementation library has to be linked. syspropImplLibraries is a
|
||||||
|
@ -2254,6 +2241,11 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
depTag := ctx.OtherModuleDependencyTag(child)
|
||||||
|
if IsHeaderDepTag(depTag) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Even if target lib has no vendor variant, keep checking dependency
|
// Even if target lib has no vendor variant, keep checking dependency
|
||||||
// graph in case it depends on vendor_available or product_available
|
// graph in case it depends on vendor_available or product_available
|
||||||
// but not double_loadable transtively.
|
// 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)
|
linkFile = android.OptionalPathForPath(sharedLibraryInfo.SharedLibrary)
|
||||||
depFile = sharedLibraryInfo.TableOfContents
|
depFile = sharedLibraryInfo.TableOfContents
|
||||||
|
|
||||||
|
@ -2532,6 +2530,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
}
|
}
|
||||||
return
|
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)
|
staticLibraryInfo := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
|
||||||
linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
|
linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
|
||||||
if libDepTag.wholeStatic {
|
if libDepTag.wholeStatic {
|
||||||
|
@ -2659,7 +2664,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
c.Properties.AndroidMkStaticLibs, makeLibName)
|
c.Properties.AndroidMkStaticLibs, makeLibName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if !c.IsStubs() {
|
||||||
|
// Stubs lib doesn't link to the runtime lib, object, crt, etc. dependencies.
|
||||||
|
|
||||||
switch depTag {
|
switch depTag {
|
||||||
case runtimeDepTag:
|
case runtimeDepTag:
|
||||||
c.Properties.AndroidMkRuntimeLibs = append(
|
c.Properties.AndroidMkRuntimeLibs = append(
|
||||||
|
|
|
@ -4056,3 +4056,35 @@ func TestInstallSharedLibs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStubsLibReexportsHeaders(t *testing.T) {
|
||||||
|
ctx := testCc(t, `
|
||||||
|
cc_library_shared {
|
||||||
|
name: "libclient",
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
shared_libs: ["libfoo#1"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_shared {
|
||||||
|
name: "libfoo",
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
shared_libs: ["libbar"],
|
||||||
|
export_shared_lib_headers: ["libbar"],
|
||||||
|
stubs: {
|
||||||
|
symbol_file: "foo.map.txt",
|
||||||
|
versions: ["1", "2", "3"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library_shared {
|
||||||
|
name: "libbar",
|
||||||
|
export_include_dirs: ["include/libbar"],
|
||||||
|
srcs: ["foo.c"],
|
||||||
|
}`)
|
||||||
|
|
||||||
|
cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"]
|
||||||
|
|
||||||
|
if !strings.Contains(cFlags, "-Iinclude/libbar") {
|
||||||
|
t.Errorf("expected %q in cflags, got %q", "-Iinclude/libbar", cFlags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue