From 24cf036b51ab29df4417ee3e26d8261a7b82346d Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Fri, 4 Oct 2024 16:02:38 +0000 Subject: rust: Don't produce apex variants if apex_exclude The apex variants of apex_exclude modules were leading to a mixing of apex and non-apex dependencies in their dependency trees, causing StableId collisions when an -L path for both variants was emitted to the rustc command. Since we already exclude these variants from apexes (they are effectively serving as a stop-gap for stub support), don't produce apex variants if apex_exclude is true. Bug: 203478530 Test: m Change-Id: I1448ce1aad989b8a97fd31552a00afa7e6b78829 --- rust/rust.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rust/rust.go') diff --git a/rust/rust.go b/rust/rust.go index 5602edc79..a044a99dd 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -1756,6 +1756,16 @@ func (mod *Module) HostToolPath() android.OptionalPath { var _ android.ApexModule = (*Module)(nil) +// If a module is marked for exclusion from apexes, don't provide apex variants. +// TODO(b/362509506): remove this once stubs are properly supported by rust_ffi targets. +func (m *Module) CanHaveApexVariants() bool { + if m.ApexExclude() { + return false + } else { + return m.ApexModuleBase.CanHaveApexVariants() + } +} + func (mod *Module) MinSdkVersion() string { return String(mod.Properties.Min_sdk_version) } -- cgit v1.2.3-59-g8ed1b