Add a property to rust_ffi targets to exclude them from APEXes.
This is a temporary measure until stubs are properly supported by rust_ffi targets. Bug: 361441210 Bug: 362509506 Change-Id: Ieabd4e3abf442de660f39ec6c5776f5832b25e14 Test: manual
This commit is contained in:
@@ -2230,6 +2230,10 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
addAconfigFiles(vctx, ctx, child)
|
addAconfigFiles(vctx, ctx, child)
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
} else if rm, ok := child.(*rust.Module); ok {
|
} else if rm, ok := child.(*rust.Module); ok {
|
||||||
|
if !android.IsDepInSameApex(ctx, am, am) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
af := apexFileForRustLibrary(ctx, rm)
|
af := apexFileForRustLibrary(ctx, rm)
|
||||||
af.transitiveDep = true
|
af.transitiveDep = true
|
||||||
vctx.filesInfo = append(vctx.filesInfo, af)
|
vctx.filesInfo = append(vctx.filesInfo, af)
|
||||||
@@ -2249,6 +2253,10 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
}
|
}
|
||||||
} else if rust.IsDylibDepTag(depTag) {
|
} else if rust.IsDylibDepTag(depTag) {
|
||||||
if rustm, ok := child.(*rust.Module); ok && rustm.IsInstallableToApex() {
|
if rustm, ok := child.(*rust.Module); ok && rustm.IsInstallableToApex() {
|
||||||
|
if !android.IsDepInSameApex(ctx, am, am) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
af := apexFileForRustLibrary(ctx, rustm)
|
af := apexFileForRustLibrary(ctx, rustm)
|
||||||
af.transitiveDep = true
|
af.transitiveDep = true
|
||||||
vctx.filesInfo = append(vctx.filesInfo, af)
|
vctx.filesInfo = append(vctx.filesInfo, af)
|
||||||
|
@@ -70,6 +70,10 @@ type LibraryCompilerProperties struct {
|
|||||||
|
|
||||||
// Whether this library is part of the Rust toolchain sysroot.
|
// Whether this library is part of the Rust toolchain sysroot.
|
||||||
Sysroot *bool
|
Sysroot *bool
|
||||||
|
|
||||||
|
// Exclude this rust_ffi target from being included in APEXes.
|
||||||
|
// TODO(b/362509506): remove this once stubs are properly supported by rust_ffi targets.
|
||||||
|
Apex_exclude *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibraryMutatedProperties struct {
|
type LibraryMutatedProperties struct {
|
||||||
@@ -122,6 +126,7 @@ type libraryInterface interface {
|
|||||||
shared() bool
|
shared() bool
|
||||||
sysroot() bool
|
sysroot() bool
|
||||||
source() bool
|
source() bool
|
||||||
|
apexExclude() bool
|
||||||
|
|
||||||
// Returns true if the build options for the module have selected a particular build type
|
// Returns true if the build options for the module have selected a particular build type
|
||||||
buildRlib() bool
|
buildRlib() bool
|
||||||
@@ -186,6 +191,10 @@ func (library *libraryDecorator) source() bool {
|
|||||||
return library.MutatedProperties.VariantIsSource
|
return library.MutatedProperties.VariantIsSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *libraryDecorator) apexExclude() bool {
|
||||||
|
return Bool(library.Properties.Apex_exclude)
|
||||||
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) buildRlib() bool {
|
func (library *libraryDecorator) buildRlib() bool {
|
||||||
return library.MutatedProperties.BuildRlib && BoolDefault(library.Properties.Rlib.Enabled, true)
|
return library.MutatedProperties.BuildRlib && BoolDefault(library.Properties.Rlib.Enabled, true)
|
||||||
}
|
}
|
||||||
|
13
rust/rust.go
13
rust/rust.go
@@ -294,6 +294,15 @@ func (mod *Module) StaticExecutable() bool {
|
|||||||
return mod.StaticallyLinked()
|
return mod.StaticallyLinked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) ApexExclude() bool {
|
||||||
|
if mod.compiler != nil {
|
||||||
|
if library, ok := mod.compiler.(libraryInterface); ok {
|
||||||
|
return library.apexExclude()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) Object() bool {
|
func (mod *Module) Object() bool {
|
||||||
// Rust has no modules which produce only object files.
|
// Rust has no modules which produce only object files.
|
||||||
return false
|
return false
|
||||||
@@ -1863,6 +1872,10 @@ func (mod *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Mo
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rustDep, ok := dep.(*Module); ok && rustDep.ApexExclude() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user