summaryrefslogtreecommitdiff
path: root/rust/androidmk.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2020-04-09 09:56:02 -0400
committer Ivan Lozano <ivanlozano@google.com> 2020-05-05 10:30:15 -0400
commita0cd8f9acb8c5c04c1082cc980cc8cca28aff5a9 (patch)
treef69f7651add1ce0e4089711fa207b4741815c589 /rust/androidmk.go
parentb8bb5d05ce523b0dc88085313f6514910954db41 (diff)
Add gcov coverage support to Rust modules.
This adds gcov coverage support for Rust device library and binary modules (including test modules). Support is provided to pass Rust static library gcno files to CC modules and visa versa. Additional changes: * Begin mutator added for Rust modules. * SuffixInList added to android package. * CoverageEnabled added to Coverage interface. * CoverageFiles added to LinkableLibrary interface. * Fix in coverage mutator for non-CC modules which marked the wrong variant as the coverage variant. * Added coverage libraries to the cc.GatherRequiredDepsForTest. Bug: 146448203 Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module> Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f
Diffstat (limited to 'rust/androidmk.go')
-rw-r--r--rust/androidmk.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 0fba739a2..0e2bea340 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -46,6 +46,12 @@ func (mod *Module) subAndroidMk(data *android.AndroidMkData, obj interface{}) {
}
func (mod *Module) AndroidMk() android.AndroidMkData {
+ if mod.Properties.HideFromMake {
+ return android.AndroidMkData{
+ Disabled: true,
+ }
+ }
+
ret := android.AndroidMkData{
OutputFile: mod.outputFile,
Include: "$(BUILD_SYSTEM)/soong_rust_prebuilt.mk",
@@ -84,6 +90,9 @@ func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.Andr
ret.DistFile = binary.distFile
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", binary.unstrippedOutputFile.String())
+ if binary.coverageOutputZipFile.Valid() {
+ fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE := "+binary.coverageOutputZipFile.String())
+ }
})
}
@@ -124,6 +133,10 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
if !library.rlib() {
fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", library.unstrippedOutputFile.String())
}
+ if library.coverageOutputZipFile.Valid() {
+ fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE := "+library.coverageOutputZipFile.String())
+ }
+
})
}