Set __ANDROID_API__ for vendor modules to vndk version. am: 732aa6afdf

am: e194a56a01

Change-Id: I1093e689f14f029db238bf4a838c0def8493a502
This commit is contained in:
Justin Yun
2018-03-27 01:37:27 +00:00
committed by android-build-merger
3 changed files with 27 additions and 5 deletions

View File

@@ -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 ""
}

View File

@@ -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)

View File

@@ -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
}