Add bp2build conversion to reference to fdo_profile targets
The fdo_profile targets are handcrafted in ag/20469925. Bp2build creates fdo_profile attribute on cc_library_shared and references to the fdo_profile target if the profile exists. This works under assumption that all afdo profiles have an associated Bazel fdo_profile target declared in the same folder/package.
As noted in b/253540178, this won't work when we check in the BUILD files (which is likely 6+ months away) because some profiles might only exist internally but not in AOSP. We will implement a long-term solution once we figure out all the requirements we need to support afdo both in Soong and Bazel.
Bug: 253540178
Test: go tests
Change-Id: Iebd5dd7a76583b4b2bf0d9ee56d58f247d313a54
Merged-In: Iebd5dd7a76583b4b2bf0d9ee56d58f247d313a54
diff --git a/cc/library.go b/cc/library.go
index 7059023..ed0ed01 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -417,6 +417,8 @@
Strip: stripAttrsFromLinkerAttrs(&linkerAttrs),
Features: baseAttributes.features,
bazelCcHeaderAbiCheckerAttributes: bp2buildParseAbiCheckerProps(ctx, m),
+
+ Fdo_profile: compilerAttrs.fdoProfile,
}
if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 {
@@ -2930,6 +2932,8 @@
Suffix: compilerAttrs.suffix,
bazelCcHeaderAbiCheckerAttributes: bp2buildParseAbiCheckerProps(ctx, module),
+
+ Fdo_profile: compilerAttrs.fdoProfile,
}
if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 {
hasStubs := true
@@ -3020,6 +3024,8 @@
Suffix bazel.StringAttribute
bazelCcHeaderAbiCheckerAttributes
+
+ Fdo_profile bazel.LabelAttribute
}
type bazelCcStubSuiteAttributes struct {