Merge changes I4976d3e1,I4c53b937,I502eaa4b am: 42b7157ff6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1719775 Change-Id: I3939f5cbcbfdb581a72dc31d60d3389ea0aa4779
This commit is contained in:
8
cc/cc.go
8
cc/cc.go
@@ -1267,8 +1267,8 @@ func (c *Module) nativeCoverage() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) IsSnapshotPrebuilt() bool {
|
func (c *Module) IsSnapshotPrebuilt() bool {
|
||||||
if p, ok := c.linker.(snapshotInterface); ok {
|
if p, ok := c.linker.(SnapshotInterface); ok {
|
||||||
return p.isSnapshotPrebuilt()
|
return p.IsSnapshotPrebuilt()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -2946,10 +2946,10 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
|
|||||||
if ccDepModule != nil {
|
if ccDepModule != nil {
|
||||||
// TODO(ivanlozano) Support snapshots for Rust-produced C library variants.
|
// TODO(ivanlozano) Support snapshots for Rust-produced C library variants.
|
||||||
// Use base module name for snapshots when exporting to Makefile.
|
// Use base module name for snapshots when exporting to Makefile.
|
||||||
if snapshotPrebuilt, ok := ccDepModule.linker.(snapshotInterface); ok {
|
if snapshotPrebuilt, ok := ccDepModule.linker.(SnapshotInterface); ok {
|
||||||
baseName := ccDepModule.BaseModuleName()
|
baseName := ccDepModule.BaseModuleName()
|
||||||
|
|
||||||
return baseName + snapshotPrebuilt.snapshotAndroidMkSuffix()
|
return baseName + snapshotPrebuilt.SnapshotAndroidMkSuffix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -365,8 +365,8 @@ func (m *Module) SetCoreVariantNeeded(b bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
||||||
if snapshot, ok := m.linker.(snapshotInterface); ok {
|
if snapshot, ok := m.linker.(SnapshotInterface); ok {
|
||||||
return snapshot.version()
|
return snapshot.Version()
|
||||||
} else {
|
} else {
|
||||||
mctx.ModuleErrorf("version is unknown for snapshot prebuilt")
|
mctx.ModuleErrorf("version is unknown for snapshot prebuilt")
|
||||||
// Should we be panicking here instead?
|
// Should we be panicking here instead?
|
||||||
|
@@ -28,7 +28,7 @@ import (
|
|||||||
|
|
||||||
// Defines the specifics of different images to which the snapshot process is applicable, e.g.,
|
// Defines the specifics of different images to which the snapshot process is applicable, e.g.,
|
||||||
// vendor, recovery, ramdisk.
|
// vendor, recovery, ramdisk.
|
||||||
type snapshotImage interface {
|
type SnapshotImage interface {
|
||||||
// Returns true if a snapshot should be generated for this image.
|
// Returns true if a snapshot should be generated for this image.
|
||||||
shouldGenerateSnapshot(ctx android.SingletonContext) bool
|
shouldGenerateSnapshot(ctx android.SingletonContext) bool
|
||||||
|
|
||||||
@@ -120,6 +120,10 @@ func (vendorSnapshotImage) Init(ctx android.RegistrationContext) {
|
|||||||
ctx.RegisterSingletonType("vendor-fake-snapshot", VendorFakeSnapshotSingleton)
|
ctx.RegisterSingletonType("vendor-fake-snapshot", VendorFakeSnapshotSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (vendorSnapshotImage) RegisterAdditionalModule(ctx android.RegistrationContext, name string, factory android.ModuleFactory) {
|
||||||
|
ctx.RegisterModuleType(name, factory)
|
||||||
|
}
|
||||||
|
|
||||||
func (vendorSnapshotImage) shouldGenerateSnapshot(ctx android.SingletonContext) bool {
|
func (vendorSnapshotImage) shouldGenerateSnapshot(ctx android.SingletonContext) bool {
|
||||||
// BOARD_VNDK_VERSION must be set to 'current' in order to generate a snapshot.
|
// BOARD_VNDK_VERSION must be set to 'current' in order to generate a snapshot.
|
||||||
return ctx.DeviceConfig().VndkVersion() == "current"
|
return ctx.DeviceConfig().VndkVersion() == "current"
|
||||||
@@ -264,16 +268,18 @@ func init() {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
snapshotHeaderSuffix = "_header."
|
snapshotHeaderSuffix = "_header."
|
||||||
snapshotSharedSuffix = "_shared."
|
SnapshotSharedSuffix = "_shared."
|
||||||
snapshotStaticSuffix = "_static."
|
SnapshotStaticSuffix = "_static."
|
||||||
snapshotBinarySuffix = "_binary."
|
snapshotBinarySuffix = "_binary."
|
||||||
snapshotObjectSuffix = "_object."
|
snapshotObjectSuffix = "_object."
|
||||||
|
SnapshotRlibSuffix = "_rlib."
|
||||||
)
|
)
|
||||||
|
|
||||||
type SnapshotProperties struct {
|
type SnapshotProperties struct {
|
||||||
Header_libs []string `android:"arch_variant"`
|
Header_libs []string `android:"arch_variant"`
|
||||||
Static_libs []string `android:"arch_variant"`
|
Static_libs []string `android:"arch_variant"`
|
||||||
Shared_libs []string `android:"arch_variant"`
|
Shared_libs []string `android:"arch_variant"`
|
||||||
|
Rlibs []string `android:"arch_variant"`
|
||||||
Vndk_libs []string `android:"arch_variant"`
|
Vndk_libs []string `android:"arch_variant"`
|
||||||
Binaries []string `android:"arch_variant"`
|
Binaries []string `android:"arch_variant"`
|
||||||
Objects []string `android:"arch_variant"`
|
Objects []string `android:"arch_variant"`
|
||||||
@@ -284,14 +290,14 @@ type snapshot struct {
|
|||||||
|
|
||||||
properties SnapshotProperties
|
properties SnapshotProperties
|
||||||
|
|
||||||
baseSnapshot baseSnapshotDecorator
|
baseSnapshot BaseSnapshotDecorator
|
||||||
|
|
||||||
image snapshotImage
|
image SnapshotImage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *snapshot) ImageMutatorBegin(ctx android.BaseModuleContext) {
|
func (s *snapshot) ImageMutatorBegin(ctx android.BaseModuleContext) {
|
||||||
cfg := ctx.DeviceConfig()
|
cfg := ctx.DeviceConfig()
|
||||||
if !s.image.isUsingSnapshot(cfg) || s.image.targetSnapshotVersion(cfg) != s.baseSnapshot.version() {
|
if !s.image.isUsingSnapshot(cfg) || s.image.targetSnapshotVersion(cfg) != s.baseSnapshot.Version() {
|
||||||
s.Disable()
|
s.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +347,7 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
snapshotMap[name] = name +
|
snapshotMap[name] = name +
|
||||||
getSnapshotNameSuffix(snapshotSuffix+moduleSuffix,
|
getSnapshotNameSuffix(snapshotSuffix+moduleSuffix,
|
||||||
s.baseSnapshot.version(),
|
s.baseSnapshot.Version(),
|
||||||
ctx.DeviceConfig().Arches()[0].ArchType.String())
|
ctx.DeviceConfig().Arches()[0].ArchType.String())
|
||||||
}
|
}
|
||||||
return snapshotMap
|
return snapshotMap
|
||||||
@@ -351,8 +357,9 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
headers := collectSnapshotMap(s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
|
headers := collectSnapshotMap(s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
|
||||||
binaries := collectSnapshotMap(s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
|
binaries := collectSnapshotMap(s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
|
||||||
objects := collectSnapshotMap(s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
|
objects := collectSnapshotMap(s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
|
||||||
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
|
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, SnapshotStaticSuffix)
|
||||||
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
|
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, SnapshotSharedSuffix)
|
||||||
|
rlibs := collectSnapshotMap(s.properties.Rlibs, snapshotSuffix, SnapshotRlibSuffix)
|
||||||
vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
|
vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
|
||||||
for k, v := range vndkLibs {
|
for k, v := range vndkLibs {
|
||||||
sharedLibs[k] = v
|
sharedLibs[k] = v
|
||||||
@@ -364,11 +371,12 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
Objects: objects,
|
Objects: objects,
|
||||||
StaticLibs: staticLibs,
|
StaticLibs: staticLibs,
|
||||||
SharedLibs: sharedLibs,
|
SharedLibs: sharedLibs,
|
||||||
|
Rlibs: rlibs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type SnapshotInfo struct {
|
type SnapshotInfo struct {
|
||||||
HeaderLibs, Binaries, Objects, StaticLibs, SharedLibs map[string]string
|
HeaderLibs, Binaries, Objects, StaticLibs, SharedLibs, Rlibs map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
|
var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
|
||||||
@@ -383,7 +391,7 @@ func recoverySnapshotFactory() android.Module {
|
|||||||
return snapshotFactory(recoverySnapshotImageSingleton)
|
return snapshotFactory(recoverySnapshotImageSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotFactory(image snapshotImage) android.Module {
|
func snapshotFactory(image SnapshotImage) android.Module {
|
||||||
snapshot := &snapshot{}
|
snapshot := &snapshot{}
|
||||||
snapshot.image = image
|
snapshot.image = image
|
||||||
snapshot.AddProperties(
|
snapshot.AddProperties(
|
||||||
@@ -393,7 +401,7 @@ func snapshotFactory(image snapshotImage) android.Module {
|
|||||||
return snapshot
|
return snapshot
|
||||||
}
|
}
|
||||||
|
|
||||||
type baseSnapshotDecoratorProperties struct {
|
type BaseSnapshotDecoratorProperties struct {
|
||||||
// snapshot version.
|
// snapshot version.
|
||||||
Version string
|
Version string
|
||||||
|
|
||||||
@@ -408,7 +416,7 @@ type baseSnapshotDecoratorProperties struct {
|
|||||||
ModuleSuffix string `blueprint:"mutated"`
|
ModuleSuffix string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// baseSnapshotDecorator provides common basic functions for all snapshot modules, such as snapshot
|
// BaseSnapshotDecorator provides common basic functions for all snapshot modules, such as snapshot
|
||||||
// version, snapshot arch, etc. It also adds a special suffix to Soong module name, so it doesn't
|
// version, snapshot arch, etc. It also adds a special suffix to Soong module name, so it doesn't
|
||||||
// collide with source modules. e.g. the following example module,
|
// collide with source modules. e.g. the following example module,
|
||||||
//
|
//
|
||||||
@@ -420,40 +428,40 @@ type baseSnapshotDecoratorProperties struct {
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// will be seen as "libbase.vendor_static.30.arm64" by Soong.
|
// will be seen as "libbase.vendor_static.30.arm64" by Soong.
|
||||||
type baseSnapshotDecorator struct {
|
type BaseSnapshotDecorator struct {
|
||||||
baseProperties baseSnapshotDecoratorProperties
|
baseProperties BaseSnapshotDecoratorProperties
|
||||||
image snapshotImage
|
image SnapshotImage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) Name(name string) string {
|
func (p *BaseSnapshotDecorator) Name(name string) string {
|
||||||
return name + p.NameSuffix()
|
return name + p.NameSuffix()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) NameSuffix() string {
|
func (p *BaseSnapshotDecorator) NameSuffix() string {
|
||||||
return getSnapshotNameSuffix(p.moduleSuffix(), p.version(), p.arch())
|
return getSnapshotNameSuffix(p.moduleSuffix(), p.Version(), p.Arch())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) version() string {
|
func (p *BaseSnapshotDecorator) Version() string {
|
||||||
return p.baseProperties.Version
|
return p.baseProperties.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) arch() string {
|
func (p *BaseSnapshotDecorator) Arch() string {
|
||||||
return p.baseProperties.Target_arch
|
return p.baseProperties.Target_arch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) moduleSuffix() string {
|
func (p *BaseSnapshotDecorator) moduleSuffix() string {
|
||||||
return p.baseProperties.ModuleSuffix
|
return p.baseProperties.ModuleSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) isSnapshotPrebuilt() bool {
|
func (p *BaseSnapshotDecorator) IsSnapshotPrebuilt() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) snapshotAndroidMkSuffix() string {
|
func (p *BaseSnapshotDecorator) SnapshotAndroidMkSuffix() string {
|
||||||
return p.baseProperties.Androidmk_suffix
|
return p.baseProperties.Androidmk_suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleContext, variant string) {
|
func (p *BaseSnapshotDecorator) SetSnapshotAndroidMkSuffix(ctx android.ModuleContext, variant string) {
|
||||||
// If there are any 2 or more variations among {core, product, vendor, recovery}
|
// If there are any 2 or more variations among {core, product, vendor, recovery}
|
||||||
// we have to add the androidmk suffix to avoid duplicate modules with the same
|
// we have to add the androidmk suffix to avoid duplicate modules with the same
|
||||||
// name.
|
// name.
|
||||||
@@ -461,7 +469,7 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
Mutator: "image",
|
Mutator: "image",
|
||||||
Variation: android.CoreVariation})
|
Variation: android.CoreVariation})
|
||||||
|
|
||||||
if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(*Module).BaseModuleName()) {
|
if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(LinkableInterface).BaseModuleName()) {
|
||||||
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -470,12 +478,12 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
Mutator: "image",
|
Mutator: "image",
|
||||||
Variation: ProductVariationPrefix + ctx.DeviceConfig().PlatformVndkVersion()})
|
Variation: ProductVariationPrefix + ctx.DeviceConfig().PlatformVndkVersion()})
|
||||||
|
|
||||||
if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(*Module).BaseModuleName()) {
|
if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(LinkableInterface).BaseModuleName()) {
|
||||||
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
images := []snapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
|
images := []SnapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
|
||||||
|
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
if p.image == image {
|
if p.image == image {
|
||||||
@@ -486,10 +494,10 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
Variation: image.imageVariantName(ctx.DeviceConfig())})
|
Variation: image.imageVariantName(ctx.DeviceConfig())})
|
||||||
|
|
||||||
if ctx.OtherModuleFarDependencyVariantExists(variations,
|
if ctx.OtherModuleFarDependencyVariantExists(variations,
|
||||||
ctx.Module().(*Module).BaseModuleName()+
|
ctx.Module().(LinkableInterface).BaseModuleName()+
|
||||||
getSnapshotNameSuffix(
|
getSnapshotNameSuffix(
|
||||||
image.moduleNameSuffix()+variant,
|
image.moduleNameSuffix()+variant,
|
||||||
p.version(),
|
p.Version(),
|
||||||
ctx.DeviceConfig().Arches()[0].ArchType.String())) {
|
ctx.DeviceConfig().Arches()[0].ArchType.String())) {
|
||||||
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
|
||||||
return
|
return
|
||||||
@@ -501,7 +509,7 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
|
|
||||||
// Call this with a module suffix after creating a snapshot module, such as
|
// Call this with a module suffix after creating a snapshot module, such as
|
||||||
// vendorSnapshotSharedSuffix, recoverySnapshotBinarySuffix, etc.
|
// vendorSnapshotSharedSuffix, recoverySnapshotBinarySuffix, etc.
|
||||||
func (p *baseSnapshotDecorator) init(m *Module, image snapshotImage, moduleSuffix string) {
|
func (p *BaseSnapshotDecorator) Init(m LinkableInterface, image SnapshotImage, moduleSuffix string) {
|
||||||
p.image = image
|
p.image = image
|
||||||
p.baseProperties.ModuleSuffix = image.moduleNameSuffix() + moduleSuffix
|
p.baseProperties.ModuleSuffix = image.moduleNameSuffix() + moduleSuffix
|
||||||
m.AddProperties(&p.baseProperties)
|
m.AddProperties(&p.baseProperties)
|
||||||
@@ -512,8 +520,8 @@ func (p *baseSnapshotDecorator) init(m *Module, image snapshotImage, moduleSuffi
|
|||||||
|
|
||||||
// vendorSnapshotLoadHook disables snapshots if it's not BOARD_VNDK_VERSION.
|
// vendorSnapshotLoadHook disables snapshots if it's not BOARD_VNDK_VERSION.
|
||||||
// As vendor snapshot is only for vendor, such modules won't be used at all.
|
// As vendor snapshot is only for vendor, such modules won't be used at all.
|
||||||
func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *baseSnapshotDecorator) {
|
func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *BaseSnapshotDecorator) {
|
||||||
if p.version() != ctx.DeviceConfig().VndkVersion() {
|
if p.Version() != ctx.DeviceConfig().VndkVersion() {
|
||||||
ctx.Module().Disable()
|
ctx.Module().Disable()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -528,7 +536,7 @@ func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *baseSnapshotDecorato
|
|||||||
// include directories, c flags, sanitize dependency information, etc.
|
// include directories, c flags, sanitize dependency information, etc.
|
||||||
//
|
//
|
||||||
// These modules are auto-generated by development/vendor_snapshot/update.py.
|
// These modules are auto-generated by development/vendor_snapshot/update.py.
|
||||||
type snapshotLibraryProperties struct {
|
type SnapshotLibraryProperties struct {
|
||||||
// Prebuilt file for each arch.
|
// Prebuilt file for each arch.
|
||||||
Src *string `android:"arch_variant"`
|
Src *string `android:"arch_variant"`
|
||||||
|
|
||||||
@@ -554,14 +562,14 @@ type snapshotSanitizer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type snapshotLibraryDecorator struct {
|
type snapshotLibraryDecorator struct {
|
||||||
baseSnapshotDecorator
|
BaseSnapshotDecorator
|
||||||
*libraryDecorator
|
*libraryDecorator
|
||||||
properties snapshotLibraryProperties
|
properties SnapshotLibraryProperties
|
||||||
sanitizerProperties struct {
|
sanitizerProperties struct {
|
||||||
CfiEnabled bool `blueprint:"mutated"`
|
CfiEnabled bool `blueprint:"mutated"`
|
||||||
|
|
||||||
// Library flags for cfi variant.
|
// Library flags for cfi variant.
|
||||||
Cfi snapshotLibraryProperties `android:"arch_variant"`
|
Cfi SnapshotLibraryProperties `android:"arch_variant"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,9 +578,9 @@ func (p *snapshotLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) F
|
|||||||
return p.libraryDecorator.linkerFlags(ctx, flags)
|
return p.libraryDecorator.linkerFlags(ctx, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *snapshotLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
|
func (p *snapshotLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
arches := config.Arches()
|
arches := config.Arches()
|
||||||
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
if len(arches) == 0 || arches[0].ArchType.String() != p.Arch() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !p.header() && p.properties.Src == nil {
|
if !p.header() && p.properties.Src == nil {
|
||||||
@@ -587,14 +595,14 @@ func (p *snapshotLibraryDecorator) matchesWithDevice(config android.DeviceConfig
|
|||||||
func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
var variant string
|
var variant string
|
||||||
if p.shared() {
|
if p.shared() {
|
||||||
variant = snapshotSharedSuffix
|
variant = SnapshotSharedSuffix
|
||||||
} else if p.static() {
|
} else if p.static() {
|
||||||
variant = snapshotStaticSuffix
|
variant = SnapshotStaticSuffix
|
||||||
} else {
|
} else {
|
||||||
variant = snapshotHeaderSuffix
|
variant = snapshotHeaderSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setSnapshotAndroidMkSuffix(ctx, variant)
|
p.SetSnapshotAndroidMkSuffix(ctx, variant)
|
||||||
|
|
||||||
if p.header() {
|
if p.header() {
|
||||||
return p.libraryDecorator.link(ctx, flags, deps, objs)
|
return p.libraryDecorator.link(ctx, flags, deps, objs)
|
||||||
@@ -604,7 +612,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
|
|||||||
p.properties = p.sanitizerProperties.Cfi
|
p.properties = p.sanitizerProperties.Cfi
|
||||||
}
|
}
|
||||||
|
|
||||||
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,7 +665,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *snapshotLibraryDecorator) install(ctx ModuleContext, file android.Path) {
|
func (p *snapshotLibraryDecorator) install(ctx ModuleContext, file android.Path) {
|
||||||
if p.matchesWithDevice(ctx.DeviceConfig()) && (p.shared() || p.static()) {
|
if p.MatchesWithDevice(ctx.DeviceConfig()) && (p.shared() || p.static()) {
|
||||||
p.baseInstaller.install(ctx, file)
|
p.baseInstaller.install(ctx, file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -687,7 +695,7 @@ func (p *snapshotLibraryDecorator) setSanitizerVariation(t SanitizerType, enable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotLibraryFactory(image snapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
|
func snapshotLibraryFactory(image SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
|
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
@@ -710,7 +718,7 @@ func snapshotLibraryFactory(image snapshotImage, moduleSuffix string) (*Module,
|
|||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
module.installer = prebuilt
|
module.installer = prebuilt
|
||||||
|
|
||||||
prebuilt.init(module, image, moduleSuffix)
|
prebuilt.Init(module, image, moduleSuffix)
|
||||||
module.AddProperties(
|
module.AddProperties(
|
||||||
&prebuilt.properties,
|
&prebuilt.properties,
|
||||||
&prebuilt.sanitizerProperties,
|
&prebuilt.sanitizerProperties,
|
||||||
@@ -724,7 +732,7 @@ func snapshotLibraryFactory(image snapshotImage, moduleSuffix string) (*Module,
|
|||||||
// overrides the vendor variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
// overrides the vendor variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func VendorSnapshotSharedFactory() android.Module {
|
func VendorSnapshotSharedFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotSharedSuffix)
|
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, SnapshotSharedSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyShared()
|
prebuilt.libraryDecorator.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -734,7 +742,7 @@ func VendorSnapshotSharedFactory() android.Module {
|
|||||||
// overrides the recovery variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
// overrides the recovery variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func RecoverySnapshotSharedFactory() android.Module {
|
func RecoverySnapshotSharedFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, snapshotSharedSuffix)
|
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotSharedSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyShared()
|
prebuilt.libraryDecorator.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -744,7 +752,7 @@ func RecoverySnapshotSharedFactory() android.Module {
|
|||||||
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func VendorSnapshotStaticFactory() android.Module {
|
func VendorSnapshotStaticFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotStaticSuffix)
|
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, SnapshotStaticSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyStatic()
|
prebuilt.libraryDecorator.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -754,7 +762,7 @@ func VendorSnapshotStaticFactory() android.Module {
|
|||||||
// overrides the recovery variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
// overrides the recovery variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func RecoverySnapshotStaticFactory() android.Module {
|
func RecoverySnapshotStaticFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, snapshotStaticSuffix)
|
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotStaticSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyStatic()
|
prebuilt.libraryDecorator.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -794,13 +802,13 @@ type snapshotBinaryProperties struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type snapshotBinaryDecorator struct {
|
type snapshotBinaryDecorator struct {
|
||||||
baseSnapshotDecorator
|
BaseSnapshotDecorator
|
||||||
*binaryDecorator
|
*binaryDecorator
|
||||||
properties snapshotBinaryProperties
|
properties snapshotBinaryProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *snapshotBinaryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
|
func (p *snapshotBinaryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
if config.DeviceArch() != p.arch() {
|
if config.DeviceArch() != p.Arch() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if p.properties.Src == nil {
|
if p.properties.Src == nil {
|
||||||
@@ -812,9 +820,9 @@ func (p *snapshotBinaryDecorator) matchesWithDevice(config android.DeviceConfig)
|
|||||||
// cc modules' link functions are to link compiled objects into final binaries.
|
// cc modules' link functions are to link compiled objects into final binaries.
|
||||||
// As snapshots are prebuilts, this just returns the prebuilt binary
|
// As snapshots are prebuilts, this just returns the prebuilt binary
|
||||||
func (p *snapshotBinaryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
func (p *snapshotBinaryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
p.setSnapshotAndroidMkSuffix(ctx, snapshotBinarySuffix)
|
p.SetSnapshotAndroidMkSuffix(ctx, snapshotBinarySuffix)
|
||||||
|
|
||||||
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,7 +860,7 @@ func RecoverySnapshotBinaryFactory() android.Module {
|
|||||||
return snapshotBinaryFactory(recoverySnapshotImageSingleton, snapshotBinarySuffix)
|
return snapshotBinaryFactory(recoverySnapshotImageSingleton, snapshotBinarySuffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotBinaryFactory(image snapshotImage, moduleSuffix string) android.Module {
|
func snapshotBinaryFactory(image SnapshotImage, moduleSuffix string) android.Module {
|
||||||
module, binary := NewBinary(android.DeviceSupported)
|
module, binary := NewBinary(android.DeviceSupported)
|
||||||
binary.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
binary.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
||||||
binary.baseLinker.Properties.Nocrt = BoolPtr(true)
|
binary.baseLinker.Properties.Nocrt = BoolPtr(true)
|
||||||
@@ -871,7 +879,7 @@ func snapshotBinaryFactory(image snapshotImage, moduleSuffix string) android.Mod
|
|||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
|
||||||
prebuilt.init(module, image, moduleSuffix)
|
prebuilt.Init(module, image, moduleSuffix)
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -889,13 +897,13 @@ type vendorSnapshotObjectProperties struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type snapshotObjectLinker struct {
|
type snapshotObjectLinker struct {
|
||||||
baseSnapshotDecorator
|
BaseSnapshotDecorator
|
||||||
objectLinker
|
objectLinker
|
||||||
properties vendorSnapshotObjectProperties
|
properties vendorSnapshotObjectProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *snapshotObjectLinker) matchesWithDevice(config android.DeviceConfig) bool {
|
func (p *snapshotObjectLinker) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
if config.DeviceArch() != p.arch() {
|
if config.DeviceArch() != p.Arch() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if p.properties.Src == nil {
|
if p.properties.Src == nil {
|
||||||
@@ -907,9 +915,9 @@ func (p *snapshotObjectLinker) matchesWithDevice(config android.DeviceConfig) bo
|
|||||||
// cc modules' link functions are to link compiled objects into final binaries.
|
// cc modules' link functions are to link compiled objects into final binaries.
|
||||||
// As snapshots are prebuilts, this just returns the prebuilt binary
|
// As snapshots are prebuilts, this just returns the prebuilt binary
|
||||||
func (p *snapshotObjectLinker) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
func (p *snapshotObjectLinker) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
p.setSnapshotAndroidMkSuffix(ctx, snapshotObjectSuffix)
|
p.SetSnapshotAndroidMkSuffix(ctx, snapshotObjectSuffix)
|
||||||
|
|
||||||
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +941,7 @@ func VendorSnapshotObjectFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
|
||||||
prebuilt.init(module, VendorSnapshotImageSingleton, snapshotObjectSuffix)
|
prebuilt.Init(module, VendorSnapshotImageSingleton, snapshotObjectSuffix)
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -951,19 +959,19 @@ func RecoverySnapshotObjectFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
|
||||||
prebuilt.init(module, recoverySnapshotImageSingleton, snapshotObjectSuffix)
|
prebuilt.Init(module, recoverySnapshotImageSingleton, snapshotObjectSuffix)
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
type snapshotInterface interface {
|
type SnapshotInterface interface {
|
||||||
matchesWithDevice(config android.DeviceConfig) bool
|
MatchesWithDevice(config android.DeviceConfig) bool
|
||||||
isSnapshotPrebuilt() bool
|
IsSnapshotPrebuilt() bool
|
||||||
version() string
|
Version() string
|
||||||
snapshotAndroidMkSuffix() string
|
SnapshotAndroidMkSuffix() string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ snapshotInterface = (*vndkPrebuiltLibraryDecorator)(nil)
|
var _ SnapshotInterface = (*vndkPrebuiltLibraryDecorator)(nil)
|
||||||
var _ snapshotInterface = (*snapshotLibraryDecorator)(nil)
|
var _ SnapshotInterface = (*snapshotLibraryDecorator)(nil)
|
||||||
var _ snapshotInterface = (*snapshotBinaryDecorator)(nil)
|
var _ SnapshotInterface = (*snapshotBinaryDecorator)(nil)
|
||||||
var _ snapshotInterface = (*snapshotObjectLinker)(nil)
|
var _ SnapshotInterface = (*snapshotObjectLinker)(nil)
|
||||||
|
@@ -109,7 +109,7 @@ func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterf
|
|||||||
return ctx.Config().VndkSnapshotBuildArtifacts()
|
return ctx.Config().VndkSnapshotBuildArtifacts()
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, image := range []snapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
|
for _, image := range []SnapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
|
||||||
if isSnapshotAware(ctx.DeviceConfig(), m, image.isProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
if isSnapshotAware(ctx.DeviceConfig(), m, image.isProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ type snapshotSingleton struct {
|
|||||||
// Implementation of the image interface specific to the image
|
// Implementation of the image interface specific to the image
|
||||||
// associated with this snapshot (e.g., specific to the vendor image,
|
// associated with this snapshot (e.g., specific to the vendor image,
|
||||||
// recovery image, etc.).
|
// recovery image, etc.).
|
||||||
image snapshotImage
|
image SnapshotImage
|
||||||
|
|
||||||
// Whether this singleton is for fake snapshot or not.
|
// Whether this singleton is for fake snapshot or not.
|
||||||
// Fake snapshot is a snapshot whose prebuilt binaries and headers are empty.
|
// Fake snapshot is a snapshot whose prebuilt binaries and headers are empty.
|
||||||
@@ -147,7 +147,7 @@ func isRecoveryProprietaryModule(ctx android.BaseModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determines if the module is a candidate for snapshot.
|
// Determines if the module is a candidate for snapshot.
|
||||||
func isSnapshotAware(cfg android.DeviceConfig, m LinkableInterface, inProprietaryPath bool, apexInfo android.ApexInfo, image snapshotImage) bool {
|
func isSnapshotAware(cfg android.DeviceConfig, m LinkableInterface, inProprietaryPath bool, apexInfo android.ApexInfo, image SnapshotImage) bool {
|
||||||
if !m.Enabled() || m.HiddenFromMake() {
|
if !m.Enabled() || m.HiddenFromMake() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ func isSnapshotAware(cfg android.DeviceConfig, m LinkableInterface, inProprietar
|
|||||||
if sanitizable.Static() {
|
if sanitizable.Static() {
|
||||||
return sanitizable.OutputFile().Valid() && !image.private(m)
|
return sanitizable.OutputFile().Valid() && !image.private(m)
|
||||||
}
|
}
|
||||||
if sanitizable.Shared() {
|
if sanitizable.Shared() || sanitizable.Rlib() {
|
||||||
if !sanitizable.OutputFile().Valid() {
|
if !sanitizable.OutputFile().Valid() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -393,6 +393,8 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
libType = "static"
|
libType = "static"
|
||||||
} else if m.Shared() {
|
} else if m.Shared() {
|
||||||
libType = "shared"
|
libType = "shared"
|
||||||
|
} else if m.Rlib() {
|
||||||
|
libType = "rlib"
|
||||||
} else {
|
} else {
|
||||||
libType = "header"
|
libType = "header"
|
||||||
}
|
}
|
||||||
@@ -404,7 +406,7 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
|||||||
libPath := m.OutputFile().Path()
|
libPath := m.OutputFile().Path()
|
||||||
stem = libPath.Base()
|
stem = libPath.Base()
|
||||||
if sanitizable, ok := m.(PlatformSanitizeable); ok {
|
if sanitizable, ok := m.(PlatformSanitizeable); ok {
|
||||||
if sanitizable.Static() && sanitizable.SanitizePropDefined() && sanitizable.IsSanitizerEnabled(cfi) {
|
if (sanitizable.Static() || sanitizable.Rlib()) && sanitizable.SanitizePropDefined() && sanitizable.IsSanitizerEnabled(cfi) {
|
||||||
// both cfi and non-cfi variant for static libraries can exist.
|
// both cfi and non-cfi variant for static libraries can exist.
|
||||||
// attach .cfi to distinguish between cfi and non-cfi.
|
// attach .cfi to distinguish between cfi and non-cfi.
|
||||||
// e.g. libbase.a -> libbase.cfi.a
|
// e.g. libbase.a -> libbase.cfi.a
|
||||||
|
@@ -360,7 +360,7 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
|
|||||||
// prebuilt vndk modules should match with device
|
// prebuilt vndk modules should match with device
|
||||||
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
|
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
|
||||||
// When b/142675459 is landed, remove following check
|
// When b/142675459 is landed, remove following check
|
||||||
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.matchesWithDevice(mctx.DeviceConfig()) {
|
if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.MatchesWithDevice(mctx.DeviceConfig()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,7 +82,7 @@ func (p *vndkPrebuiltLibraryDecorator) Name(name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
|
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
|
||||||
suffix := p.version()
|
suffix := p.Version()
|
||||||
if p.arch() != "" {
|
if p.arch() != "" {
|
||||||
suffix += "." + p.arch()
|
suffix += "." + p.arch()
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
|
|||||||
return vndkSuffix + suffix
|
return vndkSuffix + suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) version() string {
|
func (p *vndkPrebuiltLibraryDecorator) Version() string {
|
||||||
return String(p.properties.Version)
|
return String(p.properties.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ func (p *vndkPrebuiltLibraryDecorator) binderBit() string {
|
|||||||
return "64"
|
return "64"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) snapshotAndroidMkSuffix() string {
|
func (p *vndkPrebuiltLibraryDecorator) SnapshotAndroidMkSuffix() string {
|
||||||
return ".vendor"
|
return ".vendor"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro
|
|||||||
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
||||||
flags Flags, deps PathDeps, objs Objects) android.Path {
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
|
|
||||||
if !p.matchesWithDevice(ctx.DeviceConfig()) {
|
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
ctx.Module().HideFromMake()
|
ctx.Module().HideFromMake()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|||||||
p.androidMkSuffix = p.NameSuffix()
|
p.androidMkSuffix = p.NameSuffix()
|
||||||
|
|
||||||
vndkVersion := ctx.DeviceConfig().VndkVersion()
|
vndkVersion := ctx.DeviceConfig().VndkVersion()
|
||||||
if vndkVersion == p.version() {
|
if vndkVersion == p.Version() {
|
||||||
p.androidMkSuffix = ""
|
p.androidMkSuffix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
|
func (p *vndkPrebuiltLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
arches := config.Arches()
|
arches := config.Arches()
|
||||||
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
|
||||||
return false
|
return false
|
||||||
@@ -202,7 +202,7 @@ func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *vndkPrebuiltLibraryDecorator) isSnapshotPrebuilt() bool {
|
func (p *vndkPrebuiltLibraryDecorator) IsSnapshotPrebuilt() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ bootstrap_go_package {
|
|||||||
"rust.go",
|
"rust.go",
|
||||||
"sanitize.go",
|
"sanitize.go",
|
||||||
"source_provider.go",
|
"source_provider.go",
|
||||||
|
"snapshot_prebuilt.go",
|
||||||
"snapshot_utils.go",
|
"snapshot_utils.go",
|
||||||
"strip.go",
|
"strip.go",
|
||||||
"test.go",
|
"test.go",
|
||||||
@@ -53,6 +54,7 @@ bootstrap_go_package {
|
|||||||
"rust_test.go",
|
"rust_test.go",
|
||||||
"source_provider_test.go",
|
"source_provider_test.go",
|
||||||
"test_test.go",
|
"test_test.go",
|
||||||
|
"vendor_snapshot_test.go",
|
||||||
],
|
],
|
||||||
pluginFor: ["soong_build"],
|
pluginFor: ["soong_build"],
|
||||||
}
|
}
|
||||||
|
@@ -137,6 +137,9 @@ func (binary *binaryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoD
|
|||||||
// Binaries default to dylib dependencies for device, rlib for host.
|
// Binaries default to dylib dependencies for device, rlib for host.
|
||||||
if binary.preferRlib() {
|
if binary.preferRlib() {
|
||||||
return rlibAutoDep
|
return rlibAutoDep
|
||||||
|
} else if mod, ok := ctx.Module().(*Module); ok && mod.InVendor() {
|
||||||
|
// Vendor Rust binaries should prefer rlibs.
|
||||||
|
return rlibAutoDep
|
||||||
} else if ctx.Device() {
|
} else if ctx.Device() {
|
||||||
return dylibAutoDep
|
return dylibAutoDep
|
||||||
} else {
|
} else {
|
||||||
@@ -147,6 +150,8 @@ func (binary *binaryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoD
|
|||||||
func (binary *binaryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
func (binary *binaryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
||||||
if binary.preferRlib() {
|
if binary.preferRlib() {
|
||||||
return RlibLinkage
|
return RlibLinkage
|
||||||
|
} else if ctx.RustModule().InVendor() {
|
||||||
|
return RlibLinkage
|
||||||
}
|
}
|
||||||
return binary.baseCompiler.stdLinkage(ctx)
|
return binary.baseCompiler.stdLinkage(ctx)
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,12 @@ func (mod *Module) SetCoreVariantNeeded(b bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
func (mod *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
||||||
panic("Rust modules do not support snapshotting: " + mod.BaseModuleName())
|
if snapshot, ok := mod.compiler.(cc.SnapshotInterface); ok {
|
||||||
|
return snapshot.Version()
|
||||||
|
} else {
|
||||||
|
mctx.ModuleErrorf("version is unknown for snapshot prebuilt")
|
||||||
|
return ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (mod *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
@@ -110,7 +115,9 @@ func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) IsSnapshotPrebuilt() bool {
|
func (mod *Module) IsSnapshotPrebuilt() bool {
|
||||||
// Rust does not support prebuilts in its snapshots
|
if p, ok := mod.compiler.(cc.SnapshotInterface); ok {
|
||||||
|
return p.IsSnapshotPrebuilt()
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +209,8 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
|
|||||||
|
|
||||||
func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
||||||
// Rust does not support installing to the product image yet.
|
// Rust does not support installing to the product image yet.
|
||||||
|
vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific()
|
||||||
|
|
||||||
if Bool(mod.VendorProperties.Product_available) {
|
if Bool(mod.VendorProperties.Product_available) {
|
||||||
mctx.PropertyErrorf("product_available",
|
mctx.PropertyErrorf("product_available",
|
||||||
"Rust modules do not yet support being available to the product image")
|
"Rust modules do not yet support being available to the product image")
|
||||||
@@ -217,6 +226,11 @@ func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
|||||||
mctx.PropertyErrorf("vendor_ramdisk_available", "cannot be set for rust_ffi or rust_ffi_shared modules.")
|
mctx.PropertyErrorf("vendor_ramdisk_available", "cannot be set for rust_ffi or rust_ffi_shared modules.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if vendorSpecific {
|
||||||
|
if lib, ok := mod.compiler.(libraryInterface); ok && lib.buildDylib() {
|
||||||
|
mctx.PropertyErrorf("vendor", "Vendor-only dylibs are not yet supported, use rust_library_rlib.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cc.MutateImage(mctx, mod)
|
cc.MutateImage(mctx, mod)
|
||||||
|
|
||||||
|
@@ -99,6 +99,8 @@ type libraryDecorator struct {
|
|||||||
MutatedProperties LibraryMutatedProperties
|
MutatedProperties LibraryMutatedProperties
|
||||||
includeDirs android.Paths
|
includeDirs android.Paths
|
||||||
sourceProvider SourceProvider
|
sourceProvider SourceProvider
|
||||||
|
|
||||||
|
collectedSnapshotHeaders android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
type libraryInterface interface {
|
type libraryInterface interface {
|
||||||
@@ -122,7 +124,8 @@ type libraryInterface interface {
|
|||||||
setStatic()
|
setStatic()
|
||||||
setSource()
|
setSource()
|
||||||
|
|
||||||
// Set libstd linkage
|
// libstd linkage functions
|
||||||
|
rlibStd() bool
|
||||||
setRlibStd()
|
setRlibStd()
|
||||||
setDylibStd()
|
setDylibStd()
|
||||||
|
|
||||||
@@ -193,6 +196,10 @@ func (library *libraryDecorator) setDylib() {
|
|||||||
library.MutatedProperties.VariantIsShared = false
|
library.MutatedProperties.VariantIsShared = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *libraryDecorator) rlibStd() bool {
|
||||||
|
return library.MutatedProperties.VariantIsStaticStd
|
||||||
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) setRlibStd() {
|
func (library *libraryDecorator) setRlibStd() {
|
||||||
library.MutatedProperties.VariantIsStaticStd = true
|
library.MutatedProperties.VariantIsStaticStd = true
|
||||||
}
|
}
|
||||||
@@ -220,7 +227,10 @@ func (library *libraryDecorator) setSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoDep {
|
func (library *libraryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoDep {
|
||||||
if library.preferRlib() {
|
if ctx.Module().(*Module).InVendor() {
|
||||||
|
// Vendor modules should statically link libstd.
|
||||||
|
return rlibAutoDep
|
||||||
|
} else if library.preferRlib() {
|
||||||
return rlibAutoDep
|
return rlibAutoDep
|
||||||
} else if library.rlib() || library.static() {
|
} else if library.rlib() || library.static() {
|
||||||
return rlibAutoDep
|
return rlibAutoDep
|
||||||
@@ -236,7 +246,10 @@ func (library *libraryDecorator) autoDep(ctx android.BottomUpMutatorContext) aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
func (library *libraryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
|
||||||
if library.static() || library.MutatedProperties.VariantIsStaticStd {
|
if ctx.RustModule().InVendor() {
|
||||||
|
// Vendor modules should statically link libstd.
|
||||||
|
return RlibLinkage
|
||||||
|
} else if library.static() || library.MutatedProperties.VariantIsStaticStd {
|
||||||
return RlibLinkage
|
return RlibLinkage
|
||||||
} else if library.baseCompiler.preferRlib() {
|
} else if library.baseCompiler.preferRlib() {
|
||||||
return RlibLinkage
|
return RlibLinkage
|
||||||
@@ -623,6 +636,19 @@ func LibraryMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
// Disable dylib Vendor Ramdisk variations until we support these.
|
// Disable dylib Vendor Ramdisk variations until we support these.
|
||||||
v.(*Module).Disable()
|
v.(*Module).Disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variation := v.(*Module).ModuleBase.ImageVariation().Variation
|
||||||
|
if strings.HasPrefix(variation, cc.VendorVariationPrefix) &&
|
||||||
|
m.HasVendorVariant() &&
|
||||||
|
!cc.IsVendorProprietaryModule(mctx) &&
|
||||||
|
strings.TrimPrefix(variation, cc.VendorVariationPrefix) == mctx.DeviceConfig().VndkVersion() {
|
||||||
|
|
||||||
|
// cc.MutateImage runs before LibraryMutator, so vendor variations which are meant for rlibs only are
|
||||||
|
// produced for Dylibs; however, dylibs should not be enabled for boardVndkVersion for
|
||||||
|
// non-vendor proprietary modules.
|
||||||
|
v.(*Module).Disable()
|
||||||
|
}
|
||||||
|
|
||||||
case "source":
|
case "source":
|
||||||
v.(*Module).compiler.(libraryInterface).setSource()
|
v.(*Module).compiler.(libraryInterface).setSource()
|
||||||
// The source variant does not produce any library.
|
// The source variant does not produce any library.
|
||||||
@@ -659,9 +685,10 @@ func LibstdMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
dylib := modules[1].(*Module)
|
dylib := modules[1].(*Module)
|
||||||
rlib.compiler.(libraryInterface).setRlibStd()
|
rlib.compiler.(libraryInterface).setRlibStd()
|
||||||
dylib.compiler.(libraryInterface).setDylibStd()
|
dylib.compiler.(libraryInterface).setDylibStd()
|
||||||
if dylib.ModuleBase.ImageVariation().Variation == android.VendorRamdiskVariation {
|
if dylib.ModuleBase.ImageVariation().Variation == android.VendorRamdiskVariation ||
|
||||||
|
strings.HasPrefix(dylib.ModuleBase.ImageVariation().Variation, cc.VendorVariationPrefix) {
|
||||||
// TODO(b/165791368)
|
// TODO(b/165791368)
|
||||||
// Disable rlibs that link against dylib-std on vendor ramdisk variations until those dylib
|
// Disable rlibs that link against dylib-std on vendor and vendor ramdisk variations until those dylib
|
||||||
// variants are properly supported.
|
// variants are properly supported.
|
||||||
dylib.Disable()
|
dylib.Disable()
|
||||||
}
|
}
|
||||||
@@ -671,3 +698,54 @@ func LibstdMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *libraryDecorator) snapshotHeaders() android.Paths {
|
||||||
|
if l.collectedSnapshotHeaders == nil {
|
||||||
|
panic("snapshotHeaders() must be called after collectHeadersForSnapshot()")
|
||||||
|
}
|
||||||
|
return l.collectedSnapshotHeaders
|
||||||
|
}
|
||||||
|
|
||||||
|
// collectHeadersForSnapshot collects all exported headers from library.
|
||||||
|
// It globs header files in the source tree for exported include directories,
|
||||||
|
// and tracks generated header files separately.
|
||||||
|
//
|
||||||
|
// This is to be called from GenerateAndroidBuildActions, and then collected
|
||||||
|
// header files can be retrieved by snapshotHeaders().
|
||||||
|
func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext, deps PathDeps) {
|
||||||
|
ret := android.Paths{}
|
||||||
|
|
||||||
|
// Glob together the headers from the modules include_dirs property
|
||||||
|
for _, path := range android.CopyOfPaths(l.includeDirs) {
|
||||||
|
dir := path.String()
|
||||||
|
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ModuleErrorf("glob failed: %#v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, header := range glob {
|
||||||
|
// Filter out only the files with extensions that are headers.
|
||||||
|
found := false
|
||||||
|
for _, ext := range cc.HeaderExts {
|
||||||
|
if strings.HasSuffix(header, ext) {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ret = append(ret, android.PathForSource(ctx, header))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Glob together the headers from C dependencies as well, starting with non-generated headers.
|
||||||
|
ret = append(ret, cc.GlobHeadersForSnapshot(ctx, append(android.CopyOfPaths(deps.depIncludePaths), deps.depSystemIncludePaths...))...)
|
||||||
|
|
||||||
|
// Collect generated headers from C dependencies.
|
||||||
|
ret = append(ret, cc.GlobGeneratedHeadersForSnapshot(ctx, deps.depGeneratedHeaders)...)
|
||||||
|
|
||||||
|
// TODO(185577950): If support for generated headers is added, they need to be collected here as well.
|
||||||
|
l.collectedSnapshotHeaders = ret
|
||||||
|
}
|
||||||
|
117
rust/rust.go
117
rust/rust.go
@@ -85,6 +85,9 @@ type BaseProperties struct {
|
|||||||
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
ExtraVariants []string `blueprint:"mutated"`
|
ExtraVariants []string `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// Used by vendor snapshot to record dependencies from snapshot modules.
|
||||||
|
SnapshotSharedLibs []string `blueprint:"mutated"`
|
||||||
|
|
||||||
// Make this module available when building for vendor ramdisk.
|
// Make this module available when building for vendor ramdisk.
|
||||||
// On device without a dedicated recovery partition, the module is only
|
// On device without a dedicated recovery partition, the module is only
|
||||||
// available after switching root into
|
// available after switching root into
|
||||||
@@ -92,6 +95,20 @@ type BaseProperties struct {
|
|||||||
// the recovery variant instead (TODO(b/165791368) recovery not yet supported)
|
// the recovery variant instead (TODO(b/165791368) recovery not yet supported)
|
||||||
Vendor_ramdisk_available *bool
|
Vendor_ramdisk_available *bool
|
||||||
|
|
||||||
|
// Normally Soong uses the directory structure to decide which modules
|
||||||
|
// should be included (framework) or excluded (non-framework) from the
|
||||||
|
// different snapshots (vendor, recovery, etc.), but this property
|
||||||
|
// allows a partner to exclude a module normally thought of as a
|
||||||
|
// framework module from the vendor snapshot.
|
||||||
|
Exclude_from_vendor_snapshot *bool
|
||||||
|
|
||||||
|
// Normally Soong uses the directory structure to decide which modules
|
||||||
|
// should be included (framework) or excluded (non-framework) from the
|
||||||
|
// different snapshots (vendor, recovery, etc.), but this property
|
||||||
|
// allows a partner to exclude a module normally thought of as a
|
||||||
|
// framework module from the recovery snapshot.
|
||||||
|
Exclude_from_recovery_snapshot *bool
|
||||||
|
|
||||||
// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
|
// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
|
||||||
Min_sdk_version *string
|
Min_sdk_version *string
|
||||||
|
|
||||||
@@ -826,6 +843,14 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
|
|
||||||
mod.docTimestampFile = mod.compiler.rustdoc(ctx, flags, deps)
|
mod.docTimestampFile = mod.compiler.rustdoc(ctx, flags, deps)
|
||||||
|
|
||||||
|
// glob exported headers for snapshot, if BOARD_VNDK_VERSION is current or
|
||||||
|
// RECOVERY_SNAPSHOT_VERSION is current.
|
||||||
|
if lib, ok := mod.compiler.(snapshotLibraryInterface); ok {
|
||||||
|
if cc.ShouldCollectHeadersForSnapshot(ctx, mod, apexInfo) {
|
||||||
|
lib.collectHeadersForSnapshot(ctx, deps)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||||
if mod.installable(apexInfo) {
|
if mod.installable(apexInfo) {
|
||||||
mod.compiler.install(ctx)
|
mod.compiler.install(ctx)
|
||||||
@@ -1056,6 +1081,10 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
|
depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
|
||||||
depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
|
depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
|
||||||
directSharedLibDeps = append(directSharedLibDeps, ccDep)
|
directSharedLibDeps = append(directSharedLibDeps, ccDep)
|
||||||
|
|
||||||
|
// Record baseLibName for snapshots.
|
||||||
|
mod.Properties.SnapshotSharedLibs = append(mod.Properties.SnapshotSharedLibs, cc.BaseLibName(depName))
|
||||||
|
|
||||||
mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, makeLibName)
|
mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, makeLibName)
|
||||||
exportDep = true
|
exportDep = true
|
||||||
case cc.IsHeaderDepTag(depTag):
|
case cc.IsHeaderDepTag(depTag):
|
||||||
@@ -1161,6 +1190,11 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
deps := mod.deps(ctx)
|
deps := mod.deps(ctx)
|
||||||
var commonDepVariations []blueprint.Variation
|
var commonDepVariations []blueprint.Variation
|
||||||
|
var snapshotInfo *cc.SnapshotInfo
|
||||||
|
|
||||||
|
if ctx.Os() == android.Android {
|
||||||
|
deps.SharedLibs, _ = cc.RewriteLibs(mod, &snapshotInfo, actx, ctx.Config(), deps.SharedLibs)
|
||||||
|
}
|
||||||
|
|
||||||
stdLinkage := "dylib-std"
|
stdLinkage := "dylib-std"
|
||||||
if mod.compiler.stdLinkage(ctx) == RlibLinkage {
|
if mod.compiler.stdLinkage(ctx) == RlibLinkage {
|
||||||
@@ -1168,61 +1202,101 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rlibDepVariations := commonDepVariations
|
rlibDepVariations := commonDepVariations
|
||||||
|
|
||||||
if lib, ok := mod.compiler.(libraryInterface); !ok || !lib.sysroot() {
|
if lib, ok := mod.compiler.(libraryInterface); !ok || !lib.sysroot() {
|
||||||
rlibDepVariations = append(rlibDepVariations,
|
rlibDepVariations = append(rlibDepVariations,
|
||||||
blueprint.Variation{Mutator: "rust_stdlinkage", Variation: stdLinkage})
|
blueprint.Variation{Mutator: "rust_stdlinkage", Variation: stdLinkage})
|
||||||
}
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies(
|
// rlibs
|
||||||
append(rlibDepVariations, []blueprint.Variation{
|
for _, lib := range deps.Rlibs {
|
||||||
{Mutator: "rust_libraries", Variation: rlibVariation}}...),
|
depTag := rlibDepTag
|
||||||
rlibDepTag, deps.Rlibs...)
|
lib = cc.RewriteSnapshotLib(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
|
||||||
|
|
||||||
|
actx.AddVariationDependencies(append(rlibDepVariations, []blueprint.Variation{
|
||||||
|
{Mutator: "rust_libraries", Variation: rlibVariation},
|
||||||
|
}...), depTag, lib)
|
||||||
|
}
|
||||||
|
|
||||||
|
// dylibs
|
||||||
actx.AddVariationDependencies(
|
actx.AddVariationDependencies(
|
||||||
append(commonDepVariations, []blueprint.Variation{
|
append(commonDepVariations, []blueprint.Variation{
|
||||||
{Mutator: "rust_libraries", Variation: dylibVariation}}...),
|
{Mutator: "rust_libraries", Variation: dylibVariation}}...),
|
||||||
dylibDepTag, deps.Dylibs...)
|
dylibDepTag, deps.Dylibs...)
|
||||||
|
|
||||||
|
// rustlibs
|
||||||
if deps.Rustlibs != nil && !mod.compiler.Disabled() {
|
if deps.Rustlibs != nil && !mod.compiler.Disabled() {
|
||||||
autoDep := mod.compiler.(autoDeppable).autoDep(ctx)
|
autoDep := mod.compiler.(autoDeppable).autoDep(ctx)
|
||||||
if autoDep.depTag == rlibDepTag {
|
if autoDep.depTag == rlibDepTag {
|
||||||
actx.AddVariationDependencies(
|
for _, lib := range deps.Rustlibs {
|
||||||
append(rlibDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: autoDep.variation}),
|
depTag := autoDep.depTag
|
||||||
autoDep.depTag, deps.Rustlibs...)
|
lib = cc.RewriteSnapshotLib(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
|
||||||
|
actx.AddVariationDependencies(append(rlibDepVariations, []blueprint.Variation{
|
||||||
|
{Mutator: "rust_libraries", Variation: autoDep.variation},
|
||||||
|
}...), depTag, lib)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
actx.AddVariationDependencies(
|
actx.AddVariationDependencies(
|
||||||
append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: autoDep.variation}),
|
append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: autoDep.variation}),
|
||||||
autoDep.depTag, deps.Rustlibs...)
|
autoDep.depTag, deps.Rustlibs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stdlibs
|
||||||
if deps.Stdlibs != nil {
|
if deps.Stdlibs != nil {
|
||||||
if mod.compiler.stdLinkage(ctx) == RlibLinkage {
|
if mod.compiler.stdLinkage(ctx) == RlibLinkage {
|
||||||
actx.AddVariationDependencies(
|
for _, lib := range deps.Stdlibs {
|
||||||
append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: "rlib"}),
|
depTag := rlibDepTag
|
||||||
rlibDepTag, deps.Stdlibs...)
|
lib = cc.RewriteSnapshotLib(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
|
||||||
|
|
||||||
|
actx.AddVariationDependencies(append(commonDepVariations, []blueprint.Variation{{Mutator: "rust_libraries", Variation: "rlib"}}...),
|
||||||
|
depTag, lib)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
actx.AddVariationDependencies(
|
actx.AddVariationDependencies(
|
||||||
append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: "dylib"}),
|
append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: "dylib"}),
|
||||||
dylibDepTag, deps.Stdlibs...)
|
dylibDepTag, deps.Stdlibs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actx.AddVariationDependencies(append(commonDepVariations,
|
|
||||||
blueprint.Variation{Mutator: "link", Variation: "shared"}),
|
for _, lib := range deps.SharedLibs {
|
||||||
cc.SharedDepTag(), deps.SharedLibs...)
|
depTag := cc.SharedDepTag()
|
||||||
actx.AddVariationDependencies(append(commonDepVariations,
|
name, version := cc.StubsLibNameAndVersion(lib)
|
||||||
blueprint.Variation{Mutator: "link", Variation: "static"}),
|
|
||||||
cc.StaticDepTag(false), deps.StaticLibs...)
|
variations := []blueprint.Variation{
|
||||||
actx.AddVariationDependencies(append(commonDepVariations,
|
{Mutator: "link", Variation: "shared"},
|
||||||
blueprint.Variation{Mutator: "link", Variation: "static"}),
|
}
|
||||||
cc.StaticDepTag(true), deps.WholeStaticLibs...)
|
cc.AddSharedLibDependenciesWithVersions(ctx, mod, variations, depTag, name, version, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lib := range deps.WholeStaticLibs {
|
||||||
|
depTag := cc.StaticDepTag(true)
|
||||||
|
lib = cc.RewriteSnapshotLib(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
|
{Mutator: "link", Variation: "static"},
|
||||||
|
}, depTag, lib)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, lib := range deps.StaticLibs {
|
||||||
|
depTag := cc.StaticDepTag(false)
|
||||||
|
lib = cc.RewriteSnapshotLib(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
|
{Mutator: "link", Variation: "static"},
|
||||||
|
}, depTag, lib)
|
||||||
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies(nil, cc.HeaderDepTag(), deps.HeaderLibs...)
|
actx.AddVariationDependencies(nil, cc.HeaderDepTag(), deps.HeaderLibs...)
|
||||||
|
|
||||||
crtVariations := cc.GetCrtVariations(ctx, mod)
|
crtVariations := cc.GetCrtVariations(ctx, mod)
|
||||||
if deps.CrtBegin != "" {
|
if deps.CrtBegin != "" {
|
||||||
actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag, deps.CrtBegin)
|
actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag,
|
||||||
|
cc.RewriteSnapshotLib(deps.CrtBegin, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects))
|
||||||
}
|
}
|
||||||
if deps.CrtEnd != "" {
|
if deps.CrtEnd != "" {
|
||||||
actx.AddVariationDependencies(crtVariations, cc.CrtEndDepTag, deps.CrtEnd)
|
actx.AddVariationDependencies(crtVariations, cc.CrtEndDepTag,
|
||||||
|
cc.RewriteSnapshotLib(deps.CrtEnd, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects))
|
||||||
}
|
}
|
||||||
|
|
||||||
if mod.sourceProvider != nil {
|
if mod.sourceProvider != nil {
|
||||||
@@ -1232,6 +1306,7 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
bindgen.Properties.Custom_bindgen)
|
bindgen.Properties.Custom_bindgen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// proc_macros are compiler plugins, and so we need the host arch variant as a dependendcy.
|
// proc_macros are compiler plugins, and so we need the host arch variant as a dependendcy.
|
||||||
actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), procMacroDepTag, deps.ProcMacros...)
|
actx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), procMacroDepTag, deps.ProcMacros...)
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,12 @@ var prepareForRustTest = android.GroupFixturePreparers(
|
|||||||
|
|
||||||
genrule.PrepareForTestWithGenRuleBuildComponents,
|
genrule.PrepareForTestWithGenRuleBuildComponents,
|
||||||
|
|
||||||
PrepareForIntegrationTestWithRust,
|
PrepareForTestWithRustIncludeVndk,
|
||||||
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
|
variables.DeviceVndkVersion = StringPtr("current")
|
||||||
|
variables.ProductVndkVersion = StringPtr("current")
|
||||||
|
variables.Platform_vndk_version = StringPtr("29")
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
var rustMockedFiles = android.MockFS{
|
var rustMockedFiles = android.MockFS{
|
||||||
@@ -45,6 +50,8 @@ var rustMockedFiles = android.MockFS{
|
|||||||
"foo.c": nil,
|
"foo.c": nil,
|
||||||
"src/bar.rs": nil,
|
"src/bar.rs": nil,
|
||||||
"src/any.h": nil,
|
"src/any.h": nil,
|
||||||
|
"c_includes/c_header.h": nil,
|
||||||
|
"rust_includes/rust_headers.h": nil,
|
||||||
"proto.proto": nil,
|
"proto.proto": nil,
|
||||||
"proto/buf.proto": nil,
|
"proto/buf.proto": nil,
|
||||||
"buf.proto": nil,
|
"buf.proto": nil,
|
||||||
@@ -52,6 +59,7 @@ var rustMockedFiles = android.MockFS{
|
|||||||
"liby.so": nil,
|
"liby.so": nil,
|
||||||
"libz.so": nil,
|
"libz.so": nil,
|
||||||
"data.txt": nil,
|
"data.txt": nil,
|
||||||
|
"liblog.map.txt": nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
// testRust returns a TestContext in which a basic environment has been setup.
|
// testRust returns a TestContext in which a basic environment has been setup.
|
||||||
@@ -67,19 +75,33 @@ func testRust(t *testing.T, bp string) *android.TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testRustVndk(t *testing.T, bp string) *android.TestContext {
|
func testRustVndk(t *testing.T, bp string) *android.TestContext {
|
||||||
|
return testRustVndkFs(t, bp, rustMockedFiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
sharedVendorVariant = "android_vendor.29_arm64_armv8-a_shared"
|
||||||
|
rlibVendorVariant = "android_vendor.29_arm64_armv8-a_rlib_rlib-std"
|
||||||
|
)
|
||||||
|
|
||||||
|
func testRustVndkFs(t *testing.T, bp string, fs android.MockFS) *android.TestContext {
|
||||||
|
return testRustVndkFsVersions(t, bp, fs, "current", "current", "29")
|
||||||
|
}
|
||||||
|
|
||||||
|
func testRustVndkFsVersions(t *testing.T, bp string, fs android.MockFS, device_version, product_version, vndk_version string) *android.TestContext {
|
||||||
skipTestIfOsNotSupported(t)
|
skipTestIfOsNotSupported(t)
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForRustTest,
|
prepareForRustTest,
|
||||||
rustMockedFiles.AddToFixture(),
|
fs.AddToFixture(),
|
||||||
android.FixtureModifyProductVariables(
|
android.FixtureModifyProductVariables(
|
||||||
func(variables android.FixtureProductVariables) {
|
func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr("current")
|
variables.DeviceVndkVersion = StringPtr(device_version)
|
||||||
variables.ProductVndkVersion = StringPtr("current")
|
variables.ProductVndkVersion = StringPtr(product_version)
|
||||||
variables.Platform_vndk_version = StringPtr("29")
|
variables.Platform_vndk_version = StringPtr(vndk_version)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
).RunTestWithBp(t, bp)
|
).RunTestWithBp(t, bp)
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// testRustCov returns a TestContext in which a basic environment has been
|
// testRustCov returns a TestContext in which a basic environment has been
|
||||||
@@ -115,10 +137,14 @@ func testRustError(t *testing.T, pattern string, bp string) {
|
|||||||
|
|
||||||
// testRustVndkError is similar to testRustError, but can be used to test VNDK-related errors.
|
// testRustVndkError is similar to testRustError, but can be used to test VNDK-related errors.
|
||||||
func testRustVndkError(t *testing.T, pattern string, bp string) {
|
func testRustVndkError(t *testing.T, pattern string, bp string) {
|
||||||
|
testRustVndkFsError(t, pattern, bp, rustMockedFiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testRustVndkFsError(t *testing.T, pattern string, bp string, fs android.MockFS) {
|
||||||
skipTestIfOsNotSupported(t)
|
skipTestIfOsNotSupported(t)
|
||||||
android.GroupFixturePreparers(
|
android.GroupFixturePreparers(
|
||||||
prepareForRustTest,
|
prepareForRustTest,
|
||||||
rustMockedFiles.AddToFixture(),
|
fs.AddToFixture(),
|
||||||
android.FixtureModifyProductVariables(
|
android.FixtureModifyProductVariables(
|
||||||
func(variables android.FixtureProductVariables) {
|
func(variables android.FixtureProductVariables) {
|
||||||
variables.DeviceVndkVersion = StringPtr("current")
|
variables.DeviceVndkVersion = StringPtr("current")
|
||||||
|
121
rust/snapshot_prebuilt.go
Normal file
121
rust/snapshot_prebuilt.go
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// Copyright 2021 The Android Open Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package rust
|
||||||
|
|
||||||
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
"android/soong/cc"
|
||||||
|
"github.com/google/blueprint/proptools"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
snapshotRlibSuffix = "_rlib."
|
||||||
|
)
|
||||||
|
|
||||||
|
type snapshotLibraryDecorator struct {
|
||||||
|
cc.BaseSnapshotDecorator
|
||||||
|
*libraryDecorator
|
||||||
|
properties cc.SnapshotLibraryProperties
|
||||||
|
sanitizerProperties struct {
|
||||||
|
CfiEnabled bool `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// Library flags for cfi variant.
|
||||||
|
Cfi cc.SnapshotLibraryProperties `android:"arch_variant"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
registerRustSnapshotModules(android.InitRegistrationContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
func registerRustSnapshotModules(ctx android.RegistrationContext) {
|
||||||
|
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
|
||||||
|
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
|
||||||
|
}
|
||||||
|
|
||||||
|
func snapshotLibraryFactory(image cc.SnapshotImage, moduleSuffix string) (*Module, *snapshotLibraryDecorator) {
|
||||||
|
module, library := NewRustLibrary(android.DeviceSupported)
|
||||||
|
|
||||||
|
module.sanitize = nil
|
||||||
|
library.stripper.StripProperties.Strip.None = proptools.BoolPtr(true)
|
||||||
|
|
||||||
|
prebuilt := &snapshotLibraryDecorator{
|
||||||
|
libraryDecorator: library,
|
||||||
|
}
|
||||||
|
|
||||||
|
module.compiler = prebuilt
|
||||||
|
|
||||||
|
prebuilt.Init(module, image, moduleSuffix)
|
||||||
|
module.AddProperties(
|
||||||
|
&prebuilt.properties,
|
||||||
|
&prebuilt.sanitizerProperties,
|
||||||
|
)
|
||||||
|
|
||||||
|
return module, prebuilt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (library *snapshotLibraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path {
|
||||||
|
var variant string
|
||||||
|
if library.static() {
|
||||||
|
variant = cc.SnapshotStaticSuffix
|
||||||
|
} else if library.shared() {
|
||||||
|
variant = cc.SnapshotSharedSuffix
|
||||||
|
} else if library.rlib() {
|
||||||
|
variant = cc.SnapshotRlibSuffix
|
||||||
|
}
|
||||||
|
|
||||||
|
if !library.dylib() {
|
||||||
|
// TODO(184042776): Remove this check when dylibs are supported in snapshots.
|
||||||
|
library.SetSnapshotAndroidMkSuffix(ctx, variant)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !library.MatchesWithDevice(ctx.DeviceConfig()) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return android.PathForModuleSrc(ctx, *library.properties.Src)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (library *snapshotLibraryDecorator) rustdoc(ctx ModuleContext, flags Flags, deps PathDeps) android.OptionalPath {
|
||||||
|
return android.OptionalPath{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vendor_snapshot_rlib is a special prebuilt rlib library which is auto-generated by
|
||||||
|
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_rlib
|
||||||
|
// overrides the vendor variant of the rust rlib library with the same name, if BOARD_VNDK_VERSION
|
||||||
|
// is set.
|
||||||
|
func VendorSnapshotRlibFactory() android.Module {
|
||||||
|
module, prebuilt := snapshotLibraryFactory(cc.VendorSnapshotImageSingleton, cc.SnapshotRlibSuffix)
|
||||||
|
prebuilt.libraryDecorator.BuildOnlyRlib()
|
||||||
|
prebuilt.libraryDecorator.setNoStdlibs()
|
||||||
|
return module.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (library *snapshotLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
|
||||||
|
arches := config.Arches()
|
||||||
|
if len(arches) == 0 || arches[0].ArchType.String() != library.Arch() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if library.properties.Src == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (library *snapshotLibraryDecorator) IsSnapshotPrebuilt() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ cc.SnapshotInterface = (*snapshotLibraryDecorator)(nil)
|
@@ -18,18 +18,33 @@ import (
|
|||||||
"android/soong/android"
|
"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 {
|
func (mod *Module) ExcludeFromVendorSnapshot() bool {
|
||||||
// TODO Rust does not yet support snapshotting
|
return Bool(mod.Properties.Exclude_from_vendor_snapshot)
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) ExcludeFromRecoverySnapshot() bool {
|
func (mod *Module) ExcludeFromRecoverySnapshot() bool {
|
||||||
// TODO Rust does not yet support snapshotting
|
return Bool(mod.Properties.Exclude_from_recovery_snapshot)
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) IsSnapshotLibrary() bool {
|
func (mod *Module) IsSnapshotLibrary() bool {
|
||||||
// TODO Rust does not yet support snapshotting
|
if lib, ok := mod.compiler.(libraryInterface); ok {
|
||||||
|
// Rust-native dylibs are not snapshot supported yet. Only snapshot the rlib-std variants of rlibs.
|
||||||
|
return lib.shared() || lib.static() || (lib.rlib() && lib.rlibStd())
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,8 +54,7 @@ func (mod *Module) SnapshotRuntimeLibs() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) SnapshotSharedLibs() []string {
|
func (mod *Module) SnapshotSharedLibs() []string {
|
||||||
// TODO Rust does not yet support snapshotting
|
return mod.Properties.SnapshotSharedLibs
|
||||||
return []string{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) Symlinks() []string {
|
func (mod *Module) Symlinks() []string {
|
||||||
@@ -49,6 +63,8 @@ func (mod *Module) Symlinks() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Module) SnapshotHeaders() android.Paths {
|
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{}
|
return android.Paths{}
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,11 @@ var PrepareForIntegrationTestWithRust = android.GroupFixturePreparers(
|
|||||||
PrepareForTestWithRustDefaultModules,
|
PrepareForTestWithRustDefaultModules,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var PrepareForTestWithRustIncludeVndk = android.GroupFixturePreparers(
|
||||||
|
PrepareForIntegrationTestWithRust,
|
||||||
|
cc.PrepareForTestWithCcIncludeVndk,
|
||||||
|
)
|
||||||
|
|
||||||
func GatherRequiredDepsForTest() string {
|
func GatherRequiredDepsForTest() string {
|
||||||
bp := `
|
bp := `
|
||||||
rust_prebuilt_library {
|
rust_prebuilt_library {
|
||||||
@@ -130,6 +135,9 @@ func GatherRequiredDepsForTest() string {
|
|||||||
apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
|
apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
|
||||||
min_sdk_version: "29",
|
min_sdk_version: "29",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
llndk: {
|
||||||
|
symbol_file: "liblog.map.txt",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libprotobuf-cpp-full",
|
name: "libprotobuf-cpp-full",
|
||||||
@@ -240,4 +248,5 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
|||||||
ctx.BottomUp("rust_begin", BeginMutator).Parallel()
|
ctx.BottomUp("rust_begin", BeginMutator).Parallel()
|
||||||
})
|
})
|
||||||
ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton)
|
ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton)
|
||||||
|
registerRustSnapshotModules(ctx)
|
||||||
}
|
}
|
||||||
|
1015
rust/vendor_snapshot_test.go
Normal file
1015
rust/vendor_snapshot_test.go
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user