Fix: build error when a lib with stubs is included in an APEX
apex { name: "foo", native_shared_libs: ["mylib"] } cc_library { name: "mylib", shared_libs: ["other_lib"], stubs: { versions: ["1"]}, } This is causing build error due to missing variant for other_lib. This is happening because the stubs variant of mylib is added to apex foo instead of the non-stubs variant. Because stubs variant does not have any further dependencies, other_lib is not included to the APEX and is not built for it. Fixing this issue by specifying the version variant when adding a lib to the dependency of an APEX, so that non-stub variant of the lib is depended on. Test: m (apex_test updated) Change-Id: I972b6dcbce11942f83a76212715ba915534ec3df
This commit is contained in:
@@ -367,6 +367,7 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
|
|||||||
{Mutator: "arch", Variation: arch},
|
{Mutator: "arch", Variation: arch},
|
||||||
{Mutator: "image", Variation: "core"},
|
{Mutator: "image", Variation: "core"},
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
|
{Mutator: "version", Variation: ""}, // "" is the non-stub variant
|
||||||
}, sharedLibTag, native_shared_libs...)
|
}, sharedLibTag, native_shared_libs...)
|
||||||
|
|
||||||
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
||||||
|
@@ -276,13 +276,21 @@ func TestApexWithStubs(t *testing.T) {
|
|||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "mylib3",
|
name: "mylib3",
|
||||||
srcs: ["mylib.cpp"],
|
srcs: ["mylib.cpp"],
|
||||||
system_shared_libs: [],
|
shared_libs: ["mylib4"],
|
||||||
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
stubs: {
|
stubs: {
|
||||||
versions: ["10", "11", "12"],
|
versions: ["10", "11", "12"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "mylib4",
|
||||||
|
srcs: ["mylib.cpp"],
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
|
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
|
||||||
|
Reference in New Issue
Block a user