Support suffix property in bp2build

Support this in cc_{binary,library{,_shared}}

Bug: 204811222
Test: Suffix additions to cc_{binary,library{,_shared}}_conversion_test.go
Test: mixed_{libc,droid}.sh also builds newly allowlisted
Change-Id: I596694794b01b04c542cbcd7d54baeb7d914ba50
This commit is contained in:
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
2022-02-23 18:39:59 -05:00
parent 1520d7fb2d
commit a56e97042c
6 changed files with 235 additions and 25 deletions

View File

@@ -339,6 +339,8 @@ type compilerAttributes struct {
stubsVersions bazel.StringListAttribute
features bazel.StringListAttribute
suffix bazel.StringAttribute
}
type filterOutFn func(string) bool
@@ -694,6 +696,9 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module)
compilerAttrs.stubsSymbolFile = libraryProps.Stubs.Symbol_file
compilerAttrs.stubsVersions.SetSelectValue(axis, config, libraryProps.Stubs.Versions)
}
if suffix := libraryProps.Suffix; suffix != nil {
compilerAttrs.suffix.SetSelectValue(axis, config, suffix)
}
}
}
}
@@ -1201,6 +1206,7 @@ func bazelLabelForSharedDepsExcludes(ctx android.BazelConversionPathContext, mod
type binaryLinkerAttrs struct {
Linkshared *bool
Suffix bazel.StringAttribute
}
func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module) binaryLinkerAttrs {
@@ -1217,6 +1223,9 @@ func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module
// nonconfigurable attribute. Only 4 AOSP modules use this feature, defer handling
ctx.ModuleErrorf("bp2build cannot migrate a module with arch/target-specific static_executable values")
}
if suffix := linkerProps.Suffix; suffix != nil {
attrs.Suffix.SetSelectValue(axis, config, suffix)
}
})
return attrs