Merge "Fix duplicate deps issue related to stubs"
This commit is contained in:
@@ -2684,6 +2684,40 @@ cc_library {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCcLibraryStubsAcrossConfigsDuplicatesRemoved(t *testing.T) {
|
||||||
|
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||||
|
Description: "stub target generation of the same lib across configs should not result in duplicates",
|
||||||
|
ModuleTypeUnderTest: "cc_library",
|
||||||
|
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||||
|
Filesystem: map[string]string{
|
||||||
|
"bar.map.txt": "",
|
||||||
|
},
|
||||||
|
Blueprint: `
|
||||||
|
cc_library {
|
||||||
|
name: "barlib",
|
||||||
|
stubs: { symbol_file: "bar.map.txt", versions: ["28", "29", "current"] },
|
||||||
|
bazel_module: { bp2build_available: false },
|
||||||
|
}
|
||||||
|
cc_library {
|
||||||
|
name: "foolib",
|
||||||
|
shared_libs: ["barlib"],
|
||||||
|
target: {
|
||||||
|
android: {
|
||||||
|
shared_libs: ["barlib"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
bazel_module: { bp2build_available: true },
|
||||||
|
}`,
|
||||||
|
ExpectedBazelTargets: makeCcLibraryTargets("foolib", AttrNameToString{
|
||||||
|
"implementation_dynamic_deps": `select({
|
||||||
|
"//build/bazel/rules/apex:android-in_apex": [":barlib_stub_libs_current"],
|
||||||
|
"//conditions:default": [":barlib"],
|
||||||
|
})`,
|
||||||
|
"local_includes": `["."]`,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestCcLibraryEscapeLdflags(t *testing.T) {
|
func TestCcLibraryEscapeLdflags(t *testing.T) {
|
||||||
runCcLibraryTestCase(t, Bp2buildTestCase{
|
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||||
ModuleTypeUnderTest: "cc_library",
|
ModuleTypeUnderTest: "cc_library",
|
||||||
|
@@ -933,14 +933,14 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||||||
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
|
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
|
||||||
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
||||||
(&defaultSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
(&defaultSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
||||||
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, inApexSelectValue)
|
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
|
||||||
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, nonApexSelectValue)
|
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
|
||||||
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, defaultSelectValue)
|
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, bazel.FirstUniqueBazelLabelList(defaultSelectValue))
|
||||||
} else if config == bazel.OsAndroid {
|
} else if config == bazel.OsAndroid {
|
||||||
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
|
(&inApexSelectValue).Append(bazel.MakeLabelList(stubLibLabels))
|
||||||
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
(&nonApexSelectValue).Append(bazel.MakeLabelList(depsWithStubs))
|
||||||
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, inApexSelectValue)
|
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndInApex, bazel.FirstUniqueBazelLabelList(inApexSelectValue))
|
||||||
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, nonApexSelectValue)
|
la.implementationDynamicDeps.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.FirstUniqueBazelLabelList(nonApexSelectValue))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user