Merge "Remove VndkUseCoreVariant related code from build" into main

This commit is contained in:
Kiyoung Kim 2024-05-27 00:59:37 +00:00 committed by Gerrit Code Review
commit 60cec95e01
10 changed files with 6 additions and 155 deletions

View file

@ -1466,10 +1466,6 @@ func (c *deviceConfig) ExtraVndkVersions() []string {
return c.config.productVariables.ExtraVndkVersions
}
func (c *deviceConfig) VndkUseCoreVariant() bool {
return Bool(c.config.productVariables.VndkUseCoreVariant) && Bool(c.config.productVariables.KeepVndk)
}
func (c *deviceConfig) SystemSdkVersions() []string {
return c.config.productVariables.DeviceSystemSdkVersions
}

View file

@ -363,7 +363,6 @@ type ProductVariables struct {
PgoAdditionalProfileDirs []string `json:",omitempty"`
VndkUseCoreVariant *bool `json:",omitempty"`
VndkSnapshotBuildArtifacts *bool `json:",omitempty"`
DirectedVendorSnapshot bool `json:",omitempty"`

View file

@ -261,15 +261,6 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
if library.coverageOutputFile.Valid() {
entries.SetString("LOCAL_PREBUILT_COVERAGE_ARCHIVE", library.coverageOutputFile.String())
}
if library.useCoreVariant {
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
entries.SetBool("LOCAL_VNDK_DEPEND_ON_CORE_VARIANT", true)
}
if library.checkSameCoreVariant {
entries.SetBool("LOCAL_CHECK_SAME_VNDK_VARIANTS", true)
}
})
if library.shared() && !library.buildStubs() {

View file

@ -374,10 +374,6 @@ type BaseProperties struct {
// build system and source tree.
Cmake_snapshot_supported *bool
// Even if DeviceConfig().VndkUseCoreVariant() is set, this module must use vendor variant.
// see soong/cc/config/vndk.go
MustUseVendorVariant bool `blueprint:"mutated"`
Installable *bool `android:"arch_variant"`
// Set by factories of module types that can only be referenced from variants compiled against
@ -479,10 +475,6 @@ type VendorProperties struct {
// IsLLNDK is set to true for the vendor variant of a cc_library module that has LLNDK stubs.
IsLLNDK bool `blueprint:"mutated"`
// IsVNDKUsingCoreVariant is true for VNDK modules if the global VndkUseCoreVariant option is
// set and the module is not listed in VndkMustUseVendorVariantList.
IsVNDKUsingCoreVariant bool `blueprint:"mutated"`
// IsVNDKCore is set if a VNDK module does not set the vndk.support_system_process property.
IsVNDKCore bool `blueprint:"mutated"`
@ -548,7 +540,6 @@ type ModuleContextIntf interface {
apexVariationName() string
apexSdkVersion() android.ApiLevel
bootstrap() bool
mustUseVendorVariant() bool
nativeCoverage() bool
directlyInAnyApex() bool
isPreventInstall() bool
@ -1472,10 +1463,6 @@ func (c *Module) SubName() string {
return c.Properties.SubName
}
func (c *Module) MustUseVendorVariant() bool {
return c.IsVndkSp() || c.Properties.MustUseVendorVariant
}
func (c *Module) getVndkExtendsModuleName() string {
if vndkdep := c.vndkdep; vndkdep != nil {
return vndkdep.getVndkExtendsModuleName()
@ -1768,10 +1755,6 @@ func (ctx *moduleContextImpl) IsVendorPublicLibrary() bool {
return ctx.mod.IsVendorPublicLibrary()
}
func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
return ctx.mod.MustUseVendorVariant()
}
func (ctx *moduleContextImpl) selectedStl() string {
if stl := ctx.mod.stl; stl != nil {
return stl.Properties.SelectedStl
@ -3648,12 +3631,7 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
}
}
if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.IsVndk() && !ccDep.MustUseVendorVariant() &&
!c.InRamdisk() && !c.InVendorRamdisk() && !c.InRecovery() {
// The vendor module is a no-vendor-variant VNDK library. Depend on the
// core module instead.
return libName
} else if ccDep.InVendorOrProduct() && nonSystemVariantsExist {
if ccDep.InVendorOrProduct() && nonSystemVariantsExist {
// The vendor and product modules in Make will have been renamed to not conflict with the
// core module, so update the dependency name here accordingly.
return libName + ccDep.SubName()
@ -3866,8 +3844,6 @@ func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string {
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
//family, link := getNdkStlFamilyAndLinkType(c)
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
} else if actx.DeviceConfig().VndkUseCoreVariant() && !c.MustUseVendorVariant() {
return "native:platform_vndk"
} else {
return "native:platform"
}

View file

@ -15,7 +15,6 @@ bootstrap_go_package {
"global.go",
"tidy.go",
"toolchain.go",
"vndk.go",
"bionic.go",

View file

@ -1,45 +0,0 @@
// Copyright 2019 Google Inc. All rights reserved.
//
// 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 config
// List of VNDK libraries that have different core variant and vendor variant.
// For these libraries, the vendor variants must be installed even if the device
// has VndkUseCoreVariant set.
// Note that AIDL-generated modules must use vendor variants by default.
var VndkMustUseVendorVariantList = []string{
"android.hardware.nfc@1.2",
"libbinder",
"libcrypto",
"libexpat",
"libgatekeeper",
"libgui",
"libhidlcache",
"libkeymaster_messages",
"libkeymaster_portable",
"libmedia_omx",
"libpuresoftkeymasterdevice",
"libselinux",
"libsoftkeymasterdevice",
"libsqlite",
"libssl",
"libstagefright_bufferpool@2.0",
"libstagefright_bufferqueue_helper",
"libstagefright_foundation",
"libstagefright_omx",
"libstagefright_omx_utils",
"libstagefright_xmlparser",
"libui",
"libxml2",
}

View file

@ -419,11 +419,6 @@ type libraryDecorator struct {
postInstallCmds []string
// If useCoreVariant is true, the vendor variant of a VNDK library is
// not installed.
useCoreVariant bool
checkSameCoreVariant bool
skipAPIDefine bool
// Decorated interfaces
@ -1767,27 +1762,6 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
}
}
// In some cases we want to use core variant for VNDK-Core libs.
// Skip product variant since VNDKs use only the vendor variant.
if ctx.isVndk() && !ctx.isVndkSp() && !ctx.IsVndkExt() && !ctx.inProduct() {
mayUseCoreVariant := true
if ctx.mustUseVendorVariant() {
mayUseCoreVariant = false
}
if ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) {
mayUseCoreVariant = false
}
if mayUseCoreVariant {
library.checkSameCoreVariant = true
if ctx.DeviceConfig().VndkUseCoreVariant() {
library.useCoreVariant = true
}
}
}
// do not install vndk libs
// vndk libs are packaged into VNDK APEX
if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() && !ctx.inProduct() {

View file

@ -165,7 +165,6 @@ type LinkableInterface interface {
// IsVndkSp returns true if this is a VNDK-SP module.
IsVndkSp() bool
MustUseVendorVariant() bool
IsVndk() bool
IsVndkExt() bool
IsVndkPrivate() bool

View file

@ -20,7 +20,6 @@ import (
"strings"
"android/soong/android"
"android/soong/cc/config"
"android/soong/etc"
"github.com/google/blueprint"
@ -219,11 +218,10 @@ func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string)
var (
vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP })
vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore })
vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate })
vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct })
vndkUsingCoreVariantLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKUsingCoreVariant })
vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP })
vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore })
vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate })
vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct })
)
// vndkModuleLister takes a predicate that operates on a Module and returns a moduleListerFunc
@ -266,22 +264,6 @@ func vndkModuleListRemover(lister moduleListerFunc, prefix string) moduleListerF
}
}
var vndkMustUseVendorVariantListKey = android.NewOnceKey("vndkMustUseVendorVariantListKey")
func vndkMustUseVendorVariantList(cfg android.Config) []string {
return cfg.Once(vndkMustUseVendorVariantListKey, func() interface{} {
return config.VndkMustUseVendorVariantList
}).([]string)
}
// test may call this to override global configuration(config.VndkMustUseVendorVariantList)
// when it is called, it must be before the first call to vndkMustUseVendorVariantList()
func setVndkMustUseVendorVariantListForTest(config android.Config, mustUseVendorVariantList []string) {
config.Once(vndkMustUseVendorVariantListKey, func() interface{} {
return mustUseVendorVariantList
})
}
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
if m.InProduct() {
// We may skip the steps for the product variants because they
@ -301,13 +283,6 @@ func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
mctx.PropertyErrorf("vndk.enabled", "This library provides stubs. Shouldn't be VNDK. Consider making it as LLNDK")
}
if inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
m.Properties.MustUseVendorVariant = true
}
if mctx.DeviceConfig().VndkUseCoreVariant() && !m.Properties.MustUseVendorVariant {
m.VendorProperties.IsVNDKUsingCoreVariant = true
}
if m.vndkdep.isVndkSp() {
m.VendorProperties.IsVNDKSP = true
} else {
@ -356,8 +331,7 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
if lib.buildStubs() {
return false
}
useCoreVariant := mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
return lib.shared() && m.InVendor() && m.IsVndk() && !m.IsVndkExt() && !useCoreVariant
return lib.shared() && m.InVendor() && m.IsVndk() && !m.IsVndkExt()
}
return false
}
@ -400,7 +374,6 @@ func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) {
ctx.RegisterParallelSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkproduct_libraries_txt", vndkProductLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkcorevariant_libraries_txt", vndkUsingCoreVariantLibrariesTxtFactory)
}
type vndkLibrariesTxt struct {
@ -453,13 +426,6 @@ func vndkProductLibrariesTxtFactory() android.SingletonModule {
return newVndkLibrariesTxt(vndkProductLibraries, "VNDK_PRODUCT_LIBRARIES")
}
// vndkcorevariant_libraries_txt is a singleton module whose content is a list of VNDK libraries
// that are using the core variant, generated by Soong but can be referenced by other modules.
// For example, apex_vndk can depend on these files as prebuilt.
func vndkUsingCoreVariantLibrariesTxtFactory() android.SingletonModule {
return newVndkLibrariesTxt(vndkUsingCoreVariantLibraries, "VNDK_USING_CORE_VARIANT_LIBRARIES")
}
func newVndkLibrariesWithMakeVarFilter(lister moduleListerFunc, makeVarName string, filter string) android.SingletonModule {
m := &vndkLibrariesTxt{
lister: lister,

View file

@ -341,10 +341,6 @@ func (mod *Module) Bootstrap() bool {
return Bool(mod.Properties.Bootstrap)
}
func (mod *Module) MustUseVendorVariant() bool {
return true
}
func (mod *Module) SubName() string {
return mod.Properties.SubName
}