Export cc functions for snapshotting Rust rlibs.

Export additional fuctions, structs, and interfaces from cc for use in
the rust package to allow for rlib snapshotting.

Bug: 184042776
Test: m nothing
Change-Id: I4c53b9378d5d5b5973dbd23ab692cdfb2ede60b9
This commit is contained in:
Ivan Lozano
2021-05-26 15:33:11 -04:00
parent 1921e8003d
commit d1dec54988
7 changed files with 89 additions and 89 deletions

View File

@@ -1267,8 +1267,8 @@ func (c *Module) nativeCoverage() bool {
}
func (c *Module) IsSnapshotPrebuilt() bool {
if p, ok := c.linker.(snapshotInterface); ok {
return p.isSnapshotPrebuilt()
if p, ok := c.linker.(SnapshotInterface); ok {
return p.IsSnapshotPrebuilt()
}
return false
}
@@ -2946,10 +2946,10 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
if ccDepModule != nil {
// TODO(ivanlozano) Support snapshots for Rust-produced C library variants.
// 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()
return baseName + snapshotPrebuilt.snapshotAndroidMkSuffix()
return baseName + snapshotPrebuilt.SnapshotAndroidMkSuffix()
}
}

View File

@@ -365,8 +365,8 @@ func (m *Module) SetCoreVariantNeeded(b bool) {
}
func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
if snapshot, ok := m.linker.(snapshotInterface); ok {
return snapshot.version()
if snapshot, ok := m.linker.(SnapshotInterface); ok {
return snapshot.Version()
} else {
mctx.ModuleErrorf("version is unknown for snapshot prebuilt")
// Should we be panicking here instead?

View File

@@ -28,7 +28,7 @@ import (
// Defines the specifics of different images to which the snapshot process is applicable, e.g.,
// vendor, recovery, ramdisk.
type snapshotImage interface {
type SnapshotImage interface {
// Returns true if a snapshot should be generated for this image.
shouldGenerateSnapshot(ctx android.SingletonContext) bool
@@ -264,8 +264,8 @@ func init() {
const (
snapshotHeaderSuffix = "_header."
snapshotSharedSuffix = "_shared."
snapshotStaticSuffix = "_static."
SnapshotSharedSuffix = "_shared."
SnapshotStaticSuffix = "_static."
snapshotBinarySuffix = "_binary."
snapshotObjectSuffix = "_object."
)
@@ -284,14 +284,14 @@ type snapshot struct {
properties SnapshotProperties
baseSnapshot baseSnapshotDecorator
baseSnapshot BaseSnapshotDecorator
image snapshotImage
image SnapshotImage
}
func (s *snapshot) ImageMutatorBegin(ctx android.BaseModuleContext) {
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()
}
}
@@ -341,7 +341,7 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
for _, name := range names {
snapshotMap[name] = name +
getSnapshotNameSuffix(snapshotSuffix+moduleSuffix,
s.baseSnapshot.version(),
s.baseSnapshot.Version(),
ctx.DeviceConfig().Arches()[0].ArchType.String())
}
return snapshotMap
@@ -351,8 +351,8 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
headers := collectSnapshotMap(s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
binaries := collectSnapshotMap(s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
objects := collectSnapshotMap(s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, SnapshotStaticSuffix)
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, SnapshotSharedSuffix)
vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
for k, v := range vndkLibs {
sharedLibs[k] = v
@@ -383,7 +383,7 @@ func recoverySnapshotFactory() android.Module {
return snapshotFactory(recoverySnapshotImageSingleton)
}
func snapshotFactory(image snapshotImage) android.Module {
func snapshotFactory(image SnapshotImage) android.Module {
snapshot := &snapshot{}
snapshot.image = image
snapshot.AddProperties(
@@ -393,7 +393,7 @@ func snapshotFactory(image snapshotImage) android.Module {
return snapshot
}
type baseSnapshotDecoratorProperties struct {
type BaseSnapshotDecoratorProperties struct {
// snapshot version.
Version string
@@ -408,7 +408,7 @@ type baseSnapshotDecoratorProperties struct {
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
// collide with source modules. e.g. the following example module,
//
@@ -420,40 +420,40 @@ type baseSnapshotDecoratorProperties struct {
// }
//
// will be seen as "libbase.vendor_static.30.arm64" by Soong.
type baseSnapshotDecorator struct {
baseProperties baseSnapshotDecoratorProperties
image snapshotImage
type BaseSnapshotDecorator struct {
baseProperties BaseSnapshotDecoratorProperties
image SnapshotImage
}
func (p *baseSnapshotDecorator) Name(name string) string {
func (p *BaseSnapshotDecorator) Name(name string) string {
return name + p.NameSuffix()
}
func (p *baseSnapshotDecorator) NameSuffix() string {
return getSnapshotNameSuffix(p.moduleSuffix(), p.version(), p.arch())
func (p *BaseSnapshotDecorator) NameSuffix() string {
return getSnapshotNameSuffix(p.moduleSuffix(), p.Version(), p.Arch())
}
func (p *baseSnapshotDecorator) version() string {
func (p *BaseSnapshotDecorator) Version() string {
return p.baseProperties.Version
}
func (p *baseSnapshotDecorator) arch() string {
func (p *BaseSnapshotDecorator) Arch() string {
return p.baseProperties.Target_arch
}
func (p *baseSnapshotDecorator) moduleSuffix() string {
func (p *BaseSnapshotDecorator) moduleSuffix() string {
return p.baseProperties.ModuleSuffix
}
func (p *baseSnapshotDecorator) isSnapshotPrebuilt() bool {
func (p *BaseSnapshotDecorator) IsSnapshotPrebuilt() bool {
return true
}
func (p *baseSnapshotDecorator) snapshotAndroidMkSuffix() string {
func (p *BaseSnapshotDecorator) SnapshotAndroidMkSuffix() string {
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}
// we have to add the androidmk suffix to avoid duplicate modules with the same
// name.
@@ -461,7 +461,7 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
Mutator: "image",
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()
return
}
@@ -470,12 +470,12 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
Mutator: "image",
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()
return
}
images := []snapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
images := []SnapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
for _, image := range images {
if p.image == image {
@@ -486,10 +486,10 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
Variation: image.imageVariantName(ctx.DeviceConfig())})
if ctx.OtherModuleFarDependencyVariantExists(variations,
ctx.Module().(*Module).BaseModuleName()+
ctx.Module().(LinkableInterface).BaseModuleName()+
getSnapshotNameSuffix(
image.moduleNameSuffix()+variant,
p.version(),
p.Version(),
ctx.DeviceConfig().Arches()[0].ArchType.String())) {
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
return
@@ -501,7 +501,7 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
// Call this with a module suffix after creating a snapshot module, such as
// 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.baseProperties.ModuleSuffix = image.moduleNameSuffix() + moduleSuffix
m.AddProperties(&p.baseProperties)
@@ -512,8 +512,8 @@ func (p *baseSnapshotDecorator) init(m *Module, image snapshotImage, moduleSuffi
// 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.
func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *baseSnapshotDecorator) {
if p.version() != ctx.DeviceConfig().VndkVersion() {
func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *BaseSnapshotDecorator) {
if p.Version() != ctx.DeviceConfig().VndkVersion() {
ctx.Module().Disable()
return
}
@@ -528,7 +528,7 @@ func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *baseSnapshotDecorato
// include directories, c flags, sanitize dependency information, etc.
//
// These modules are auto-generated by development/vendor_snapshot/update.py.
type snapshotLibraryProperties struct {
type SnapshotLibraryProperties struct {
// Prebuilt file for each arch.
Src *string `android:"arch_variant"`
@@ -554,14 +554,14 @@ type snapshotSanitizer interface {
}
type snapshotLibraryDecorator struct {
baseSnapshotDecorator
BaseSnapshotDecorator
*libraryDecorator
properties snapshotLibraryProperties
properties SnapshotLibraryProperties
sanitizerProperties struct {
CfiEnabled bool `blueprint:"mutated"`
// Library flags for cfi variant.
Cfi snapshotLibraryProperties `android:"arch_variant"`
Cfi SnapshotLibraryProperties `android:"arch_variant"`
}
}
@@ -570,9 +570,9 @@ func (p *snapshotLibraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) F
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()
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
if len(arches) == 0 || arches[0].ArchType.String() != p.Arch() {
return false
}
if !p.header() && p.properties.Src == nil {
@@ -587,14 +587,14 @@ func (p *snapshotLibraryDecorator) matchesWithDevice(config android.DeviceConfig
func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
var variant string
if p.shared() {
variant = snapshotSharedSuffix
variant = SnapshotSharedSuffix
} else if p.static() {
variant = snapshotStaticSuffix
variant = SnapshotStaticSuffix
} else {
variant = snapshotHeaderSuffix
}
p.setSnapshotAndroidMkSuffix(ctx, variant)
p.SetSnapshotAndroidMkSuffix(ctx, variant)
if p.header() {
return p.libraryDecorator.link(ctx, flags, deps, objs)
@@ -604,7 +604,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
p.properties = p.sanitizerProperties.Cfi
}
if !p.matchesWithDevice(ctx.DeviceConfig()) {
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
return nil
}
@@ -657,7 +657,7 @@ func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps Pat
}
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)
}
}
@@ -687,7 +687,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.stl = nil
@@ -710,7 +710,7 @@ func snapshotLibraryFactory(image snapshotImage, moduleSuffix string) (*Module,
module.linker = prebuilt
module.installer = prebuilt
prebuilt.init(module, image, moduleSuffix)
prebuilt.Init(module, image, moduleSuffix)
module.AddProperties(
&prebuilt.properties,
&prebuilt.sanitizerProperties,
@@ -724,7 +724,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
// is set.
func VendorSnapshotSharedFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotSharedSuffix)
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, SnapshotSharedSuffix)
prebuilt.libraryDecorator.BuildOnlyShared()
return module.Init()
}
@@ -734,7 +734,7 @@ func VendorSnapshotSharedFactory() android.Module {
// overrides the recovery variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
// is set.
func RecoverySnapshotSharedFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, snapshotSharedSuffix)
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotSharedSuffix)
prebuilt.libraryDecorator.BuildOnlyShared()
return module.Init()
}
@@ -744,7 +744,7 @@ func RecoverySnapshotSharedFactory() android.Module {
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
// is set.
func VendorSnapshotStaticFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotStaticSuffix)
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, SnapshotStaticSuffix)
prebuilt.libraryDecorator.BuildOnlyStatic()
return module.Init()
}
@@ -754,7 +754,7 @@ func VendorSnapshotStaticFactory() android.Module {
// overrides the recovery variant of the cc static library with the same name, if BOARD_VNDK_VERSION
// is set.
func RecoverySnapshotStaticFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, snapshotStaticSuffix)
module, prebuilt := snapshotLibraryFactory(recoverySnapshotImageSingleton, SnapshotStaticSuffix)
prebuilt.libraryDecorator.BuildOnlyStatic()
return module.Init()
}
@@ -794,13 +794,13 @@ type snapshotBinaryProperties struct {
}
type snapshotBinaryDecorator struct {
baseSnapshotDecorator
BaseSnapshotDecorator
*binaryDecorator
properties snapshotBinaryProperties
}
func (p *snapshotBinaryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
if config.DeviceArch() != p.arch() {
func (p *snapshotBinaryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
if config.DeviceArch() != p.Arch() {
return false
}
if p.properties.Src == nil {
@@ -812,9 +812,9 @@ func (p *snapshotBinaryDecorator) matchesWithDevice(config android.DeviceConfig)
// cc modules' link functions are to link compiled objects into final binaries.
// As snapshots are prebuilts, this just returns the prebuilt binary
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
}
@@ -852,7 +852,7 @@ func RecoverySnapshotBinaryFactory() android.Module {
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)
binary.baseLinker.Properties.No_libcrt = BoolPtr(true)
binary.baseLinker.Properties.Nocrt = BoolPtr(true)
@@ -871,7 +871,7 @@ func snapshotBinaryFactory(image snapshotImage, moduleSuffix string) android.Mod
module.stl = nil
module.linker = prebuilt
prebuilt.init(module, image, moduleSuffix)
prebuilt.Init(module, image, moduleSuffix)
module.AddProperties(&prebuilt.properties)
return module.Init()
}
@@ -889,13 +889,13 @@ type vendorSnapshotObjectProperties struct {
}
type snapshotObjectLinker struct {
baseSnapshotDecorator
BaseSnapshotDecorator
objectLinker
properties vendorSnapshotObjectProperties
}
func (p *snapshotObjectLinker) matchesWithDevice(config android.DeviceConfig) bool {
if config.DeviceArch() != p.arch() {
func (p *snapshotObjectLinker) MatchesWithDevice(config android.DeviceConfig) bool {
if config.DeviceArch() != p.Arch() {
return false
}
if p.properties.Src == nil {
@@ -907,9 +907,9 @@ func (p *snapshotObjectLinker) matchesWithDevice(config android.DeviceConfig) bo
// cc modules' link functions are to link compiled objects into final binaries.
// As snapshots are prebuilts, this just returns the prebuilt binary
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
}
@@ -933,7 +933,7 @@ func VendorSnapshotObjectFactory() android.Module {
}
module.linker = prebuilt
prebuilt.init(module, VendorSnapshotImageSingleton, snapshotObjectSuffix)
prebuilt.Init(module, VendorSnapshotImageSingleton, snapshotObjectSuffix)
module.AddProperties(&prebuilt.properties)
return module.Init()
}
@@ -951,19 +951,19 @@ func RecoverySnapshotObjectFactory() android.Module {
}
module.linker = prebuilt
prebuilt.init(module, recoverySnapshotImageSingleton, snapshotObjectSuffix)
prebuilt.Init(module, recoverySnapshotImageSingleton, snapshotObjectSuffix)
module.AddProperties(&prebuilt.properties)
return module.Init()
}
type snapshotInterface interface {
matchesWithDevice(config android.DeviceConfig) bool
isSnapshotPrebuilt() bool
version() string
snapshotAndroidMkSuffix() string
type SnapshotInterface interface {
MatchesWithDevice(config android.DeviceConfig) bool
IsSnapshotPrebuilt() bool
Version() string
SnapshotAndroidMkSuffix() string
}
var _ snapshotInterface = (*vndkPrebuiltLibraryDecorator)(nil)
var _ snapshotInterface = (*snapshotLibraryDecorator)(nil)
var _ snapshotInterface = (*snapshotBinaryDecorator)(nil)
var _ snapshotInterface = (*snapshotObjectLinker)(nil)
var _ SnapshotInterface = (*vndkPrebuiltLibraryDecorator)(nil)
var _ SnapshotInterface = (*snapshotLibraryDecorator)(nil)
var _ SnapshotInterface = (*snapshotBinaryDecorator)(nil)
var _ SnapshotInterface = (*snapshotObjectLinker)(nil)

View File

@@ -109,7 +109,7 @@ func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterf
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) {
return true
}

View File

@@ -82,7 +82,7 @@ type snapshotSingleton struct {
// Implementation of the image interface specific to the image
// associated with this snapshot (e.g., specific to the vendor image,
// recovery image, etc.).
image snapshotImage
image SnapshotImage
// Whether this singleton is for fake snapshot or not.
// 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.
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() {
return false
}

View File

@@ -360,7 +360,7 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
// prebuilt vndk modules should match with device
// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
// 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
}

View File

@@ -82,7 +82,7 @@ func (p *vndkPrebuiltLibraryDecorator) Name(name string) string {
}
func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
suffix := p.version()
suffix := p.Version()
if p.arch() != "" {
suffix += "." + p.arch()
}
@@ -92,7 +92,7 @@ func (p *vndkPrebuiltLibraryDecorator) NameSuffix() string {
return vndkSuffix + suffix
}
func (p *vndkPrebuiltLibraryDecorator) version() string {
func (p *vndkPrebuiltLibraryDecorator) Version() string {
return String(p.properties.Version)
}
@@ -107,7 +107,7 @@ func (p *vndkPrebuiltLibraryDecorator) binderBit() string {
return "64"
}
func (p *vndkPrebuiltLibraryDecorator) snapshotAndroidMkSuffix() string {
func (p *vndkPrebuiltLibraryDecorator) SnapshotAndroidMkSuffix() string {
return ".vendor"
}
@@ -133,7 +133,7 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro
func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
if !p.matchesWithDevice(ctx.DeviceConfig()) {
if !p.MatchesWithDevice(ctx.DeviceConfig()) {
ctx.Module().HideFromMake()
return nil
}
@@ -163,7 +163,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
p.androidMkSuffix = p.NameSuffix()
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion == p.version() {
if vndkVersion == p.Version() {
p.androidMkSuffix = ""
}
@@ -184,7 +184,7 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
return nil
}
func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
func (p *vndkPrebuiltLibraryDecorator) MatchesWithDevice(config android.DeviceConfig) bool {
arches := config.Arches()
if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
return false
@@ -202,7 +202,7 @@ func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
return false
}
func (p *vndkPrebuiltLibraryDecorator) isSnapshotPrebuilt() bool {
func (p *vndkPrebuiltLibraryDecorator) IsSnapshotPrebuilt() bool {
return true
}