diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go index 17337f021..037564bb1 100644 --- a/bp2build/cc_binary_conversion_test.go +++ b/bp2build/cc_binary_conversion_test.go @@ -130,6 +130,7 @@ func TestBasicCcBinary(t *testing.T) { }, sdk_version: "current", min_sdk_version: "29", + use_version_lib: true, } `, targets: []testBazelTarget{ @@ -153,8 +154,9 @@ func TestBasicCcBinary(t *testing.T) { "keep_symbols_list": ["symbol"], "none": True, }`, - "sdk_version": `"current"`, - "min_sdk_version": `"29"`, + "sdk_version": `"current"`, + "min_sdk_version": `"29"`, + "use_version_lib": `True`, }, }, }, diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go index 57678618c..2775a104e 100644 --- a/bp2build/cc_library_conversion_test.go +++ b/bp2build/cc_library_conversion_test.go @@ -117,6 +117,7 @@ cc_library { include_build_directory: false, sdk_version: "current", min_sdk_version: "29", + use_version_lib: true, } `, expectedBazelTargets: makeCcLibraryTargets("foo-lib", attrNameToString{ @@ -142,8 +143,9 @@ cc_library { "//build/bazel/platforms/os:linux_bionic": ["bionic.cpp"], "//conditions:default": [], })`, - "sdk_version": `"current"`, - "min_sdk_version": `"29"`, + "sdk_version": `"current"`, + "min_sdk_version": `"29"`, + "use_version_lib": `True`, }), }) } diff --git a/cc/binary.go b/cc/binary.go index 89e7262cc..c5017c1dd 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -615,6 +615,7 @@ func binaryBp2build(ctx android.TopDownMutatorContext, m *Module, typ string) { Linkopts: baseAttrs.linkopts, Link_crt: baseAttrs.linkCrt, Use_libcrt: baseAttrs.useLibcrt, + Use_version_lib: baseAttrs.useVersionLib, Rtti: baseAttrs.rtti, Stl: baseAttrs.stl, Cpp_std: baseAttrs.cppStd, @@ -665,8 +666,9 @@ type binaryAttributes struct { Linkopts bazel.StringListAttribute Additional_linker_inputs bazel.LabelListAttribute - Link_crt bazel.BoolAttribute - Use_libcrt bazel.BoolAttribute + Link_crt bazel.BoolAttribute + Use_libcrt bazel.BoolAttribute + Use_version_lib bazel.BoolAttribute Rtti bazel.BoolAttribute Stl *string diff --git a/cc/library.go b/cc/library.go index 035a90e1c..0abcb6f39 100644 --- a/cc/library.go +++ b/cc/library.go @@ -352,6 +352,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { Stl: compilerAttrs.stl, Cpp_std: compilerAttrs.cppStd, C_std: compilerAttrs.cStd, + Use_version_lib: linkerAttrs.useVersionLib, Features: linkerAttrs.features, } @@ -374,6 +375,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) { Stl: compilerAttrs.stl, Cpp_std: compilerAttrs.cppStd, C_std: compilerAttrs.cStd, + Use_version_lib: linkerAttrs.useVersionLib, Additional_linker_inputs: linkerAttrs.additionalLinkerInputs,