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
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user