bloaty: measure stripped Rust binaries

Modify bloaty's MeasureSizeForPath to allow a module to provide multiple
paths. This is used to measure both unstripped and stripped
libraries/binaries. Add unit test to ensure correct measurements are
generated for Rust.

Test: m out/soong/binary_sizes.pb.gz
Change-Id: I59439b77dbf1cf5ad71e1c02996a6a90938536b4
This commit is contained in:
Thiébaud Weksteen
2021-04-14 11:18:47 +02:00
parent 4fab05a2ad
commit e4dd14b25f
7 changed files with 76 additions and 19 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/bloaty"
"android/soong/cc"
cc_config "android/soong/cc/config"
"android/soong/rust/config"
@@ -731,8 +732,8 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
if mod.compiler != nil && !mod.compiler.Disabled() {
mod.compiler.initialize(ctx)
unstrippedOutputFile := mod.compiler.compile(ctx, flags, deps)
mod.unstrippedOutputFile = android.OptionalPathForPath(unstrippedOutputFile)
bloaty.MeasureSizeForPaths(ctx, mod.compiler.strippedOutputFilePath(), mod.unstrippedOutputFile)
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if mod.installable(apexInfo) {