Add initial support for use_version_lib.
Test: Resolves build error for BP2BUILD_VERBOSE=1 b build //packages/modules/adb:libadbd_core Test: Added unit test Bug: 208481704 Change-Id: I4022c686c7baf050de3f97295fe4654515622a66
This commit is contained in:
parent
8d0bd355fd
commit
484aa25875
4 changed files with 64 additions and 20 deletions
|
@ -450,3 +450,18 @@ func TestCcLibrarySharedProto(t *testing.T) {
|
|||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcLibrarySharedUseVersionLib(t *testing.T) {
|
||||
runCcLibrarySharedTestCase(t, bp2buildTestCase{
|
||||
blueprint: soongCcProtoPreamble + `cc_library_shared {
|
||||
name: "foo",
|
||||
use_version_lib: true,
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("cc_library_shared", "foo", attrNameToString{
|
||||
"use_version_lib": "True",
|
||||
}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1443,3 +1443,18 @@ func TestCcLibraryStaticProto(t *testing.T) {
|
|||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcLibraryStaticUseVersionLib(t *testing.T) {
|
||||
runCcLibraryStaticTestCase(t, bp2buildTestCase{
|
||||
blueprint: soongCcProtoPreamble + `cc_library_static {
|
||||
name: "foo",
|
||||
use_version_lib: true,
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{
|
||||
makeBazelTarget("cc_library_static", "foo", attrNameToString{
|
||||
"use_version_lib": "True",
|
||||
}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -496,6 +496,7 @@ type linkerAttributes struct {
|
|||
|
||||
linkCrt bazel.BoolAttribute
|
||||
useLibcrt bazel.BoolAttribute
|
||||
useVersionLib bazel.BoolAttribute
|
||||
linkopts bazel.StringListAttribute
|
||||
additionalLinkerInputs bazel.LabelListAttribute
|
||||
stripKeepSymbols bazel.BoolAttribute
|
||||
|
@ -565,6 +566,10 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||
la.linkopts.SetSelectValue(axis, config, linkerFlags)
|
||||
la.useLibcrt.SetSelectValue(axis, config, props.libCrt())
|
||||
|
||||
if axis == bazel.NoConfigAxis {
|
||||
la.useVersionLib.SetSelectValue(axis, config, props.Use_version_lib)
|
||||
}
|
||||
|
||||
// it's very unlikely for nocrt to be arch variant, so bp2build doesn't support it.
|
||||
if props.crt() != nil {
|
||||
if axis == bazel.NoConfigAxis {
|
||||
|
|
|
@ -2480,7 +2480,9 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||
attrs = &bazelCcLibraryStaticAttributes{
|
||||
staticOrSharedAttributes: commonAttrs,
|
||||
|
||||
Use_libcrt: linkerAttrs.useLibcrt,
|
||||
Use_libcrt: linkerAttrs.useLibcrt,
|
||||
Use_version_lib: linkerAttrs.useVersionLib,
|
||||
|
||||
Rtti: compilerAttrs.rtti,
|
||||
Stl: compilerAttrs.stl,
|
||||
Cpp_std: compilerAttrs.cppStd,
|
||||
|
@ -2505,14 +2507,16 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||
Cppflags: compilerAttrs.cppFlags,
|
||||
Conlyflags: compilerAttrs.conlyFlags,
|
||||
Asflags: asFlags,
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
|
||||
Link_crt: linkerAttrs.linkCrt,
|
||||
Use_libcrt: linkerAttrs.useLibcrt,
|
||||
Rtti: compilerAttrs.rtti,
|
||||
Stl: compilerAttrs.stl,
|
||||
Cpp_std: compilerAttrs.cppStd,
|
||||
C_std: compilerAttrs.cStd,
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
Link_crt: linkerAttrs.linkCrt,
|
||||
Use_libcrt: linkerAttrs.useLibcrt,
|
||||
Use_version_lib: linkerAttrs.useVersionLib,
|
||||
|
||||
Rtti: compilerAttrs.rtti,
|
||||
Stl: compilerAttrs.stl,
|
||||
Cpp_std: compilerAttrs.cppStd,
|
||||
C_std: compilerAttrs.cStd,
|
||||
|
||||
Export_includes: exportedIncludes.Includes,
|
||||
Export_system_includes: exportedIncludes.SystemIncludes,
|
||||
|
@ -2544,11 +2548,13 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||
type bazelCcLibraryStaticAttributes struct {
|
||||
staticOrSharedAttributes
|
||||
|
||||
Use_libcrt bazel.BoolAttribute
|
||||
Rtti bazel.BoolAttribute
|
||||
Stl *string
|
||||
Cpp_std *string
|
||||
C_std *string
|
||||
Use_libcrt bazel.BoolAttribute
|
||||
Use_version_lib bazel.BoolAttribute
|
||||
|
||||
Rtti bazel.BoolAttribute
|
||||
Stl *string
|
||||
Cpp_std *string
|
||||
C_std *string
|
||||
|
||||
Export_includes bazel.StringListAttribute
|
||||
Export_system_includes bazel.StringListAttribute
|
||||
|
@ -2579,13 +2585,16 @@ func CcLibraryStaticBp2Build(ctx android.TopDownMutatorContext) {
|
|||
type bazelCcLibrarySharedAttributes struct {
|
||||
staticOrSharedAttributes
|
||||
|
||||
Linkopts bazel.StringListAttribute
|
||||
Link_crt bazel.BoolAttribute // Only for linking shared library (and cc_binary)
|
||||
Use_libcrt bazel.BoolAttribute
|
||||
Rtti bazel.BoolAttribute
|
||||
Stl *string
|
||||
Cpp_std *string
|
||||
C_std *string
|
||||
Linkopts bazel.StringListAttribute
|
||||
Link_crt bazel.BoolAttribute // Only for linking shared library (and cc_binary)
|
||||
|
||||
Use_libcrt bazel.BoolAttribute
|
||||
Use_version_lib bazel.BoolAttribute
|
||||
|
||||
Rtti bazel.BoolAttribute
|
||||
Stl *string
|
||||
Cpp_std *string
|
||||
C_std *string
|
||||
|
||||
Export_includes bazel.StringListAttribute
|
||||
Export_system_includes bazel.StringListAttribute
|
||||
|
|
Loading…
Reference in a new issue