Add target/os configurable string_list attrs.

Starting with copts for cc_object, with an extracted function that can
be shared with other cc_* module types.

Test: TH
Change-Id: I9025232e83a3dcd0ca243387486fafbdbd3e2d9b
This commit is contained in:
Jingwen Chen
2021-04-05 10:35:13 +00:00
parent 1a6bbbd990
commit c1c2650532
7 changed files with 209 additions and 71 deletions

View File

@@ -156,13 +156,11 @@ func ObjectBp2Build(ctx android.TopDownMutatorContext) {
}
// Set arch-specific configurable attributes
var copts bazel.StringListAttribute
var srcs bazel.LabelListAttribute
var localIncludeDirs []string
var asFlags []string
for _, props := range m.compiler.compilerProps() {
if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
copts.Value = baseCompilerProps.Cflags
srcs = bazel.MakeLabelListAttribute(
android.BazelLabelForModuleSrcExcludes(
ctx,
@@ -205,14 +203,13 @@ func ObjectBp2Build(ctx android.TopDownMutatorContext) {
for arch, p := range m.GetArchProperties(&BaseCompilerProperties{}) {
if cProps, ok := p.(*BaseCompilerProperties); ok {
srcs.SetValueForArch(arch.Name, android.BazelLabelForModuleSrcExcludes(ctx, cProps.Srcs, cProps.Exclude_srcs))
copts.SetValueForArch(arch.Name, cProps.Cflags)
}
}
attrs := &bazelObjectAttributes{
Srcs: srcs,
Deps: deps,
Copts: copts,
Copts: bp2BuildParseCflags(ctx, m),
Asflags: asFlags,
Local_include_dirs: localIncludeDirs,
}