diff options
Diffstat (limited to 'rust/rust.go')
-rw-r--r-- | rust/rust.go | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/rust/rust.go b/rust/rust.go index 4eec5d254..4fd800282 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -2115,12 +2115,28 @@ func (mod *Module) AlwaysRequiresPlatformApexVariant() bool { } // Implements android.ApexModule -func (mod *Module) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool { +type RustDepInSameApexChecker struct { + Static bool + HasStubsVariants bool + ApexExclude bool + Host bool +} + +func (mod *Module) GetDepInSameApexChecker() android.DepInSameApexChecker { + return RustDepInSameApexChecker{ + Static: mod.Static(), + HasStubsVariants: mod.HasStubsVariants(), + ApexExclude: mod.ApexExclude(), + Host: mod.Host(), + } +} + +func (r RustDepInSameApexChecker) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool { if depTag == procMacroDepTag || depTag == customBindgenDepTag { return false } - if mod.Static() && cc.IsSharedDepTag(depTag) { + if r.Static && cc.IsSharedDepTag(depTag) { // shared_lib dependency from a static lib is considered as crossing // the APEX boundary because the dependency doesn't actually is // linked; the dependency is used only during the compilation phase. @@ -2137,23 +2153,23 @@ func (mod *Module) OutgoingDepIsInSameApex(depTag blueprint.DependencyTag) bool } // TODO(b/362509506): remove once all apex_exclude uses are switched to stubs. - if mod.ApexExclude() { + if r.ApexExclude { return false } return true } -func (mod *Module) IncomingDepIsInSameApex(depTag blueprint.DependencyTag) bool { - if mod.Host() { +func (r RustDepInSameApexChecker) IncomingDepIsInSameApex(depTag blueprint.DependencyTag) bool { + if r.Host { return false } // TODO(b/362509506): remove once all apex_exclude uses are switched to stubs. - if mod.ApexExclude() { + if r.ApexExclude { return false } - if mod.HasStubsVariants() { + if r.HasStubsVariants { if cc.IsSharedDepTag(depTag) && !cc.IsExplicitImplSharedDepTag(depTag) { // dynamic dep to a stubs lib crosses APEX boundary return false |