Split asm and c flags and srcs in bp2build output
This allows removal of almost all current items from the mixed build denylist, which were previously broken due to being unable to separately control flags for compilations of different languages within the same target. Note that this does not appropriately implement asm/c srcs and flags for either the shared variant or the static variant. This will require a followup. Test: bp2build.sh and mixed_libc.sh CI scripts Test: Updated b2build tests Change-Id: I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
This commit is contained in:
@@ -230,6 +230,13 @@ type bazelCcLibraryAttributes struct {
|
||||
Copts bazel.StringListAttribute
|
||||
Includes bazel.StringListAttribute
|
||||
Linkopts bazel.StringListAttribute
|
||||
|
||||
Cppflags bazel.StringListAttribute
|
||||
Srcs_c bazel.LabelListAttribute
|
||||
Conlyflags bazel.StringListAttribute
|
||||
Srcs_as bazel.LabelListAttribute
|
||||
Asflags bazel.StringListAttribute
|
||||
|
||||
// Attributes pertaining to shared variant.
|
||||
Shared_copts bazel.StringListAttribute
|
||||
Shared_srcs bazel.LabelListAttribute
|
||||
@@ -239,6 +246,7 @@ type bazelCcLibraryAttributes struct {
|
||||
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
|
||||
@@ -294,20 +302,27 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
||||
srcs.Append(compilerAttrs.srcs)
|
||||
|
||||
attrs := &bazelCcLibraryAttributes{
|
||||
Srcs: srcs,
|
||||
Implementation_deps: linkerAttrs.deps,
|
||||
Deps: linkerAttrs.exportedDeps,
|
||||
Dynamic_deps: linkerAttrs.dynamicDeps,
|
||||
Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
|
||||
Copts: compilerAttrs.copts,
|
||||
Includes: exportedIncludes,
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
Srcs: srcs,
|
||||
Implementation_deps: linkerAttrs.deps,
|
||||
Deps: linkerAttrs.exportedDeps,
|
||||
Dynamic_deps: linkerAttrs.dynamicDeps,
|
||||
Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
|
||||
Copts: compilerAttrs.copts,
|
||||
Includes: exportedIncludes,
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
Cppflags: compilerAttrs.cppFlags,
|
||||
Srcs_c: compilerAttrs.cSrcs,
|
||||
Conlyflags: compilerAttrs.conlyFlags,
|
||||
Srcs_as: compilerAttrs.asSrcs,
|
||||
Asflags: compilerAttrs.asFlags,
|
||||
|
||||
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,
|
||||
@@ -2230,6 +2245,12 @@ type bazelCcLibraryStaticAttributes struct {
|
||||
Linkstatic bool
|
||||
Includes bazel.StringListAttribute
|
||||
Hdrs bazel.LabelListAttribute
|
||||
|
||||
Cppflags bazel.StringListAttribute
|
||||
Srcs_c bazel.LabelListAttribute
|
||||
Conlyflags bazel.StringListAttribute
|
||||
Srcs_as bazel.LabelListAttribute
|
||||
Asflags bazel.StringListAttribute
|
||||
}
|
||||
|
||||
type bazelCcLibraryStatic struct {
|
||||
@@ -2259,6 +2280,12 @@ func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *
|
||||
Linkopts: linkerAttrs.linkopts,
|
||||
Linkstatic: true,
|
||||
Includes: exportedIncludes,
|
||||
|
||||
Cppflags: compilerAttrs.cppFlags,
|
||||
Srcs_c: compilerAttrs.cSrcs,
|
||||
Conlyflags: compilerAttrs.conlyFlags,
|
||||
Srcs_as: compilerAttrs.asSrcs,
|
||||
Asflags: compilerAttrs.asFlags,
|
||||
}
|
||||
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
|
Reference in New Issue
Block a user