Merge "Dedupe libraries in both static and whole static"
This commit is contained in:
@@ -283,8 +283,8 @@ cc_library {
|
|||||||
srcs: ["both.cpp"],
|
srcs: ["both.cpp"],
|
||||||
cflags: ["bothflag"],
|
cflags: ["bothflag"],
|
||||||
shared_libs: ["shared_dep_for_both"],
|
shared_libs: ["shared_dep_for_both"],
|
||||||
static_libs: ["static_dep_for_both"],
|
static_libs: ["static_dep_for_both", "whole_and_static_lib_for_both"],
|
||||||
whole_static_libs: ["whole_static_lib_for_both"],
|
whole_static_libs: ["whole_static_lib_for_both", "whole_and_static_lib_for_both"],
|
||||||
static: {
|
static: {
|
||||||
srcs: ["staticonly.cpp"],
|
srcs: ["staticonly.cpp"],
|
||||||
cflags: ["staticflag"],
|
cflags: ["staticflag"],
|
||||||
@@ -332,6 +332,11 @@ cc_library_static {
|
|||||||
bazel_module: { bp2build_available: false },
|
bazel_module: { bp2build_available: false },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_library_static {
|
||||||
|
name: "whole_and_static_lib_for_both",
|
||||||
|
bazel_module: { bp2build_available: false },
|
||||||
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "shared_dep_for_shared",
|
name: "shared_dep_for_shared",
|
||||||
bazel_module: { bp2build_available: false },
|
bazel_module: { bp2build_available: false },
|
||||||
@@ -367,6 +372,7 @@ cc_library {
|
|||||||
]`,
|
]`,
|
||||||
"whole_archive_deps": `[
|
"whole_archive_deps": `[
|
||||||
":whole_static_lib_for_both",
|
":whole_static_lib_for_both",
|
||||||
|
":whole_and_static_lib_for_both",
|
||||||
":whole_static_lib_for_static",
|
":whole_static_lib_for_static",
|
||||||
]`}),
|
]`}),
|
||||||
makeBazelTarget("cc_library_shared", "a", attrNameToString{
|
makeBazelTarget("cc_library_shared", "a", attrNameToString{
|
||||||
@@ -388,6 +394,7 @@ cc_library {
|
|||||||
]`,
|
]`,
|
||||||
"whole_archive_deps": `[
|
"whole_archive_deps": `[
|
||||||
":whole_static_lib_for_both",
|
":whole_static_lib_for_both",
|
||||||
|
":whole_and_static_lib_for_both",
|
||||||
":whole_static_lib_for_shared",
|
":whole_static_lib_for_shared",
|
||||||
]`,
|
]`,
|
||||||
}),
|
}),
|
||||||
|
@@ -585,9 +585,12 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||||||
// Use a single variable to capture usage of nocrt in arch variants, so there's only 1 error message for this module
|
// Use a single variable to capture usage of nocrt in arch variants, so there's only 1 error message for this module
|
||||||
var axisFeatures []string
|
var axisFeatures []string
|
||||||
|
|
||||||
|
wholeStaticLibs := android.FirstUniqueStrings(props.Whole_static_libs)
|
||||||
|
la.wholeArchiveDeps.SetSelectValue(axis, config, bazelLabelForWholeDepsExcludes(ctx, wholeStaticLibs, props.Exclude_static_libs))
|
||||||
// Excludes to parallel Soong:
|
// Excludes to parallel Soong:
|
||||||
// https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/linker.go;l=247-249;drc=088b53577dde6e40085ffd737a1ae96ad82fc4b0
|
// https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/linker.go;l=247-249;drc=088b53577dde6e40085ffd737a1ae96ad82fc4b0
|
||||||
staticLibs := android.FirstUniqueStrings(props.Static_libs)
|
staticLibs := android.FirstUniqueStrings(android.RemoveListFromList(props.Static_libs, wholeStaticLibs))
|
||||||
|
|
||||||
staticDeps := maybePartitionExportedAndImplementationsDepsExcludes(ctx, !isBinary, staticLibs, props.Exclude_static_libs, props.Export_static_lib_headers, bazelLabelForStaticDepsExcludes)
|
staticDeps := maybePartitionExportedAndImplementationsDepsExcludes(ctx, !isBinary, staticLibs, props.Exclude_static_libs, props.Export_static_lib_headers, bazelLabelForStaticDepsExcludes)
|
||||||
|
|
||||||
headerLibs := android.FirstUniqueStrings(props.Header_libs)
|
headerLibs := android.FirstUniqueStrings(props.Header_libs)
|
||||||
@@ -599,9 +602,6 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
|||||||
(&hDeps.implementation).Append(staticDeps.implementation)
|
(&hDeps.implementation).Append(staticDeps.implementation)
|
||||||
la.implementationDeps.SetSelectValue(axis, config, hDeps.implementation)
|
la.implementationDeps.SetSelectValue(axis, config, hDeps.implementation)
|
||||||
|
|
||||||
wholeStaticLibs := android.FirstUniqueStrings(props.Whole_static_libs)
|
|
||||||
la.wholeArchiveDeps.SetSelectValue(axis, config, bazelLabelForWholeDepsExcludes(ctx, wholeStaticLibs, props.Exclude_static_libs))
|
|
||||||
|
|
||||||
systemSharedLibs := props.System_shared_libs
|
systemSharedLibs := props.System_shared_libs
|
||||||
// systemSharedLibs distinguishes between nil/empty list behavior:
|
// systemSharedLibs distinguishes between nil/empty list behavior:
|
||||||
// nil -> use default values
|
// nil -> use default values
|
||||||
|
Reference in New Issue
Block a user