Rust cdylib/statliclib support for vendor snapshot.
Adds support for platform vendor_available Rust FFI libraries and binaries to be included in the vendor snapshot. Because rlib and dylibs are not yet in snapshots, libstd cannot be included in a vendor snapshot. As a result, vendor-specific Rust code can't be guaranteed to work with the platform-provided vendor_available modules built with a newer toolchain. For now, a check is added indicating vendor-specific Rust code is unsupported. This changes the linkage for vendor variants of these modules to default to rlib linkage since dylibs cannot be included in the snapshot yet. Bug: 184042776 Test: m nothing # new Soong tests pass Change-Id: I502eaa4bb962eb87ff868fcf49b435f0d2f982e6
This commit is contained in:
@@ -18,18 +18,34 @@ import (
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
// snapshotLibraryInterface is an interface for libraries captured to VNDK / vendor snapshots.
|
||||
type snapshotLibraryInterface interface {
|
||||
libraryInterface
|
||||
|
||||
// collectHeadersForSnapshot is called in GenerateAndroidBuildActions for snapshot aware
|
||||
// modules (See isSnapshotAware below).
|
||||
// This function should gather all headers needed for snapshot.
|
||||
collectHeadersForSnapshot(ctx android.ModuleContext, deps PathDeps)
|
||||
|
||||
// snapshotHeaders should return collected headers by collectHeadersForSnapshot.
|
||||
// Calling snapshotHeaders before collectHeadersForSnapshot is an error.
|
||||
snapshotHeaders() android.Paths
|
||||
}
|
||||
|
||||
func (mod *Module) ExcludeFromVendorSnapshot() bool {
|
||||
// TODO Rust does not yet support snapshotting
|
||||
return false
|
||||
return Bool(mod.Properties.Exclude_from_vendor_snapshot)
|
||||
}
|
||||
|
||||
func (mod *Module) ExcludeFromRecoverySnapshot() bool {
|
||||
// TODO Rust does not yet support snapshotting
|
||||
return false
|
||||
return Bool(mod.Properties.Exclude_from_recovery_snapshot)
|
||||
}
|
||||
|
||||
func (mod *Module) IsSnapshotLibrary() bool {
|
||||
// TODO Rust does not yet support snapshotting
|
||||
if lib, ok := mod.compiler.(libraryInterface); ok {
|
||||
// Rust-native dylibs and rlibs are not snapshot supported yet, so only
|
||||
// return true if this module produces a C shared or static library.
|
||||
return lib.shared() || lib.static()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -39,8 +55,7 @@ func (mod *Module) SnapshotRuntimeLibs() []string {
|
||||
}
|
||||
|
||||
func (mod *Module) SnapshotSharedLibs() []string {
|
||||
// TODO Rust does not yet support snapshotting
|
||||
return []string{}
|
||||
return mod.Properties.SnapshotSharedLibs
|
||||
}
|
||||
|
||||
func (mod *Module) Symlinks() []string {
|
||||
@@ -49,6 +64,8 @@ func (mod *Module) Symlinks() []string {
|
||||
}
|
||||
|
||||
func (m *Module) SnapshotHeaders() android.Paths {
|
||||
// TODO Rust does not yet support snapshotting
|
||||
if l, ok := m.compiler.(snapshotLibraryInterface); ok {
|
||||
return l.snapshotHeaders()
|
||||
}
|
||||
return android.Paths{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user