From fe978fd2c1d651dd11abaedf325a0bafa46c39e1 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Mon, 24 Apr 2023 16:37:18 -0700 Subject: [PATCH] libbuildversion should be linked as a whole archive dep as soong does. Bug: 278789968 Test: Unit tests and CI Change-Id: Ic2c44826bdc03b91cc19d93f96096ec6fdf44833 --- bp2build/cc_library_conversion_test.go | 8 ++++---- bp2build/cc_library_shared_conversion_test.go | 4 ++-- bp2build/cc_library_static_conversion_test.go | 2 +- cc/bp2build.go | 6 +----- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go index d2c463dbb..27a4c2215 100644 --- a/bp2build/cc_library_conversion_test.go +++ b/bp2build/cc_library_conversion_test.go @@ -153,10 +153,10 @@ cc_library { "//build/bazel/platforms/os:linux_glibc": ["linux.cpp"], "//conditions:default": [], })`, - "sdk_version": `"current"`, - "min_sdk_version": `"29"`, - "use_version_lib": `True`, - "implementation_whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, + "sdk_version": `"current"`, + "min_sdk_version": `"29"`, + "use_version_lib": `True`, + "whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, }), }) } diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go index cbea943e1..59fbd439f 100644 --- a/bp2build/cc_library_shared_conversion_test.go +++ b/bp2build/cc_library_shared_conversion_test.go @@ -516,8 +516,8 @@ func TestCcLibrarySharedUseVersionLib(t *testing.T) { }`, ExpectedBazelTargets: []string{ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{ - "use_version_lib": "True", - "implementation_whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, + "use_version_lib": "True", + "whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, }), }, }) diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go index cd4cf51a1..0583adaf1 100644 --- a/bp2build/cc_library_static_conversion_test.go +++ b/bp2build/cc_library_static_conversion_test.go @@ -1613,7 +1613,7 @@ func TestCcLibraryStaticUseVersionLib(t *testing.T) { }`, ExpectedBazelTargets: []string{ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{ - "implementation_whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, + "whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`, }), }, }) diff --git a/cc/bp2build.go b/cc/bp2build.go index c8f516cdc..9f5da6be4 100644 --- a/cc/bp2build.go +++ b/cc/bp2build.go @@ -1036,11 +1036,7 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion _, staticLibs = android.RemoveFromList(versionLib, staticLibs) // only add the dep if it is not in progress if !versionLibAlreadyInDeps { - if isBinary { - wholeStaticLibs = append(wholeStaticLibs, versionLib) - } else { - la.implementationWholeArchiveDeps.SetSelectValue(axis, config, bazelLabelForWholeDepsExcludes(ctx, []string{versionLib}, props.Exclude_static_libs)) - } + wholeStaticLibs = append(wholeStaticLibs, versionLib) } } }