Remove Device VNDK version usage from Soong

As of VNDK deprecation, Device VNDK version should no longer be used
from build. This change removes all references on Device VNDK version
and related logic with it.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: Ibc290f0b41e8321f80c75c69f810223989af68dc
This commit is contained in:
Kiyoung Kim 2024-04-04 17:33:42 +09:00
parent 37693d0a27
commit 4e765b1bfc
10 changed files with 21 additions and 103 deletions

View file

@ -1436,10 +1436,6 @@ func (c *deviceConfig) VendorPath() string {
return "vendor" return "vendor"
} }
func (c *deviceConfig) VndkVersion() string {
return String(c.config.productVariables.DeviceVndkVersion)
}
func (c *deviceConfig) RecoverySnapshotVersion() string { func (c *deviceConfig) RecoverySnapshotVersion() string {
return String(c.config.productVariables.RecoverySnapshotVersion) return String(c.config.productVariables.RecoverySnapshotVersion)
} }

View file

@ -737,33 +737,25 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
// suffix indicates the vndk version for vendor/product if vndk is enabled. // suffix indicates the vndk version for vendor/product if vndk is enabled.
// getImageVariation can simply join the result of this function to get the // getImageVariation can simply join the result of this function to get the
// image variation name. // image variation name.
func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (string, string) { func (a *apexBundle) getImageVariationPair() (string, string) {
if a.vndkApex { if a.vndkApex {
return cc.VendorVariationPrefix, a.vndkVersion() return cc.VendorVariationPrefix, a.vndkVersion()
} }
prefix := android.CoreVariation prefix := android.CoreVariation
vndkVersion := "" if a.SocSpecific() || a.DeviceSpecific() {
if deviceConfig.VndkVersion() != "" { prefix = cc.VendorVariation
if a.SocSpecific() || a.DeviceSpecific() { } else if a.ProductSpecific() {
prefix = cc.VendorVariationPrefix prefix = cc.ProductVariation
vndkVersion = deviceConfig.VndkVersion()
}
} else {
if a.SocSpecific() || a.DeviceSpecific() {
prefix = cc.VendorVariation
} else if a.ProductSpecific() {
prefix = cc.ProductVariation
}
} }
return prefix, vndkVersion return prefix, ""
} }
// getImageVariation returns the image variant name for this apexBundle. In most cases, it's simply // getImageVariation returns the image variant name for this apexBundle. In most cases, it's simply
// android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX. // android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX.
func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string { func (a *apexBundle) getImageVariation() string {
prefix, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig()) prefix, vndkVersion := a.getImageVariationPair()
return prefix + vndkVersion return prefix + vndkVersion
} }
@ -773,7 +765,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
// each target os/architectures, appropriate dependencies are selected by their // each target os/architectures, appropriate dependencies are selected by their
// target.<os>.multilib.<type> groups and are added as (direct) dependencies. // target.<os>.multilib.<type> groups and are added as (direct) dependencies.
targets := ctx.MultiTargets() targets := ctx.MultiTargets()
imageVariation := a.getImageVariation(ctx) imageVariation := a.getImageVariation()
a.combineProperties(ctx) a.combineProperties(ctx)
@ -1534,7 +1526,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext
// TODO(jiyong): move this info (the sanitizer name, the lib name, etc.) to cc/sanitize.go // TODO(jiyong): move this info (the sanitizer name, the lib name, etc.) to cc/sanitize.go
// Keep only the mechanism here. // Keep only the mechanism here.
if sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") { if sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") {
imageVariation := a.getImageVariation(ctx) imageVariation := a.getImageVariation()
for _, target := range ctx.MultiTargets() { for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" { if target.Arch.ArchType.Multilib == "lib64" {
addDependenciesForNativeModules(ctx, ApexNativeDependencies{ addDependenciesForNativeModules(ctx, ApexNativeDependencies{

View file

@ -293,7 +293,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
} }
if android.InList(":vndk", requireNativeLibs) { if android.InList(":vndk", requireNativeLibs) {
if _, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig()); vndkVersion != "" { if _, vndkVersion := a.getImageVariationPair(); vndkVersion != "" {
optCommands = append(optCommands, "-v vndkVersion "+vndkVersion) optCommands = append(optCommands, "-v vndkVersion "+vndkVersion)
} }
} }

View file

@ -1854,7 +1854,6 @@ func (c *Module) DataPaths() []android.DataPath {
func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface) string { func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface) string {
// Returns the name suffix for product and vendor variants. If the VNDK version is not // Returns the name suffix for product and vendor variants. If the VNDK version is not
// "current", it will append the VNDK version to the name suffix. // "current", it will append the VNDK version to the name suffix.
var vndkVersion string
var nameSuffix string var nameSuffix string
if c.InProduct() { if c.InProduct() {
if c.ProductSpecific() { if c.ProductSpecific() {
@ -1864,10 +1863,9 @@ func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface
} }
return ProductSuffix return ProductSuffix
} else { } else {
vndkVersion = ctx.DeviceConfig().VndkVersion()
nameSuffix = VendorSuffix nameSuffix = VendorSuffix
} }
if c.VndkVersion() != vndkVersion && c.VndkVersion() != "" { if c.VndkVersion() != "" {
// add version suffix only if the module is using different vndk version than the // add version suffix only if the module is using different vndk version than the
// version in product or vendor partition. // version in product or vendor partition.
nameSuffix += "." + c.VndkVersion() nameSuffix += "." + c.VndkVersion()

View file

@ -101,21 +101,14 @@ func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleCon
func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string { func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
var variants []string var variants []string
vndkVersion := ctx.DeviceConfig().VndkVersion()
vendorVariantRequired := Bool(g.Vendor_available) || Bool(g.Odm_available) || ctx.SocSpecific() || ctx.DeviceSpecific() vendorVariantRequired := Bool(g.Vendor_available) || Bool(g.Odm_available) || ctx.SocSpecific() || ctx.DeviceSpecific()
productVariantRequired := Bool(g.Product_available) || ctx.ProductSpecific() productVariantRequired := Bool(g.Product_available) || ctx.ProductSpecific()
if vndkVersion == "" { if vendorVariantRequired {
if vendorVariantRequired { variants = append(variants, VendorVariation)
variants = append(variants, VendorVariation) }
} if productVariantRequired {
if productVariantRequired { variants = append(variants, ProductVariation)
variants = append(variants, ProductVariation)
}
} else {
if vendorVariantRequired {
variants = append(variants, VendorVariationPrefix+vndkVersion)
}
} }
return variants return variants

View file

@ -428,17 +428,8 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
var vendorVariants []string var vendorVariants []string
var productVariants []string var productVariants []string
boardVndkVersion := mctx.DeviceConfig().VndkVersion()
needVndkVersionVendorVariantForLlndk := false needVndkVersionVendorVariantForLlndk := false
if boardVndkVersion != "" {
boardVndkApiLevel, err := android.ApiLevelFromUser(mctx, boardVndkVersion)
if err == nil && !boardVndkApiLevel.IsPreview() {
// VNDK snapshot newer than v30 has LLNDK stub libraries.
// Only the VNDK version less than or equal to v30 requires generating the vendor
// variant of the VNDK version from the source tree.
needVndkVersionVendorVariantForLlndk = boardVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, "30"))
}
}
if m.NeedsLlndkVariants() { if m.NeedsLlndkVariants() {
// This is an LLNDK library. The implementation of the library will be on /system, // This is an LLNDK library. The implementation of the library will be on /system,
// and vendor and product variants will be created with LLNDK stubs. // and vendor and product variants will be created with LLNDK stubs.
@ -449,13 +440,13 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
// Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not // Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not
// provide the LLNDK stub libraries. // provide the LLNDK stub libraries.
if needVndkVersionVendorVariantForLlndk { if needVndkVersionVendorVariantForLlndk {
vendorVariants = append(vendorVariants, boardVndkVersion) vendorVariants = append(vendorVariants, "")
} }
} else if m.NeedsVendorPublicLibraryVariants() { } else if m.NeedsVendorPublicLibraryVariants() {
// A vendor public library has the implementation on /vendor, with stub variants // A vendor public library has the implementation on /vendor, with stub variants
// for system and product. // for system and product.
coreVariantNeeded = true coreVariantNeeded = true
vendorVariants = append(vendorVariants, boardVndkVersion) vendorVariants = append(vendorVariants, "")
productVariants = append(productVariants, "") productVariants = append(productVariants, "")
} else if m.IsSnapshotPrebuilt() { } else if m.IsSnapshotPrebuilt() {
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and // Make vendor variants only for the versions in BOARD_VNDK_VERSION and
@ -483,21 +474,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
} }
} else if vendorSpecific && m.SdkVersion() == "" { } else if vendorSpecific && m.SdkVersion() == "" {
// This will be available in /vendor (or /odm) only // This will be available in /vendor (or /odm) only
vendorVariants = append(vendorVariants, "")
// kernel_headers is a special module type whose exported headers
// are coming from DeviceKernelHeaders() which is always vendor
// dependent. They'll always have both vendor variants.
// For other modules, we assume that modules under proprietary
// paths are compatible for BOARD_VNDK_VERSION. The other modules
// are regarded as AOSP, which is PLATFORM_VNDK_VERSION.
if m.KernelHeadersDecorator() {
vendorVariants = append(vendorVariants,
"",
boardVndkVersion,
)
} else {
vendorVariants = append(vendorVariants, "")
}
} else { } else {
// This is either in /system (or similar: /data), or is a // This is either in /system (or similar: /data), or is a
// module built with the NDK. Modules built with the NDK // module built with the NDK. Modules built with the NDK
@ -669,14 +646,6 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix) m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
} }
squashVendorSrcs(m) squashVendorSrcs(m)
// Makefile shouldn't know vendor modules other than BOARD_VNDK_VERSION.
// Hide other vendor variants to avoid collision.
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion != "current" && vndkVersion != "" && vndkVersion != m.Properties.VndkVersion {
m.Properties.HideFromMake = true
m.HideFromMake()
}
} else if strings.HasPrefix(variant, ProductVariation) { } else if strings.HasPrefix(variant, ProductVariation) {
m.Properties.ImageVariation = ProductVariation m.Properties.ImageVariation = ProductVariation
if strings.HasPrefix(variant, ProductVariationPrefix) { if strings.HasPrefix(variant, ProductVariationPrefix) {

View file

@ -17,7 +17,6 @@ package cc
import ( import (
"fmt" "fmt"
"io" "io"
"log"
"path/filepath" "path/filepath"
"regexp" "regexp"
"strconv" "strconv"
@ -753,20 +752,6 @@ func (library *libraryDecorator) getLibNameHelper(baseModuleName string, inVendo
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string { func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
name := library.getLibNameHelper(ctx.baseModuleName(), ctx.inVendor(), ctx.inProduct()) name := library.getLibNameHelper(ctx.baseModuleName(), ctx.inVendor(), ctx.inProduct())
// Replace name with VNDK ext as original lib only when VNDK is enabled
if ctx.IsVndkExt() {
if ctx.DeviceConfig().VndkVersion() != "" {
// vndk-ext lib should have the same name with original lib
ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
originalName := module.(*Module).outputFile.Path()
name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
})
} else {
// TODO(b/320208784) : Suggest a solution for former VNDK-ext libraries before VNDK deprecation.
log.Printf("VNDK Extension on module %s will not be available once VNDK is deprecated", ctx.baseModuleName())
}
}
if ctx.Host() && Bool(library.Properties.Unique_host_soname) { if ctx.Host() && Bool(library.Properties.Unique_host_soname) {
if !strings.HasSuffix(name, "-host") { if !strings.HasSuffix(name, "-host") {
name = name + "-host" name = name + "-host"

View file

@ -97,8 +97,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "") ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
ctx.Strict("GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideExternalGlobalCflags}") ctx.Strict("GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideExternalGlobalCflags}")
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
// Filter vendor_public_library that are exported to make // Filter vendor_public_library that are exported to make
exportedVendorPublicLibraries := []string{} exportedVendorPublicLibraries := []string{}
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {

View file

@ -159,11 +159,6 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
p.androidMkSuffix = p.NameSuffix() p.androidMkSuffix = p.NameSuffix()
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion == p.Version() {
p.androidMkSuffix = ""
}
android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{ android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{
SharedLibrary: in, SharedLibrary: in,
Target: ctx.Target(), Target: ctx.Target(),

View file

@ -208,14 +208,6 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
if strings.HasPrefix(variant, cc.VendorVariationPrefix) { if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix) m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
} }
// Makefile shouldn't know vendor modules other than BOARD_VNDK_VERSION.
// Hide other vendor variants to avoid collision.
vndkVersion := ctx.DeviceConfig().VndkVersion()
if vndkVersion != "current" && vndkVersion != "" && vndkVersion != m.Properties.VndkVersion {
m.Properties.HideFromMake = true
m.HideFromMake()
}
} else if strings.HasPrefix(variant, cc.ProductVariation) { } else if strings.HasPrefix(variant, cc.ProductVariation) {
m.Properties.ImageVariation = cc.ProductVariation m.Properties.ImageVariation = cc.ProductVariation
if strings.HasPrefix(variant, cc.ProductVariationPrefix) { if strings.HasPrefix(variant, cc.ProductVariationPrefix) {