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:
@@ -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
|
linkCrt bazel.BoolAttribute
|
||||||
useLibcrt bazel.BoolAttribute
|
useLibcrt bazel.BoolAttribute
|
||||||
|
useVersionLib bazel.BoolAttribute
|
||||||
linkopts bazel.StringListAttribute
|
linkopts bazel.StringListAttribute
|
||||||
additionalLinkerInputs bazel.LabelListAttribute
|
additionalLinkerInputs bazel.LabelListAttribute
|
||||||
stripKeepSymbols bazel.BoolAttribute
|
stripKeepSymbols bazel.BoolAttribute
|
||||||
@@ -565,6 +566,10 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||||||
la.linkopts.SetSelectValue(axis, config, linkerFlags)
|
la.linkopts.SetSelectValue(axis, config, linkerFlags)
|
||||||
la.useLibcrt.SetSelectValue(axis, config, props.libCrt())
|
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.
|
// it's very unlikely for nocrt to be arch variant, so bp2build doesn't support it.
|
||||||
if props.crt() != nil {
|
if props.crt() != nil {
|
||||||
if axis == bazel.NoConfigAxis {
|
if axis == bazel.NoConfigAxis {
|
||||||
|
@@ -2480,7 +2480,9 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||||||
attrs = &bazelCcLibraryStaticAttributes{
|
attrs = &bazelCcLibraryStaticAttributes{
|
||||||
staticOrSharedAttributes: commonAttrs,
|
staticOrSharedAttributes: commonAttrs,
|
||||||
|
|
||||||
Use_libcrt: linkerAttrs.useLibcrt,
|
Use_libcrt: linkerAttrs.useLibcrt,
|
||||||
|
Use_version_lib: linkerAttrs.useVersionLib,
|
||||||
|
|
||||||
Rtti: compilerAttrs.rtti,
|
Rtti: compilerAttrs.rtti,
|
||||||
Stl: compilerAttrs.stl,
|
Stl: compilerAttrs.stl,
|
||||||
Cpp_std: compilerAttrs.cppStd,
|
Cpp_std: compilerAttrs.cppStd,
|
||||||
@@ -2505,14 +2507,16 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||||||
Cppflags: compilerAttrs.cppFlags,
|
Cppflags: compilerAttrs.cppFlags,
|
||||||
Conlyflags: compilerAttrs.conlyFlags,
|
Conlyflags: compilerAttrs.conlyFlags,
|
||||||
Asflags: asFlags,
|
Asflags: asFlags,
|
||||||
Linkopts: linkerAttrs.linkopts,
|
|
||||||
|
|
||||||
Link_crt: linkerAttrs.linkCrt,
|
Linkopts: linkerAttrs.linkopts,
|
||||||
Use_libcrt: linkerAttrs.useLibcrt,
|
Link_crt: linkerAttrs.linkCrt,
|
||||||
Rtti: compilerAttrs.rtti,
|
Use_libcrt: linkerAttrs.useLibcrt,
|
||||||
Stl: compilerAttrs.stl,
|
Use_version_lib: linkerAttrs.useVersionLib,
|
||||||
Cpp_std: compilerAttrs.cppStd,
|
|
||||||
C_std: compilerAttrs.cStd,
|
Rtti: compilerAttrs.rtti,
|
||||||
|
Stl: compilerAttrs.stl,
|
||||||
|
Cpp_std: compilerAttrs.cppStd,
|
||||||
|
C_std: compilerAttrs.cStd,
|
||||||
|
|
||||||
Export_includes: exportedIncludes.Includes,
|
Export_includes: exportedIncludes.Includes,
|
||||||
Export_system_includes: exportedIncludes.SystemIncludes,
|
Export_system_includes: exportedIncludes.SystemIncludes,
|
||||||
@@ -2544,11 +2548,13 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
|
|||||||
type bazelCcLibraryStaticAttributes struct {
|
type bazelCcLibraryStaticAttributes struct {
|
||||||
staticOrSharedAttributes
|
staticOrSharedAttributes
|
||||||
|
|
||||||
Use_libcrt bazel.BoolAttribute
|
Use_libcrt bazel.BoolAttribute
|
||||||
Rtti bazel.BoolAttribute
|
Use_version_lib bazel.BoolAttribute
|
||||||
Stl *string
|
|
||||||
Cpp_std *string
|
Rtti bazel.BoolAttribute
|
||||||
C_std *string
|
Stl *string
|
||||||
|
Cpp_std *string
|
||||||
|
C_std *string
|
||||||
|
|
||||||
Export_includes bazel.StringListAttribute
|
Export_includes bazel.StringListAttribute
|
||||||
Export_system_includes bazel.StringListAttribute
|
Export_system_includes bazel.StringListAttribute
|
||||||
@@ -2579,13 +2585,16 @@ func CcLibraryStaticBp2Build(ctx android.TopDownMutatorContext) {
|
|||||||
type bazelCcLibrarySharedAttributes struct {
|
type bazelCcLibrarySharedAttributes struct {
|
||||||
staticOrSharedAttributes
|
staticOrSharedAttributes
|
||||||
|
|
||||||
Linkopts bazel.StringListAttribute
|
Linkopts bazel.StringListAttribute
|
||||||
Link_crt bazel.BoolAttribute // Only for linking shared library (and cc_binary)
|
Link_crt bazel.BoolAttribute // Only for linking shared library (and cc_binary)
|
||||||
Use_libcrt bazel.BoolAttribute
|
|
||||||
Rtti bazel.BoolAttribute
|
Use_libcrt bazel.BoolAttribute
|
||||||
Stl *string
|
Use_version_lib bazel.BoolAttribute
|
||||||
Cpp_std *string
|
|
||||||
C_std *string
|
Rtti bazel.BoolAttribute
|
||||||
|
Stl *string
|
||||||
|
Cpp_std *string
|
||||||
|
C_std *string
|
||||||
|
|
||||||
Export_includes bazel.StringListAttribute
|
Export_includes bazel.StringListAttribute
|
||||||
Export_system_includes bazel.StringListAttribute
|
Export_system_includes bazel.StringListAttribute
|
||||||
|
Reference in New Issue
Block a user