diff options
Diffstat (limited to 'cc/library.go')
| -rw-r--r-- | cc/library.go | 83 |
1 files changed, 54 insertions, 29 deletions
diff --git a/cc/library.go b/cc/library.go index 7e960a7fa..c5ff9b1f4 100644 --- a/cc/library.go +++ b/cc/library.go @@ -220,16 +220,29 @@ func RegisterLibraryBuildComponents(ctx android.RegistrationContext) { // For bp2build conversion. type bazelCcLibraryAttributes struct { - Srcs bazel.LabelListAttribute - Hdrs bazel.LabelListAttribute - Copts bazel.StringListAttribute - Linkopts bazel.StringListAttribute - Deps bazel.LabelListAttribute - Dynamic_deps bazel.LabelListAttribute - User_link_flags bazel.StringListAttribute - Includes bazel.StringListAttribute - Static_deps_for_shared bazel.LabelListAttribute - Version_script bazel.LabelAttribute + // Attributes pertaining to both static and shared variants. + Srcs bazel.LabelListAttribute + Hdrs bazel.LabelListAttribute + Deps bazel.LabelListAttribute + Dynamic_deps bazel.LabelListAttribute + Whole_archive_deps bazel.LabelListAttribute + Copts bazel.StringListAttribute + Includes bazel.StringListAttribute + Linkopts bazel.StringListAttribute + // Attributes pertaining to shared variant. + Shared_copts bazel.StringListAttribute + Shared_srcs bazel.LabelListAttribute + Static_deps_for_shared bazel.LabelListAttribute + Dynamic_deps_for_shared bazel.LabelListAttribute + Whole_archive_deps_for_shared bazel.LabelListAttribute + User_link_flags bazel.StringListAttribute + Version_script bazel.LabelAttribute + // Attributes pertaining to static variant. + Static_copts bazel.StringListAttribute + Static_srcs bazel.LabelListAttribute + Static_deps_for_static bazel.LabelListAttribute + Dynamic_deps_for_static bazel.LabelListAttribute + Whole_archive_deps_for_static bazel.LabelListAttribute } type bazelCcLibrary struct { @@ -276,17 +289,26 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) { var srcs bazel.LabelListAttribute srcs.Append(compilerAttrs.srcs) - srcs.Append(staticAttrs.srcs) attrs := &bazelCcLibraryAttributes{ - Srcs: srcs, - Copts: compilerAttrs.copts, - Linkopts: linkerAttrs.linkopts, - Deps: linkerAttrs.deps, - Dynamic_deps: linkerAttrs.dynamicDeps, - Version_script: linkerAttrs.versionScript, - Static_deps_for_shared: sharedAttrs.staticDeps, - Includes: exportedIncludes, + Srcs: srcs, + Deps: linkerAttrs.deps, + Dynamic_deps: linkerAttrs.dynamicDeps, + Whole_archive_deps: linkerAttrs.wholeArchiveDeps, + Copts: compilerAttrs.copts, + Includes: exportedIncludes, + Linkopts: linkerAttrs.linkopts, + Shared_copts: sharedAttrs.copts, + Shared_srcs: sharedAttrs.srcs, + Static_deps_for_shared: sharedAttrs.staticDeps, + Whole_archive_deps_for_shared: sharedAttrs.wholeArchiveDeps, + Dynamic_deps_for_shared: sharedAttrs.dynamicDeps, + Version_script: linkerAttrs.versionScript, + Static_copts: staticAttrs.copts, + Static_srcs: staticAttrs.srcs, + Static_deps_for_static: staticAttrs.staticDeps, + Whole_archive_deps_for_static: staticAttrs.wholeArchiveDeps, + Dynamic_deps_for_static: staticAttrs.dynamicDeps, } props := bazel.BazelTargetModuleProperties{ @@ -2194,13 +2216,14 @@ func maybeInjectBoringSSLHash(ctx android.ModuleContext, outputFile android.Modu } type bazelCcLibraryStaticAttributes struct { - Copts bazel.StringListAttribute - Srcs bazel.LabelListAttribute - Deps bazel.LabelListAttribute - Linkopts bazel.StringListAttribute - Linkstatic bool - Includes bazel.StringListAttribute - Hdrs bazel.LabelListAttribute + Copts bazel.StringListAttribute + Srcs bazel.LabelListAttribute + Deps bazel.LabelListAttribute + Whole_archive_deps bazel.LabelListAttribute + Linkopts bazel.StringListAttribute + Linkstatic bool + Includes bazel.StringListAttribute + Hdrs bazel.LabelListAttribute } type bazelCcLibraryStatic struct { @@ -2221,9 +2244,11 @@ func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module * exportedIncludes := bp2BuildParseExportedIncludes(ctx, module) attrs := &bazelCcLibraryStaticAttributes{ - Copts: compilerAttrs.copts, - Srcs: compilerAttrs.srcs, - Deps: linkerAttrs.deps, + Copts: compilerAttrs.copts, + Srcs: compilerAttrs.srcs, + Deps: linkerAttrs.deps, + Whole_archive_deps: linkerAttrs.wholeArchiveDeps, + Linkopts: linkerAttrs.linkopts, Linkstatic: true, Includes: exportedIncludes, |