Make filesystem aware of coverage
filesystem should have coverage variants with coverage-enabled build. Otherwise, it would fail to collect dependencies. Bug: 273238141 Test: m nothing (soong tests) Test: compare the artifacts $ SKIP_ABI_CHECKS=true SOONG_COLLECT_JAVA_DEPS=true EMMA_INSTRUMENT=true\ EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true\ NATIVE_COVERAGE_PATHS='*' m microdroid $ m microdroid Change-Id: I792458ace00a63b4b5213898fd3209351a6e00be
This commit is contained in:
@@ -219,10 +219,14 @@ func SetCoverageProperties(ctx android.BaseModuleContext, properties CoveragePro
|
||||
return properties
|
||||
}
|
||||
|
||||
// Coverage is an interface for non-CC modules to implement to be mutated for coverage
|
||||
type Coverage interface {
|
||||
type UseCoverage interface {
|
||||
android.Module
|
||||
IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool
|
||||
}
|
||||
|
||||
// Coverage is an interface for non-CC modules to implement to be mutated for coverage
|
||||
type Coverage interface {
|
||||
UseCoverage
|
||||
SetPreventInstall()
|
||||
HideFromMake()
|
||||
MarkAsCoverageVariant(bool)
|
||||
@@ -261,6 +265,11 @@ func coverageMutator(mctx android.BottomUpMutatorContext) {
|
||||
|
||||
m[1].(Coverage).MarkAsCoverageVariant(true)
|
||||
m[1].(Coverage).EnableCoverageIfNeeded()
|
||||
} else if cov, ok := mctx.Module().(UseCoverage); ok && cov.IsNativeCoverageNeeded(mctx) {
|
||||
// Module itself doesn't have to have "cov" variant, but it should use "cov" variants of
|
||||
// deps.
|
||||
mctx.CreateVariations("cov")
|
||||
mctx.AliasVariation("cov")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user