From f14beafb7c52e58330a294a640a4abdb40b521c6 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Fri, 18 Aug 2023 17:51:14 +0900 Subject: [PATCH] Ignore some prebuilt vndk libs for trunk-stable next Source tree may include prebuilt vndk snapshot libs that are newer than or equal to the PLATFORM_VNDK_VERSION. Ignore those prebuilt vndk snapshot libs. Bug: 296488609 Test: lunch cf_x86_64_phone-next-userdebug; m nothing Change-Id: I3adaf3b7636f53884f08540959d2ec2fddfb6921 --- apex/vndk.go | 4 ++++ cc/vndk.go | 14 +++++++++++--- cc/vndk_prebuilt.go | 6 ++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apex/vndk.go b/apex/vndk.go index 095e89db3..5b8e754d4 100644 --- a/apex/vndk.go +++ b/apex/vndk.go @@ -80,6 +80,10 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { // config targets the 'current' VNDK (see `vndkVersion`). ab.Disable() } + if proptools.String(ab.vndkProperties.Vndk_version) != "" && + apiLevel.GreaterThanOrEqualTo(android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion())) { + ab.Disable() + } } } diff --git a/cc/vndk.go b/cc/vndk.go index 7a2286eb1..c35b39128 100644 --- a/cc/vndk.go +++ b/cc/vndk.go @@ -352,11 +352,19 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { return false } - // 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()) { - return false + if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok { + // prebuilt vndk modules should match with device + if !p.MatchesWithDevice(mctx.DeviceConfig()) { + return false + } + + // ignore prebuilt vndk modules that are newer than or equal to the platform vndk version + platformVndkApiLevel := android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion()) + if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, p.Version())) { + return false + } } if lib, ok := m.linker.(libraryInterface); ok { diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go index 37819a4be..5e526db92 100644 --- a/cc/vndk_prebuilt.go +++ b/cc/vndk_prebuilt.go @@ -131,6 +131,12 @@ func (p *vndkPrebuiltLibraryDecorator) singleSourcePath(ctx ModuleContext) andro func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path { + platformVndkApiLevel := android.ApiLevelOrPanic(ctx, ctx.DeviceConfig().PlatformVndkVersion()) + if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) { + // This prebuilt VNDK module is not required for the current build + ctx.Module().HideFromMake() + return nil + } if !p.MatchesWithDevice(ctx.DeviceConfig()) { ctx.Module().HideFromMake()