From 07cbaf4d893ef00505d6d38d93a286dec11fb08e Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Wed, 22 Jul 2020 16:09:13 -0400 Subject: 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 --- rust/library.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'rust/library.go') diff --git a/rust/library.go b/rust/library.go index acca25627..ac725d7da 100644 --- a/rust/library.go +++ b/rust/library.go @@ -368,8 +368,7 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) F func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { var outputFile android.WritablePath - srcPath, paths := srcPathFromModuleSrcs(ctx, library.baseCompiler.Properties.Srcs) - deps.SrcDeps = append(deps.SrcDeps, paths...) + srcPath, _ := srcPathFromModuleSrcs(ctx, library.baseCompiler.Properties.Srcs) flags.RustFlags = append(flags.RustFlags, deps.depFlags...) -- cgit v1.2.3-59-g8ed1b