Set __ANDROID_API__ for vendor modules to vndk version.
When building vendor modules with BOARD_VNDK_VERSION=current, the
API of the vendor modules will be current PLATFORM_VNDK_VERSION.
__ANDROID_API_FUTURE__ will be used as before if the version is a
CODENAME.
If BOARD_VNDK_VERSION is not "current", that means the VNDK version
of the vendor modules is BOARD_VNDK_VERSION.
Bug: 74833244
Test: Build and check boot.
Change-Id: I383c76a36101e39c70575b463880b52d3e9d90bb
diff --git a/cc/compiler.go b/cc/compiler.go
index b2095a6..ffb8342 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -308,8 +308,13 @@
}
if ctx.useVndk() {
+ // sdkVersion() returns VNDK version for vendor modules.
+ version := ctx.sdkVersion()
+ if version == "current" {
+ version = "__ANDROID_API_FUTURE__"
+ }
flags.GlobalFlags = append(flags.GlobalFlags,
- "-D__ANDROID_API__=__ANDROID_API_FUTURE__", "-D__ANDROID_VNDK__")
+ "-D__ANDROID_API__="+version, "-D__ANDROID_VNDK__")
}
instructionSet := String(compiler.Properties.Instruction_set)