From 1d8e20d744bae14ab3814125e6d9ac28b9fc97e3 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Mon, 20 Nov 2023 21:18:12 +0000 Subject: rust: internalize srcPathFromModuleSrcs This was frequently misused (for example, in the prebuilts module, it was used as a complex "assert(len(srcs))==1"), and can be superceded by getCrateRoot anywhere it was used. It's now only called from compiler.go, and can drop the second return parameter, as it was only actually used by the prebuilt assert misuse. Bug: 309943184 Test: m nothing Change-Id: I6c92580bc8f0ecb7586c544056b5409e6dd280e7 --- rust/binary.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'rust/binary.go') diff --git a/rust/binary.go b/rust/binary.go index 860dc948a..146c683fb 100644 --- a/rust/binary.go +++ b/rust/binary.go @@ -137,12 +137,7 @@ func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps Path fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix() outputFile := android.PathForModuleOut(ctx, fileName) ret := buildOutput{outputFile: outputFile} - var crateRootPath android.Path - if binary.baseCompiler.Properties.Crate_root == nil { - crateRootPath, _ = srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs) - } else { - crateRootPath = android.PathForModuleSrc(ctx, *binary.baseCompiler.Properties.Crate_root) - } + crateRootPath := binary.crateRootPath(ctx) flags.RustFlags = append(flags.RustFlags, deps.depFlags...) flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...) -- cgit v1.2.3-59-g8ed1b