From 727204cbdf8295b93084db6b05d3f2beb4a661f6 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Thu, 23 Jan 2025 20:58:32 +0000 Subject: Convert rust to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I2eb0134bb727f5875d579dae1fff5b70658bd2bb --- rust/coverage.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'rust/coverage.go') 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) { -- cgit v1.2.3-59-g8ed1b