rust: Add vendor and recovery dylib support.
Adds dylib support for vendor and recovery images. This changes the default linkage for vendor and recovery images to dylib, which matches the platform default linkage. This also means that by default, dylib-std variants are used for rlib dependencies. Bug: 204303985 Test: Soong tests. Test: m dist vendor-snapshot Test: RECOVERY_SNAPSHOT_VERSION=current m dist recovery-snapshot Change-Id: If84074b8615a70c45e7e162abeb853dc8c34d49a
This commit is contained in:
@@ -21,10 +21,6 @@ import (
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
const (
|
||||
snapshotRlibSuffix = "_rlib."
|
||||
)
|
||||
|
||||
type snapshotLibraryDecorator struct {
|
||||
cc.BaseSnapshotDecorator
|
||||
*libraryDecorator
|
||||
@@ -44,6 +40,8 @@ func init() {
|
||||
func registerRustSnapshotModules(ctx android.RegistrationContext) {
|
||||
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
|
||||
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||
"vendor_snapshot_dylib", VendorSnapshotDylibFactory)
|
||||
cc.RecoverySnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||
"recovery_snapshot_rlib", RecoverySnapshotRlibFactory)
|
||||
}
|
||||
@@ -77,12 +75,11 @@ func (library *snapshotLibraryDecorator) compile(ctx ModuleContext, flags Flags,
|
||||
variant = cc.SnapshotSharedSuffix
|
||||
} else if library.rlib() {
|
||||
variant = cc.SnapshotRlibSuffix
|
||||
} else if library.dylib() {
|
||||
variant = cc.SnapshotDylibSuffix
|
||||
}
|
||||
|
||||
if !library.dylib() {
|
||||
// TODO(184042776): Remove this check when dylibs are supported in snapshots.
|
||||
library.SetSnapshotAndroidMkSuffix(ctx, variant)
|
||||
}
|
||||
library.SetSnapshotAndroidMkSuffix(ctx, variant)
|
||||
|
||||
if !library.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||
return buildOutput{}
|
||||
@@ -107,6 +104,17 @@ func VendorSnapshotRlibFactory() android.Module {
|
||||
return module.Init()
|
||||
}
|
||||
|
||||
// vendor_snapshot_dylib is a special prebuilt dylib library which is auto-generated by
|
||||
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_dylib
|
||||
// overrides the vendor variant of the rust dylib library with the same name, if BOARD_VNDK_VERSION
|
||||
// is set.
|
||||
func VendorSnapshotDylibFactory() android.Module {
|
||||
module, prebuilt := snapshotLibraryFactory(cc.VendorSnapshotImageSingleton, cc.SnapshotDylibSuffix)
|
||||
prebuilt.libraryDecorator.BuildOnlyDylib()
|
||||
prebuilt.libraryDecorator.setNoStdlibs()
|
||||
return module.Init()
|
||||
}
|
||||
|
||||
func RecoverySnapshotRlibFactory() android.Module {
|
||||
module, prebuilt := snapshotLibraryFactory(cc.RecoverySnapshotImageSingleton, cc.SnapshotRlibSuffix)
|
||||
prebuilt.libraryDecorator.BuildOnlyRlib()
|
||||
|
Reference in New Issue
Block a user