stubs lib can export headers lib
Add a dependency from a stubs lib to headers libs so that the headers
can be re-exported.
Bug: 122717287
Test: m; a test added to apex_test.go
Change-Id: I8d48c072815c6b02d343ef09cb44dfc6d1af8e64
diff --git a/cc/cc.go b/cc/cc.go
index 02efcc9..1f50976 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1142,11 +1142,11 @@
deps.ReexportSharedLibHeaders, _ = rewriteNdkLibs(deps.ReexportSharedLibHeaders)
}
+ buildStubs := false
if c.linker != nil {
if library, ok := c.linker.(*libraryDecorator); ok {
if library.buildStubs() {
- // Stubs lib does not have dependency to other libraries. Don't proceed.
- return
+ buildStubs = true
}
}
}
@@ -1156,7 +1156,26 @@
if inList(lib, deps.ReexportHeaderLibHeaders) {
depTag = headerExportDepTag
}
- actx.AddVariationDependencies(nil, depTag, lib)
+ if buildStubs {
+ imageVariation := "core"
+ if c.useVndk() {
+ imageVariation = "vendor"
+ } else if c.inRecovery() {
+ imageVariation = "recovery"
+ }
+ actx.AddFarVariationDependencies([]blueprint.Variation{
+ {Mutator: "arch", Variation: ctx.Target().String()},
+ {Mutator: "image", Variation: imageVariation},
+ }, depTag, lib)
+ } else {
+ actx.AddVariationDependencies(nil, depTag, lib)
+ }
+ }
+
+ if buildStubs {
+ // Stubs lib does not have dependency to other static/shared libraries.
+ // Don't proceed.
+ return
}
actx.AddVariationDependencies([]blueprint.Variation{