Don't export link dirs from proc-macros.

We shouldn't use exported link dirs from proc-macros as these may be
libraries for the wrong architecture or OS.

This doesn't cause a problem unless both the proc-macro and the
dependent library share a dependency. If that's the case, in some
circumstances it will cause the depdent library to fail compilation
when using a library with incorrect architecture.

Bug: 163088025
Test: Test case no longer colliding.
Test: cd external/rust/; mma
Change-Id: I46cbd850c3a89d10aa844b5c1b383e1070452d00
This commit is contained in:
Ivan Lozano 2020-08-07 09:00:50 -04:00
parent d13b308960
commit 2bbcacf0c9

View file

@ -807,8 +807,8 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
directSrcProvidersDeps = append(directSrcProvidersDeps, rustDep)
}
//Append the dependencies exportedDirs
if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok {
//Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag {
depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...)
depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...)
}