rust: Emit toc files for cdylibs

Write toc files that list the exported symbols so dependents are
only rebuilt if the exported symbols change.

This exports the CC function TransformSharedObjectToToc, and also
removes an unused arg from its signature.

Bug: 178185435
Test: New Soong test passes.
Test: m <toc file path>
Change-Id: I7ab69bf7e7f32f25eb4c7ca9d18d877dac1511db
This commit is contained in:
Ivan Lozano
2021-11-03 15:30:18 -04:00
parent a3bd963988
commit 7b0781d14c
10 changed files with 53 additions and 18 deletions

View File

@@ -137,12 +137,16 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
} else if library.shared() {
ret.Class = "SHARED_LIBRARIES"
}
if library.distFile.Valid() {
ret.DistFiles = android.MakeDefaultDistFiles(library.distFile.Path())
}
ret.ExtraEntries = append(ret.ExtraEntries,
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if library.tocFile.Valid() {
entries.SetString("LOCAL_SOONG_TOC", library.tocFile.String())
}
})
}
func (procMacro *procMacroDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
ctx.SubAndroidMk(ret, procMacro.baseCompiler)