Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.
This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.
Bug: 207812332
Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
diff --git a/cc/bp2build.go b/cc/bp2build.go
index cc2e60e..c5eab06 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -280,6 +280,9 @@
includes BazelIncludes
protoSrcs bazel.LabelListAttribute
+
+ stubsSymbolFile *string
+ stubsVersions bazel.StringListAttribute
}
type filterOutFn func(string) bool
@@ -464,10 +467,11 @@
return relative, absolute
}
-// bp2BuildParseCompilerProps returns copts, srcs and hdrs and other attributes.
+// bp2BuildParseBaseProps returns all compiler, linker, library attributes of a cc module..
func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) baseAttributes {
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
archVariantLinkerProps := module.GetArchVariantProperties(ctx, &BaseLinkerProperties{})
+ archVariantLibraryProperties := module.GetArchVariantProperties(ctx, &LibraryProperties{})
var implementationHdrs bazel.LabelListAttribute
@@ -484,6 +488,7 @@
}
allAxesAndConfigs(archVariantCompilerProps)
allAxesAndConfigs(archVariantLinkerProps)
+ allAxesAndConfigs(archVariantLibraryProperties)
compilerAttrs := compilerAttributes{}
linkerAttrs := linkerAttributes{}
@@ -519,6 +524,13 @@
currIncludes := compilerAttrs.localIncludes.SelectValue(axis, config)
currIncludes = android.FirstUniqueStrings(append(currIncludes, includes...))
compilerAttrs.localIncludes.SetSelectValue(axis, config, currIncludes)
+
+ if libraryProps, ok := archVariantLibraryProperties[axis][config].(*LibraryProperties); ok {
+ if axis == bazel.NoConfigAxis {
+ compilerAttrs.stubsSymbolFile = libraryProps.Stubs.Symbol_file
+ compilerAttrs.stubsVersions.SetSelectValue(axis, config, libraryProps.Stubs.Versions)
+ }
+ }
}
}
diff --git a/cc/library.go b/cc/library.go
index 1f9ff7c..cefbf6c 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -381,6 +381,9 @@
None: linkerAttrs.stripNone,
},
Features: linkerAttrs.features,
+
+ Stubs_symbol_file: compilerAttrs.stubsSymbolFile,
+ Stubs_versions: compilerAttrs.stubsVersions,
}
staticProps := bazel.BazelTargetModuleProperties{
@@ -2518,6 +2521,9 @@
},
Features: linkerAttrs.features,
+
+ Stubs_symbol_file: compilerAttrs.stubsSymbolFile,
+ Stubs_versions: compilerAttrs.stubsVersions,
}
}
@@ -2591,4 +2597,7 @@
Asflags bazel.StringListAttribute
Features bazel.StringListAttribute
+
+ Stubs_symbol_file *string
+ Stubs_versions bazel.StringListAttribute
}