diff options
author | 2025-02-07 00:23:34 +0000 | |
---|---|---|
committer | 2025-02-13 02:09:19 +0000 | |
commit | f1806039ea089186042c01df1141633fc3cf7f5a (patch) | |
tree | d53e67139a2eff3c796a5a1c7eb75eda5b4bb698 /rust/rust.go | |
parent | b58ccb466ea61f076fb71ce03a64b4ae660f7406 (diff) |
Support DepIsInSameApex using provider.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I8ec5e8a3a06d078602ebaa902cacb70987f1deda
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 |