diff options
author | Jiyong Park <jiyong@google.com> | 2021-04-07 15:08:04 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2021-04-07 22:23:31 +0900 |
commit | e54f07e38a40dffcdec52f21a745efcf1b055902 (patch) | |
tree | 0c5ea6373ed9cc3b55798904be2c0b13ded5c13c /rust/compiler.go | |
parent | 0774773a65c2b4164c725ca00b5fad88048f6259 (diff) |
Stripped rust bin/libs are included in APEX
Previously, when a rust bin or library is selected for an APEX,
OutputFile() was used to get the file to be used. However, OutputFile()
always returns the unstripped output file even when the stripped output
file is available. As a result, APEX having a rust module was very big
due to the debugging information that exists in the unstripped file.
When a rust module is directly installed to the built-in partitions, we
use the stripped one whenever it's available. To make the same happen
when the rust module is placed in an APEX, OutputFile() is modified to
return the unstripped output if it's available.
Bug: 181751814
Test: TARGET_BUILD_APPS=com.android.virt m
The size is reduced from 180MB to 43MB
Change-Id: I6f8479e6a4794aac8bf94a84afdf65d417c75db0
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 41b73719a..2e85f5a22 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -272,6 +272,10 @@ func (compiler *baseCompiler) isDependencyRoot() bool { return false } +func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath { + return compiler.strippedOutputFile +} + func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { deps.Rlibs = append(deps.Rlibs, compiler.Properties.Rlibs...) deps.Dylibs = append(deps.Dylibs, compiler.Properties.Dylibs...) @@ -337,10 +341,7 @@ func (compiler *baseCompiler) nativeCoverage() bool { } func (compiler *baseCompiler) install(ctx ModuleContext) { - path := ctx.RustModule().outputFile - if compiler.strippedOutputFile.Valid() { - path = compiler.strippedOutputFile - } + path := ctx.RustModule().OutputFile() compiler.path = ctx.InstallFile(compiler.installDir(ctx), path.Path().Base(), path.Path()) } |