Merge "Add version to vendor variants"
This commit is contained in:
@@ -773,7 +773,7 @@ func (a *apexBundle) installable() bool {
|
|||||||
|
|
||||||
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
||||||
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
|
||||||
return "vendor"
|
return "vendor." + config.PlatformVndkVersion()
|
||||||
} else {
|
} else {
|
||||||
return "core"
|
return "core"
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,6 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
config.TestProductVariables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"}
|
config.TestProductVariables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"}
|
||||||
config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("Q")
|
config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("Q")
|
||||||
config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(false)
|
config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(false)
|
||||||
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
|
|
||||||
config.TestProductVariables.Platform_vndk_version = proptools.StringPtr("VER")
|
config.TestProductVariables.Platform_vndk_version = proptools.StringPtr("VER")
|
||||||
|
|
||||||
ctx := android.NewTestArchContext()
|
ctx := android.NewTestArchContext()
|
||||||
@@ -1050,8 +1049,8 @@ func TestUseVendor(t *testing.T) {
|
|||||||
inputsString := strings.Join(inputsList, " ")
|
inputsString := strings.Join(inputsList, " ")
|
||||||
|
|
||||||
// ensure that the apex includes vendor variants of the direct and indirect deps
|
// ensure that the apex includes vendor variants of the direct and indirect deps
|
||||||
ensureContains(t, inputsString, "android_arm64_armv8-a_vendor_shared_myapex/mylib.so")
|
ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib.so")
|
||||||
ensureContains(t, inputsString, "android_arm64_armv8-a_vendor_shared_myapex/mylib2.so")
|
ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib2.so")
|
||||||
|
|
||||||
// ensure that the apex does not include core variants
|
// ensure that the apex does not include core variants
|
||||||
ensureNotContains(t, inputsString, "android_arm64_armv8-a_core_shared_myapex/mylib.so")
|
ensureNotContains(t, inputsString, "android_arm64_armv8-a_core_shared_myapex/mylib.so")
|
||||||
|
@@ -37,6 +37,7 @@ type AndroidMkContext interface {
|
|||||||
Os() android.OsType
|
Os() android.OsType
|
||||||
Host() bool
|
Host() bool
|
||||||
useVndk() bool
|
useVndk() bool
|
||||||
|
vndkVersion() string
|
||||||
static() bool
|
static() bool
|
||||||
inRecovery() bool
|
inRecovery() bool
|
||||||
}
|
}
|
||||||
@@ -109,17 +110,7 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
}
|
}
|
||||||
c.subAndroidMk(&ret, c.installer)
|
c.subAndroidMk(&ret, c.installer)
|
||||||
|
|
||||||
if c.Target().NativeBridge == android.NativeBridgeEnabled {
|
ret.SubName += c.Properties.SubName
|
||||||
ret.SubName += nativeBridgeSuffix
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.useVndk() && c.hasVendorVariant() {
|
|
||||||
// .vendor suffix is added only when we will have two variants: core and vendor.
|
|
||||||
// The suffix is not added for vendor-only module.
|
|
||||||
ret.SubName += vendorSuffix
|
|
||||||
} else if c.inRecovery() && !c.onlyInRecovery() {
|
|
||||||
ret.SubName += recoverySuffix
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
@@ -357,7 +348,6 @@ func (c *stubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
|
|||||||
|
|
||||||
func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
func (c *llndkStubDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
|
||||||
ret.Class = "SHARED_LIBRARIES"
|
ret.Class = "SHARED_LIBRARIES"
|
||||||
ret.SubName = vendorSuffix
|
|
||||||
|
|
||||||
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
|
||||||
c.libraryDecorator.androidMkWriteExportedFlags(w)
|
c.libraryDecorator.androidMkWriteExportedFlags(w)
|
||||||
|
105
cc/cc.go
105
cc/cc.go
@@ -36,9 +36,9 @@ func init() {
|
|||||||
android.RegisterModuleType("cc_defaults", defaultsFactory)
|
android.RegisterModuleType("cc_defaults", defaultsFactory)
|
||||||
|
|
||||||
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||||
|
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
||||||
ctx.BottomUp("image", ImageMutator).Parallel()
|
ctx.BottomUp("image", ImageMutator).Parallel()
|
||||||
ctx.BottomUp("link", LinkageMutator).Parallel()
|
ctx.BottomUp("link", LinkageMutator).Parallel()
|
||||||
ctx.BottomUp("vndk", VndkMutator).Parallel()
|
|
||||||
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
|
||||||
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
|
||||||
ctx.BottomUp("version", VersionMutator).Parallel()
|
ctx.BottomUp("version", VersionMutator).Parallel()
|
||||||
@@ -200,7 +200,8 @@ type BaseProperties struct {
|
|||||||
PreventInstall bool `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
ApexesProvidingSharedLibs []string `blueprint:"mutated"`
|
ApexesProvidingSharedLibs []string `blueprint:"mutated"`
|
||||||
|
|
||||||
UseVndk bool `blueprint:"mutated"`
|
VndkVersion string `blueprint:"mutated"`
|
||||||
|
SubName string `blueprint:"mutated"`
|
||||||
|
|
||||||
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
|
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
|
||||||
// file
|
// file
|
||||||
@@ -562,7 +563,7 @@ func (c *Module) isDependencyRoot() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) useVndk() bool {
|
func (c *Module) useVndk() bool {
|
||||||
return c.Properties.UseVndk
|
return c.Properties.VndkVersion != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isCoverageVariant() bool {
|
func (c *Module) isCoverageVariant() bool {
|
||||||
@@ -596,10 +597,7 @@ func (c *Module) isVndk() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) vndkVersion() string {
|
func (c *Module) vndkVersion() string {
|
||||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
return c.Properties.VndkVersion
|
||||||
return vndkdep.Properties.Vndk.Version
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isPgoCompile() bool {
|
func (c *Module) isPgoCompile() bool {
|
||||||
@@ -1009,6 +1007,31 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
|
|
||||||
c.makeLinkType = c.getMakeLinkType(actx)
|
c.makeLinkType = c.getMakeLinkType(actx)
|
||||||
|
|
||||||
|
c.Properties.SubName = ""
|
||||||
|
|
||||||
|
if c.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
|
c.Properties.SubName += nativeBridgeSuffix
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||||
|
// .vendor suffix is added for backward compatibility with VNDK snapshot whose names with
|
||||||
|
// such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp.
|
||||||
|
c.Properties.SubName += vendorSuffix
|
||||||
|
} else if _, ok := c.linker.(*llndkStubDecorator); ok || (c.useVndk() && c.hasVendorVariant()) {
|
||||||
|
// .vendor.{version} suffix is added only when we will have two variants: core and vendor.
|
||||||
|
// The suffix is not added for vendor-only module.
|
||||||
|
c.Properties.SubName += vendorSuffix
|
||||||
|
vendorVersion := actx.DeviceConfig().VndkVersion()
|
||||||
|
if vendorVersion == "current" {
|
||||||
|
vendorVersion = actx.DeviceConfig().PlatformVndkVersion()
|
||||||
|
}
|
||||||
|
if c.Properties.VndkVersion != vendorVersion {
|
||||||
|
c.Properties.SubName += "." + c.Properties.VndkVersion
|
||||||
|
}
|
||||||
|
} else if c.inRecovery() && !c.onlyInRecovery() {
|
||||||
|
c.Properties.SubName += recoverySuffix
|
||||||
|
}
|
||||||
|
|
||||||
ctx := &moduleContext{
|
ctx := &moduleContext{
|
||||||
ModuleContext: actx,
|
ModuleContext: actx,
|
||||||
moduleContextImpl: moduleContextImpl{
|
moduleContextImpl: moduleContextImpl{
|
||||||
@@ -1496,9 +1519,11 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||||
if vndkdep.isVndkExt() {
|
if vndkdep.isVndkExt() {
|
||||||
baseModuleMode := vendorMode
|
var baseModuleMode string
|
||||||
if actx.DeviceConfig().VndkVersion() == "" {
|
if actx.DeviceConfig().VndkVersion() == "" {
|
||||||
baseModuleMode = coreMode
|
baseModuleMode = coreMode
|
||||||
|
} else {
|
||||||
|
baseModuleMode = c.imageVariation()
|
||||||
}
|
}
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "image", Variation: baseModuleMode},
|
{Mutator: "image", Variation: baseModuleMode},
|
||||||
@@ -1521,7 +1546,7 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag depe
|
|||||||
// Host code is not restricted
|
// Host code is not restricted
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if from.Properties.UseVndk {
|
if from.useVndk() {
|
||||||
// Though vendor code is limited by the vendor mutator,
|
// Though vendor code is limited by the vendor mutator,
|
||||||
// each vendor-available module needs to check
|
// each vendor-available module needs to check
|
||||||
// link-type for VNDK.
|
// link-type for VNDK.
|
||||||
@@ -1928,7 +1953,15 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
} else if c.useVndk() && bothVendorAndCoreVariantsExist {
|
} else if c.useVndk() && bothVendorAndCoreVariantsExist {
|
||||||
// The vendor module in Make will have been renamed to not conflict with the core
|
// The vendor module in Make will have been renamed to not conflict with the core
|
||||||
// module, so update the dependency name here accordingly.
|
// module, so update the dependency name here accordingly.
|
||||||
return libName + vendorSuffix
|
ret := libName + vendorSuffix
|
||||||
|
vendorVersion := ctx.DeviceConfig().VndkVersion()
|
||||||
|
if vendorVersion == "current" {
|
||||||
|
vendorVersion = ctx.DeviceConfig().PlatformVndkVersion()
|
||||||
|
}
|
||||||
|
if c.Properties.VndkVersion != vendorVersion {
|
||||||
|
ret += "." + c.Properties.VndkVersion
|
||||||
|
}
|
||||||
|
return ret
|
||||||
} else if (ctx.Platform() || ctx.ProductSpecific()) && isVendorPublicLib {
|
} else if (ctx.Platform() || ctx.ProductSpecific()) && isVendorPublicLib {
|
||||||
return libName + vendorPublicLibrarySuffix
|
return libName + vendorPublicLibrarySuffix
|
||||||
} else if ccDep.inRecovery() && !ccDep.onlyInRecovery() {
|
} else if ccDep.inRecovery() && !ccDep.onlyInRecovery() {
|
||||||
@@ -2114,13 +2147,12 @@ func (c *Module) installable() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) imageVariation() string {
|
func (c *Module) imageVariation() string {
|
||||||
variation := "core"
|
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
variation = "vendor"
|
return vendorMode + "." + c.Properties.VndkVersion
|
||||||
} else if c.inRecovery() {
|
} else if c.inRecovery() {
|
||||||
variation = "recovery"
|
return recoveryMode
|
||||||
}
|
}
|
||||||
return variation
|
return coreMode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) IDEInfo(dpInfo *android.IdeInfo) {
|
func (c *Module) IDEInfo(dpInfo *android.IdeInfo) {
|
||||||
@@ -2197,7 +2229,7 @@ const (
|
|||||||
// SDK libraries. (which framework-private libraries can use)
|
// SDK libraries. (which framework-private libraries can use)
|
||||||
coreMode = "core"
|
coreMode = "core"
|
||||||
|
|
||||||
// vendorMode is the variant used for /vendor code that compiles
|
// vendorMode is the variant prefix used for /vendor code that compiles
|
||||||
// against the VNDK.
|
// against the VNDK.
|
||||||
vendorMode = "vendor"
|
vendorMode = "vendor"
|
||||||
|
|
||||||
@@ -2261,7 +2293,10 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
variants = append(variants, coreMode)
|
variants = append(variants, coreMode)
|
||||||
}
|
}
|
||||||
if vendorVariantNeeded {
|
if vendorVariantNeeded {
|
||||||
variants = append(variants, vendorMode)
|
variants = append(variants, vendorMode+"."+mctx.DeviceConfig().PlatformVndkVersion())
|
||||||
|
if vndkVersion := mctx.DeviceConfig().VndkVersion(); vndkVersion != "current" {
|
||||||
|
variants = append(variants, vendorMode+"."+vndkVersion)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if recoveryVariantNeeded {
|
if recoveryVariantNeeded {
|
||||||
variants = append(variants, recoveryMode)
|
variants = append(variants, recoveryMode)
|
||||||
@@ -2333,9 +2368,16 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var coreVariantNeeded bool = false
|
var coreVariantNeeded bool = false
|
||||||
var vendorVariantNeeded bool = false
|
|
||||||
var recoveryVariantNeeded bool = false
|
var recoveryVariantNeeded bool = false
|
||||||
|
|
||||||
|
var vendorVariants []string
|
||||||
|
|
||||||
|
platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
|
||||||
|
deviceVndkVersion := mctx.DeviceConfig().VndkVersion()
|
||||||
|
if deviceVndkVersion == "current" {
|
||||||
|
deviceVndkVersion = platformVndkVersion
|
||||||
|
}
|
||||||
|
|
||||||
if mctx.DeviceConfig().VndkVersion() == "" {
|
if mctx.DeviceConfig().VndkVersion() == "" {
|
||||||
// If the device isn't compiling against the VNDK, we always
|
// If the device isn't compiling against the VNDK, we always
|
||||||
// use the core mode.
|
// use the core mode.
|
||||||
@@ -2346,22 +2388,31 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
} else if _, ok := m.linker.(*llndkStubDecorator); ok {
|
} else if _, ok := m.linker.(*llndkStubDecorator); ok {
|
||||||
// LL-NDK stubs only exist in the vendor variant, since the
|
// LL-NDK stubs only exist in the vendor variant, since the
|
||||||
// real libraries will be used in the core variant.
|
// real libraries will be used in the core variant.
|
||||||
vendorVariantNeeded = true
|
vendorVariants = append(vendorVariants,
|
||||||
|
platformVndkVersion,
|
||||||
|
deviceVndkVersion,
|
||||||
|
)
|
||||||
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
|
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
|
||||||
// ... and LL-NDK headers as well
|
// ... and LL-NDK headers as well
|
||||||
vendorVariantNeeded = true
|
vendorVariants = append(vendorVariants,
|
||||||
} else if _, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
platformVndkVersion,
|
||||||
|
deviceVndkVersion,
|
||||||
|
)
|
||||||
|
} else if lib, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||||
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
||||||
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
||||||
vendorVariantNeeded = true
|
vendorVariants = append(vendorVariants, lib.version())
|
||||||
} else if m.hasVendorVariant() && !vendorSpecific {
|
} else if m.hasVendorVariant() && !vendorSpecific {
|
||||||
// This will be available in both /system and /vendor
|
// This will be available in both /system and /vendor
|
||||||
// or a /system directory that is available to vendor.
|
// or a /system directory that is available to vendor.
|
||||||
coreVariantNeeded = true
|
coreVariantNeeded = true
|
||||||
vendorVariantNeeded = true
|
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||||
|
if m.isVndk() {
|
||||||
|
vendorVariants = append(vendorVariants, deviceVndkVersion)
|
||||||
|
}
|
||||||
} else if vendorSpecific && String(m.Properties.Sdk_version) == "" {
|
} else if vendorSpecific && String(m.Properties.Sdk_version) == "" {
|
||||||
// This will be available in /vendor (or /odm) only
|
// This will be available in /vendor (or /odm) only
|
||||||
vendorVariantNeeded = true
|
vendorVariants = append(vendorVariants, deviceVndkVersion)
|
||||||
} else {
|
} else {
|
||||||
// This is either in /system (or similar: /data), or is a
|
// This is either in /system (or similar: /data), or is a
|
||||||
// modules built with the NDK. Modules built with the NDK
|
// modules built with the NDK. Modules built with the NDK
|
||||||
@@ -2390,17 +2441,17 @@ func ImageMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if coreVariantNeeded {
|
if coreVariantNeeded {
|
||||||
variants = append(variants, coreMode)
|
variants = append(variants, coreMode)
|
||||||
}
|
}
|
||||||
if vendorVariantNeeded {
|
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
|
||||||
variants = append(variants, vendorMode)
|
variants = append(variants, vendorMode+"."+variant)
|
||||||
}
|
}
|
||||||
if recoveryVariantNeeded {
|
if recoveryVariantNeeded {
|
||||||
variants = append(variants, recoveryMode)
|
variants = append(variants, recoveryMode)
|
||||||
}
|
}
|
||||||
mod := mctx.CreateVariations(variants...)
|
mod := mctx.CreateVariations(variants...)
|
||||||
for i, v := range variants {
|
for i, v := range variants {
|
||||||
if v == vendorMode {
|
if strings.HasPrefix(v, vendorMode+".") {
|
||||||
m := mod[i].(*Module)
|
m := mod[i].(*Module)
|
||||||
m.Properties.UseVndk = true
|
m.Properties.VndkVersion = strings.TrimPrefix(v, vendorMode+".")
|
||||||
squashVendorSrcs(m)
|
squashVendorSrcs(m)
|
||||||
} else if v == recoveryMode {
|
} else if v == recoveryMode {
|
||||||
m := mod[i].(*Module)
|
m := mod[i].(*Module)
|
||||||
|
@@ -112,7 +112,7 @@ func testCcError(t *testing.T, pattern string, bp string) {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
coreVariant = "android_arm64_armv8-a_core_shared"
|
coreVariant = "android_arm64_armv8-a_core_shared"
|
||||||
vendorVariant = "android_arm64_armv8-a_vendor_shared"
|
vendorVariant = "android_arm64_armv8-a_vendor.VER_shared"
|
||||||
recoveryVariant = "android_arm64_armv8-a_recovery_shared"
|
recoveryVariant = "android_arm64_armv8-a_recovery_shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -328,8 +328,8 @@ func TestVndk(t *testing.T) {
|
|||||||
vndkCoreLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-core")
|
vndkCoreLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-core")
|
||||||
vndkSpLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-sp")
|
vndkSpLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-sp")
|
||||||
|
|
||||||
variant := "android_arm64_armv8-a_vendor_shared"
|
variant := "android_arm64_armv8-a_vendor.VER_shared"
|
||||||
variant2nd := "android_arm_armv7-a-neon_vendor_shared"
|
variant2nd := "android_arm_armv7-a-neon_vendor.VER_shared"
|
||||||
|
|
||||||
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLibPath, variant)
|
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLibPath, variant)
|
||||||
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLib2ndPath, variant2nd)
|
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLib2ndPath, variant2nd)
|
||||||
@@ -1343,6 +1343,8 @@ func TestMakeLinkType(t *testing.T) {
|
|||||||
assertArrayString(t, *vndkPrivateLibraries(config),
|
assertArrayString(t, *vndkPrivateLibraries(config),
|
||||||
[]string{"libllndkprivate", "libvndkprivate"})
|
[]string{"libllndkprivate", "libvndkprivate"})
|
||||||
|
|
||||||
|
vendorVariant27 := "android_arm64_armv8-a_vendor.27_shared"
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
variant string
|
variant string
|
||||||
name string
|
name string
|
||||||
@@ -1353,8 +1355,8 @@ func TestMakeLinkType(t *testing.T) {
|
|||||||
{vendorVariant, "libvndkprivate", "native:vndk_private"},
|
{vendorVariant, "libvndkprivate", "native:vndk_private"},
|
||||||
{vendorVariant, "libvendor", "native:vendor"},
|
{vendorVariant, "libvendor", "native:vendor"},
|
||||||
{vendorVariant, "libvndkext", "native:vendor"},
|
{vendorVariant, "libvndkext", "native:vendor"},
|
||||||
{vendorVariant, "prevndk.vndk.27.arm.binder32", "native:vndk"},
|
|
||||||
{vendorVariant, "libllndk.llndk", "native:vndk"},
|
{vendorVariant, "libllndk.llndk", "native:vndk"},
|
||||||
|
{vendorVariant27, "prevndk.vndk.27.arm.binder32", "native:vndk"},
|
||||||
{coreVariant, "libvndk", "native:platform"},
|
{coreVariant, "libvndk", "native:platform"},
|
||||||
{coreVariant, "libvndkprivate", "native:platform"},
|
{coreVariant, "libvndkprivate", "native:platform"},
|
||||||
{coreVariant, "libllndk", "native:platform"},
|
{coreVariant, "libllndk", "native:platform"},
|
||||||
@@ -1792,7 +1794,7 @@ func TestLlndkHeaders(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
// _static variant is used since _shared reuses *.o from the static variant
|
// _static variant is used since _shared reuses *.o from the static variant
|
||||||
cc := ctx.ModuleForTests("libvendor", "android_arm_armv7-a-neon_vendor_static").Rule("cc")
|
cc := ctx.ModuleForTests("libvendor", "android_arm_armv7-a-neon_vendor.VER_static").Rule("cc")
|
||||||
cflags := cc.Args["cFlags"]
|
cflags := cc.Args["cFlags"]
|
||||||
if !strings.Contains(cflags, "-Imy_include") {
|
if !strings.Contains(cflags, "-Imy_include") {
|
||||||
t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
|
t.Errorf("cflags for libvendor must contain -Imy_include, but was %#v.", cflags)
|
||||||
@@ -1878,7 +1880,7 @@ func TestRuntimeLibs(t *testing.T) {
|
|||||||
|
|
||||||
// runtime_libs for vendor variants have '.vendor' suffixes if the modules have both core
|
// runtime_libs for vendor variants have '.vendor' suffixes if the modules have both core
|
||||||
// and vendor variants.
|
// and vendor variants.
|
||||||
variant = "android_arm64_armv8-a_vendor_shared"
|
variant = "android_arm64_armv8-a_vendor.VER_shared"
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libvendor_available2", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"libvendor_available1.vendor"}, module)
|
checkRuntimeLibs(t, []string{"libvendor_available1.vendor"}, module)
|
||||||
@@ -1894,7 +1896,7 @@ func TestExcludeRuntimeLibs(t *testing.T) {
|
|||||||
module := ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
module := ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
checkRuntimeLibs(t, []string{"libvendor_available1"}, module)
|
||||||
|
|
||||||
variant = "android_arm64_armv8-a_vendor_shared"
|
variant = "android_arm64_armv8-a_vendor.VER_shared"
|
||||||
module = ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libvendor_available3", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, nil, module)
|
checkRuntimeLibs(t, nil, module)
|
||||||
}
|
}
|
||||||
@@ -2091,9 +2093,9 @@ func TestVendorPublicLibraries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test if libvendor is linked to the real shared lib
|
// test if libvendor is linked to the real shared lib
|
||||||
ld = ctx.ModuleForTests("libvendor", strings.Replace(variant, "_core", "_vendor", 1)).Rule("ld")
|
ld = ctx.ModuleForTests("libvendor", strings.Replace(variant, "_core", "_vendor.VER", 1)).Rule("ld")
|
||||||
libflags = ld.Args["libFlags"]
|
libflags = ld.Args["libFlags"]
|
||||||
stubPaths = getOutputPaths(ctx, strings.Replace(variant, "_core", "_vendor", 1), []string{"libvendorpublic"})
|
stubPaths = getOutputPaths(ctx, strings.Replace(variant, "_core", "_vendor.VER", 1), []string{"libvendorpublic"})
|
||||||
if !strings.Contains(libflags, stubPaths[0].String()) {
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
||||||
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
|
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ func (stub *llndkStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, de
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
||||||
vndk_ver := ctx.DeviceConfig().VndkVersion()
|
vndk_ver := ctx.Module().(*Module).Properties.VndkVersion
|
||||||
if vndk_ver == "current" {
|
if vndk_ver == "current" {
|
||||||
platform_vndk_ver := ctx.DeviceConfig().PlatformVndkVersion()
|
platform_vndk_ver := ctx.DeviceConfig().PlatformVndkVersion()
|
||||||
if !inList(platform_vndk_ver, ctx.Config().PlatformVersionCombinedCodenames()) {
|
if !inList(platform_vndk_ver, ctx.Config().PlatformVersionCombinedCodenames()) {
|
||||||
@@ -177,7 +177,6 @@ func NewLLndkStubLibrary() *Module {
|
|||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
stub.Properties.Vendor_available = BoolPtr(true)
|
stub.Properties.Vendor_available = BoolPtr(true)
|
||||||
module.Properties.UseVndk = true
|
|
||||||
module.compiler = stub
|
module.compiler = stub
|
||||||
module.linker = stub
|
module.linker = stub
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
18
cc/vndk.go
18
cc/vndk.go
@@ -49,10 +49,6 @@ type VndkProperties struct {
|
|||||||
|
|
||||||
// Extending another module
|
// Extending another module
|
||||||
Extends *string
|
Extends *string
|
||||||
|
|
||||||
// for vndk_prebuilt_shared, this is set by "version" property.
|
|
||||||
// Otherwise, this is set as PLATFORM_VNDK_VERSION.
|
|
||||||
Version string `blueprint:"mutated"`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +125,7 @@ func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module, ta
|
|||||||
// Other (static and LL-NDK) libraries are allowed to link.
|
// Other (static and LL-NDK) libraries are allowed to link.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !to.Properties.UseVndk {
|
if !to.useVndk() {
|
||||||
ctx.ModuleErrorf("(%s) should not link to %q which is not a vendor-available library",
|
ctx.ModuleErrorf("(%s) should not link to %q which is not a vendor-available library",
|
||||||
vndk.typeName(), to.Name())
|
vndk.typeName(), to.Name())
|
||||||
return
|
return
|
||||||
@@ -325,14 +321,6 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.isVndk() {
|
|
||||||
if lib, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
|
||||||
m.vndkdep.Properties.Vndk.Version = lib.version()
|
|
||||||
} else {
|
|
||||||
m.vndkdep.Properties.Vndk.Version = mctx.DeviceConfig().PlatformVndkVersion()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, ok := m.linker.(*llndkStubDecorator); ok {
|
if _, ok := m.linker.(*llndkStubDecorator); ok {
|
||||||
processLlndkLibrary(mctx, m)
|
processLlndkLibrary(mctx, m)
|
||||||
return
|
return
|
||||||
@@ -341,8 +329,8 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
lib, is_lib := m.linker.(*libraryDecorator)
|
lib, is_lib := m.linker.(*libraryDecorator)
|
||||||
prebuilt_lib, is_prebuilt_lib := m.linker.(*prebuiltLibraryLinker)
|
prebuilt_lib, is_prebuilt_lib := m.linker.(*prebuiltLibraryLinker)
|
||||||
|
|
||||||
if (is_lib && lib.shared()) || (is_prebuilt_lib && prebuilt_lib.shared()) {
|
if (is_lib && lib.buildShared()) || (is_prebuilt_lib && prebuilt_lib.buildShared()) {
|
||||||
if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
||||||
processVndkLibrary(mctx, m)
|
processVndkLibrary(mctx, m)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -167,13 +167,19 @@ func vndkPrebuiltSharedLibrary() *Module {
|
|||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
library.StripProperties.Strip.None = BoolPtr(true)
|
library.StripProperties.Strip.None = BoolPtr(true)
|
||||||
module.Properties.UseVndk = true
|
|
||||||
|
|
||||||
prebuilt := &vndkPrebuiltLibraryDecorator{
|
prebuilt := &vndkPrebuiltLibraryDecorator{
|
||||||
libraryDecorator: library,
|
libraryDecorator: library,
|
||||||
}
|
}
|
||||||
|
|
||||||
prebuilt.properties.Check_elf_files = BoolPtr(false)
|
prebuilt.properties.Check_elf_files = BoolPtr(false)
|
||||||
|
prebuilt.baseLinker.Properties.No_libcrt = BoolPtr(true)
|
||||||
|
prebuilt.baseLinker.Properties.Nocrt = BoolPtr(true)
|
||||||
|
|
||||||
|
// Prevent default system libs (libc, libm, and libdl) from being linked
|
||||||
|
if prebuilt.baseLinker.Properties.System_shared_libs == nil {
|
||||||
|
prebuilt.baseLinker.Properties.System_shared_libs = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
module.compiler = nil
|
module.compiler = nil
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
@@ -282,10 +282,10 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
|
|
||||||
// Check for generated cc_library
|
// Check for generated cc_library
|
||||||
for _, variant := range []string{
|
for _, variant := range []string{
|
||||||
"android_arm_armv7-a-neon_vendor_shared",
|
"android_arm_armv7-a-neon_vendor.VER_shared",
|
||||||
"android_arm_armv7-a-neon_vendor_static",
|
"android_arm_armv7-a-neon_vendor.VER_static",
|
||||||
"android_arm64_armv8-a_vendor_shared",
|
"android_arm64_armv8-a_vendor.VER_shared",
|
||||||
"android_arm64_armv8-a_vendor_static",
|
"android_arm64_armv8-a_vendor.VER_static",
|
||||||
} {
|
} {
|
||||||
ctx.ModuleForTests("libsysprop-platform", variant)
|
ctx.ModuleForTests("libsysprop-platform", variant)
|
||||||
ctx.ModuleForTests("libsysprop-vendor", variant)
|
ctx.ModuleForTests("libsysprop-vendor", variant)
|
||||||
@@ -309,15 +309,15 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
|
|
||||||
// Check for exported includes
|
// Check for exported includes
|
||||||
coreVariant := "android_arm64_armv8-a_core_static"
|
coreVariant := "android_arm64_armv8-a_core_static"
|
||||||
vendorVariant := "android_arm64_armv8-a_vendor_static"
|
vendorVariant := "android_arm64_armv8-a_vendor.VER_static"
|
||||||
|
|
||||||
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/include"
|
platformInternalPath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/include"
|
||||||
platformPublicCorePath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
platformPublicCorePath := "libsysprop-platform/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
||||||
platformPublicVendorPath := "libsysprop-platform/android_arm64_armv8-a_vendor_static/gen/sysprop/public/include"
|
platformPublicVendorPath := "libsysprop-platform/android_arm64_armv8-a_vendor.VER_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
vendorInternalPath := "libsysprop-vendor/android_arm64_armv8-a_vendor_static/gen/sysprop/include"
|
vendorInternalPath := "libsysprop-vendor/android_arm64_armv8-a_vendor.VER_static/gen/sysprop/include"
|
||||||
vendorPublicPath := "libsysprop-vendor/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
vendorPublicPath := "libsysprop-vendor/android_arm64_armv8-a_core_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
|
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
|
||||||
|
Reference in New Issue
Block a user