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
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 625e7ce..77aaec1 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -339,6 +339,8 @@
stubsVersions bazel.StringListAttribute
features bazel.StringListAttribute
+
+ suffix bazel.StringAttribute
}
type filterOutFn func(string) bool
@@ -694,6 +696,9 @@
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 @@
type binaryLinkerAttrs struct {
Linkshared *bool
+ Suffix bazel.StringAttribute
}
func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module) binaryLinkerAttrs {
@@ -1217,6 +1223,9 @@
// 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
diff --git a/cc/library.go b/cc/library.go
index fc03fa2..c97970e 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -408,6 +408,8 @@
sharedTargetAttrs.Has_stubs.SetValue(&hasStubs)
}
+ sharedTargetAttrs.Suffix = compilerAttrs.suffix
+
for axis, configToProps := range m.GetArchVariantProperties(ctx, &LibraryProperties{}) {
for config, props := range configToProps {
if props, ok := props.(*LibraryProperties); ok {
@@ -2647,6 +2649,8 @@
},
Features: baseAttributes.features,
+
+ Suffix: compilerAttrs.suffix,
}
if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 {
hasStubs := true
@@ -2729,6 +2733,8 @@
Has_stubs bazel.BoolAttribute
Inject_bssl_hash bazel.BoolAttribute
+
+ Suffix bazel.StringAttribute
}
type bazelCcStubSuiteAttributes struct {