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
This commit is contained in:
Matthew Maurer
2023-11-20 21:18:12 +00:00
parent d221d31534
commit 1d8e20d744
5 changed files with 20 additions and 21 deletions

View File

@@ -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...)