diff options
Diffstat (limited to 'rust/binary.go')
-rw-r--r-- | rust/binary.go | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/rust/binary.go b/rust/binary.go index fda056e43..c25ae0969 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -35,9 +35,10 @@ type BinaryCompilerProperties struct { type binaryDecorator struct { *baseCompiler - Properties BinaryCompilerProperties - distFile android.OptionalPath - unstrippedOutputFile android.Path + Properties BinaryCompilerProperties + distFile android.OptionalPath + coverageOutputZipFile android.OptionalPath + unstrippedOutputFile android.Path } var _ compiler = (*binaryDecorator)(nil) @@ -104,6 +105,10 @@ func (binary *binaryDecorator) compilerProps() []interface{} { &binary.Properties) } +func (binary *binaryDecorator) nativeCoverage() bool { + return true +} + func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix() @@ -114,7 +119,21 @@ func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps Path flags.RustFlags = append(flags.RustFlags, deps.depFlags...) - TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) + outputs := TransformSrcToBinary(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) + binary.coverageFile = outputs.coverageFile + + var coverageFiles android.Paths + if outputs.coverageFile != nil { + coverageFiles = append(coverageFiles, binary.coverageFile) + } + if len(deps.coverageFiles) > 0 { + coverageFiles = append(coverageFiles, deps.coverageFiles...) + } + binary.coverageOutputZipFile = TransformCoverageFilesToZip(ctx, coverageFiles, binary.getStem(ctx)) return outputFile } + +func (binary *binaryDecorator) coverageOutputZipPath() android.OptionalPath { + return binary.coverageOutputZipFile +} |