summaryrefslogtreecommitdiff
path: root/rust/coverage.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-01-23 20:58:32 +0000
committer Yu Liu <yudiliu@google.com> 2025-01-23 20:59:28 +0000
commit727204cbdf8295b93084db6b05d3f2beb4a661f6 (patch)
treec053527fa0c6031876dab86c08086ef447173376 /rust/coverage.go
parent4d78e0108b85354098811ec86307cc8d2550555f (diff)
Convert rust to use ModuleProxy.
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I2eb0134bb727f5875d579dae1fff5b70658bd2bb
Diffstat (limited to 'rust/coverage.go')
-rw-r--r--rust/coverage.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/rust/coverage.go b/rust/coverage.go
index 381fcf1b4..ae95e46b1 100644
--- a/rust/coverage.go
+++ b/rust/coverage.go
@@ -15,6 +15,7 @@
package rust
import (
+ "android/soong/android"
"github.com/google/blueprint"
"android/soong/cc"
@@ -65,16 +66,18 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
flags.RustFlags = append(flags.RustFlags,
"-C instrument-coverage", "-g")
if ctx.Device() {
- coverage := ctx.GetDirectDepWithTag(CovLibraryName, cc.CoverageDepTag).(cc.LinkableInterface)
+ m := ctx.GetDirectDepProxyWithTag(CovLibraryName, cc.CoverageDepTag)
+ coverage := android.OtherModuleProviderOrDefault(ctx, m, cc.LinkableInfoProvider)
flags.LinkFlags = append(flags.LinkFlags,
- profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open")
- deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path())
+ profileInstrFlag, "-g", coverage.OutputFile.Path().String(), "-Wl,--wrap,open")
+ deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile.Path())
}
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
if rustModule, ok := ctx.Module().(*Module); ok && rustModule.compiler.noStdlibs() {
- profiler_builtins := ctx.GetDirectDepWithTag(ProfilerBuiltins, rlibDepTag).(*Module)
- deps.RLibs = append(deps.RLibs, RustLibrary{Path: profiler_builtins.OutputFile().Path(), CrateName: profiler_builtins.CrateName()})
+ m := ctx.GetDirectDepProxyWithTag(ProfilerBuiltins, rlibDepTag)
+ profiler_builtins := android.OtherModuleProviderOrDefault(ctx, m, cc.LinkableInfoProvider)
+ deps.RLibs = append(deps.RLibs, RustLibrary{Path: profiler_builtins.OutputFile.Path(), CrateName: profiler_builtins.CrateName})
}
if cc.EnableContinuousCoverage(ctx) {