aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2018-03-23 17:43:47 +0900
committerJustin Yun <justinyun@google.com>2018-03-28 23:02:41 +0000
commit2497d5f9cef5b46cbaa3509c6d34721998278fda (patch)
treebfc155137975b311c7ea2d4f956ea7fdd39f9534 /cc
parent604936801436ca6d726f490e53c04bb23ffdf799 (diff)
downloadbuild_soong-2497d5f9cef5b46cbaa3509c6d34721998278fda.tar.gz
build_soong-2497d5f9cef5b46cbaa3509c6d34721998278fda.tar.bz2
build_soong-2497d5f9cef5b46cbaa3509c6d34721998278fda.zip
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 Merged-In: I383c76a36101e39c70575b463880b52d3e9d90bb (cherry picked from commit 732aa6afdf57ccd2a007a6ca444b3b6592de34de)
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go13
-rw-r--r--cc/compiler.go7
-rw-r--r--cc/llndk_library.go12
3 files changed, 27 insertions, 5 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 71309301..b9c589a1 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -502,10 +502,17 @@ func (ctx *moduleContextImpl) useSdk() bool {
func (ctx *moduleContextImpl) sdkVersion() string {
if ctx.ctx.Device() {
if ctx.useVndk() {
- return "current"
- } else {
- return String(ctx.mod.Properties.Sdk_version)
+ vndk_ver := ctx.ctx.DeviceConfig().VndkVersion()
+ if vndk_ver == "current" {
+ platform_vndk_ver := ctx.ctx.DeviceConfig().PlatformVndkVersion()
+ if inList(platform_vndk_ver, ctx.ctx.Config().PlatformVersionCombinedCodenames()) {
+ return "current"
+ }
+ return platform_vndk_ver
+ }
+ return vndk_ver
}
+ return String(ctx.mod.Properties.Sdk_version)
}
return ""
}
diff --git a/cc/compiler.go b/cc/compiler.go
index b9ba31a7..8f187583 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -308,8 +308,13 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
}
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)
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index b573c2e6..6e64acfa 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -76,7 +76,17 @@ func (stub *llndkStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, de
}
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
- objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), "current", "--vndk")
+ vndk_ver := ctx.DeviceConfig().VndkVersion()
+ if vndk_ver == "current" {
+ platform_vndk_ver := ctx.DeviceConfig().PlatformVndkVersion()
+ if !inList(platform_vndk_ver, ctx.Config().PlatformVersionCombinedCodenames()) {
+ vndk_ver = platform_vndk_ver
+ }
+ } else if vndk_ver == "" {
+ // For non-enforcing devices, use "current"
+ vndk_ver = "current"
+ }
+ objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), vndk_ver, "--vndk")
stub.versionScriptPath = versionScript
return objs
}