summaryrefslogtreecommitdiff
path: root/rust/binary.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2020-07-22 16:09:13 -0400
committerIvan Lozano <ivanlozano@google.com>2020-07-22 20:34:22 +0000
commit07cbaf4d893ef00505d6d38d93a286dec11fb08e (patch)
tree001e14613360e28445c70ba713640ee848d9138f /rust/binary.go
parent188f2ee1eed92a3bc384128354ef71c9da177062 (diff)
Enforce correct variant usage for rust_bindgen.
Modules defined in the srcs property are automatically added as dependencies with AddDependency(), which will use any variant available. This can cause incorrect architecture bindings to be silently pulled in, such as when a host module uses a rust_bindgen module that doesn't create a host variant. This moves populating depPaths.SrcDeps over to depsToPaths and adds a check for SourceProviders to make sure the correct OS and architecture is being used. Bug: 161826371 Test: Soong no longer silently pulls in bindings for the wrong target. Test: New Soong test to catch this case passes. Change-Id: I2b3651cf6fc7dabf4081434df1c455e637f5b3a4
Diffstat (limited to 'rust/binary.go')
-rw-r--r--rust/binary.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/rust/binary.go b/rust/binary.go
index 48f51dbdf..1e9e11990 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -106,8 +106,7 @@ func (binary *binaryDecorator) nativeCoverage() bool {
func (binary *binaryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path {
fileName := binary.getStem(ctx) + ctx.toolchain().ExecutableSuffix()
- srcPath, paths := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs)
- deps.SrcDeps = append(deps.SrcDeps, paths...)
+ srcPath, _ := srcPathFromModuleSrcs(ctx, binary.baseCompiler.Properties.Srcs)
outputFile := android.PathForModuleOut(ctx, fileName)
binary.unstrippedOutputFile = outputFile