From 4e765b1bfc82703d9febf30b44d3f6cbcaa29523 Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Thu, 4 Apr 2024 17:33:42 +0900 Subject: [PATCH] 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 --- android/config.go | 4 ---- apex/apex.go | 28 ++++++++++------------------ apex/builder.go | 2 +- cc/cc.go | 4 +--- cc/genrule.go | 17 +++++------------ cc/image.go | 39 ++++----------------------------------- cc/library.go | 15 --------------- cc/makevars.go | 2 -- cc/vndk_prebuilt.go | 5 ----- rust/image.go | 8 -------- 10 files changed, 21 insertions(+), 103 deletions(-) diff --git a/android/config.go b/android/config.go index 651b6ea7a..c28e6f835 100644 --- a/android/config.go +++ b/android/config.go @@ -1436,10 +1436,6 @@ func (c *deviceConfig) VendorPath() string { return "vendor" } -func (c *deviceConfig) VndkVersion() string { - return String(c.config.productVariables.DeviceVndkVersion) -} - func (c *deviceConfig) RecoverySnapshotVersion() string { return String(c.config.productVariables.RecoverySnapshotVersion) } diff --git a/apex/apex.go b/apex/apex.go index d437efe3c..1b998effd 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -737,33 +737,25 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) { // suffix indicates the vndk version for vendor/product if vndk is enabled. // getImageVariation can simply join the result of this function to get the // image variation name. -func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (string, string) { +func (a *apexBundle) getImageVariationPair() (string, string) { if a.vndkApex { return cc.VendorVariationPrefix, a.vndkVersion() } prefix := android.CoreVariation - vndkVersion := "" - if deviceConfig.VndkVersion() != "" { - if a.SocSpecific() || a.DeviceSpecific() { - prefix = cc.VendorVariationPrefix - vndkVersion = deviceConfig.VndkVersion() - } - } else { - if a.SocSpecific() || a.DeviceSpecific() { - prefix = cc.VendorVariation - } else if a.ProductSpecific() { - prefix = cc.ProductVariation - } + 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 // android.CoreVariation, but gets complicated for the vendor APEXes and the VNDK APEX. -func (a *apexBundle) getImageVariation(ctx android.BottomUpMutatorContext) string { - prefix, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig()) +func (a *apexBundle) getImageVariation() string { + prefix, vndkVersion := a.getImageVariationPair() return prefix + vndkVersion } @@ -773,7 +765,7 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) { // each target os/architectures, appropriate dependencies are selected by their // target..multilib. groups and are added as (direct) dependencies. targets := ctx.MultiTargets() - imageVariation := a.getImageVariation(ctx) + imageVariation := a.getImageVariation() 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 // Keep only the mechanism here. if sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") { - imageVariation := a.getImageVariation(ctx) + imageVariation := a.getImageVariation() for _, target := range ctx.MultiTargets() { if target.Arch.ArchType.Multilib == "lib64" { addDependenciesForNativeModules(ctx, ApexNativeDependencies{ diff --git a/apex/builder.go b/apex/builder.go index 9bd4b61da..763ce4d20 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -293,7 +293,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs, } if android.InList(":vndk", requireNativeLibs) { - if _, vndkVersion := a.getImageVariationPair(ctx.DeviceConfig()); vndkVersion != "" { + if _, vndkVersion := a.getImageVariationPair(); vndkVersion != "" { optCommands = append(optCommands, "-v vndkVersion "+vndkVersion) } } diff --git a/cc/cc.go b/cc/cc.go index 2fa4b3b6e..b6f12ad02 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -1854,7 +1854,6 @@ func (c *Module) DataPaths() []android.DataPath { func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface) string { // 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. - var vndkVersion string var nameSuffix string if c.InProduct() { if c.ProductSpecific() { @@ -1864,10 +1863,9 @@ func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface } return ProductSuffix } else { - vndkVersion = ctx.DeviceConfig().VndkVersion() 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 // version in product or vendor partition. nameSuffix += "." + c.VndkVersion() diff --git a/cc/genrule.go b/cc/genrule.go index 559c1558d..431a01c98 100644 --- a/cc/genrule.go +++ b/cc/genrule.go @@ -101,21 +101,14 @@ func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleCon func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string { var variants []string - vndkVersion := ctx.DeviceConfig().VndkVersion() vendorVariantRequired := Bool(g.Vendor_available) || Bool(g.Odm_available) || ctx.SocSpecific() || ctx.DeviceSpecific() productVariantRequired := Bool(g.Product_available) || ctx.ProductSpecific() - if vndkVersion == "" { - if vendorVariantRequired { - variants = append(variants, VendorVariation) - } - if productVariantRequired { - variants = append(variants, ProductVariation) - } - } else { - if vendorVariantRequired { - variants = append(variants, VendorVariationPrefix+vndkVersion) - } + if vendorVariantRequired { + variants = append(variants, VendorVariation) + } + if productVariantRequired { + variants = append(variants, ProductVariation) } return variants diff --git a/cc/image.go b/cc/image.go index 76cb09fc8..f8c5ca5f1 100644 --- a/cc/image.go +++ b/cc/image.go @@ -428,17 +428,8 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) { var vendorVariants []string var productVariants []string - boardVndkVersion := mctx.DeviceConfig().VndkVersion() 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() { // 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. @@ -449,13 +440,13 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) { // Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not // provide the LLNDK stub libraries. if needVndkVersionVendorVariantForLlndk { - vendorVariants = append(vendorVariants, boardVndkVersion) + vendorVariants = append(vendorVariants, "") } } else if m.NeedsVendorPublicLibraryVariants() { // A vendor public library has the implementation on /vendor, with stub variants // for system and product. coreVariantNeeded = true - vendorVariants = append(vendorVariants, boardVndkVersion) + vendorVariants = append(vendorVariants, "") productVariants = append(productVariants, "") } else if m.IsSnapshotPrebuilt() { // 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() == "" { // This will be available in /vendor (or /odm) only - - // 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, "") - } + vendorVariants = append(vendorVariants, "") } else { // This is either in /system (or similar: /data), or is a // 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) } 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) { m.Properties.ImageVariation = ProductVariation if strings.HasPrefix(variant, ProductVariationPrefix) { diff --git a/cc/library.go b/cc/library.go index e840c3ead..32b689bfc 100644 --- a/cc/library.go +++ b/cc/library.go @@ -17,7 +17,6 @@ package cc import ( "fmt" "io" - "log" "path/filepath" "regexp" "strconv" @@ -753,20 +752,6 @@ func (library *libraryDecorator) getLibNameHelper(baseModuleName string, inVendo func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string { 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 !strings.HasSuffix(name, "-host") { name = name + "-host" diff --git a/cc/makevars.go b/cc/makevars.go index 46303307e..9251d6a49 100644 --- a/cc/makevars.go +++ b/cc/makevars.go @@ -97,8 +97,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "") 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 exportedVendorPublicLibraries := []string{} ctx.VisitAllModules(func(module android.Module) { diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go index f4ba163d5..4d2412fe5 100644 --- a/cc/vndk_prebuilt.go +++ b/cc/vndk_prebuilt.go @@ -159,11 +159,6 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext, p.androidMkSuffix = p.NameSuffix() - vndkVersion := ctx.DeviceConfig().VndkVersion() - if vndkVersion == p.Version() { - p.androidMkSuffix = "" - } - android.SetProvider(ctx, SharedLibraryInfoProvider, SharedLibraryInfo{ SharedLibrary: in, Target: ctx.Target(), diff --git a/rust/image.go b/rust/image.go index 530c56edd..e0d267d61 100644 --- a/rust/image.go +++ b/rust/image.go @@ -208,14 +208,6 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri if strings.HasPrefix(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) { m.Properties.ImageVariation = cc.ProductVariation if strings.HasPrefix(variant, cc.ProductVariationPrefix) {