Pass min_sdk_version to cc __ANDROID_SDK_VERSION__

The macro is required only for apex variants regardless of useVndk.
Before the enforcement of LLNDK sdk version, the macro was not passed to
vendor variants.

Bug: 151689896
Test: TARGET_BUILD_APPS=com.android.media.swcodec m
      libbase in swcodec apex is linked with liblog#29
      (compiled with __ANDROID_SDK_VERSIO__=29)

Merged-In: I57fa4afe027eb39b98bd94d534be9ebe11713f19
Change-Id: I57fa4afe027eb39b98bd94d534be9ebe11713f19
(cherry picked from commit 24282778ee)

Exempt-From-Owner-Approval: cp from aosp
This commit is contained in:
Jooyung Han
2020-03-21 23:20:55 +09:00
parent 67a96cd7cb
commit c3e9263d7e
2 changed files with 10 additions and 13 deletions

View File

@@ -315,18 +315,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
"-isystem "+getCurrentIncludePath(ctx).Join(ctx, config.NDKTriple(tc)).String())
}
if ctx.canUseSdk() {
sdkVersion := ctx.sdkVersion()
if sdkVersion == "" || sdkVersion == "current" {
if ctx.isForPlatform() {
sdkVersion = strconv.Itoa(android.FutureApiLevel)
} else {
sdkVersion = strconv.Itoa(ctx.apexSdkVersion())
}
}
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_SDK_VERSION__="+sdkVersion)
}
if ctx.useVndk() {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VNDK__")
}
@@ -340,6 +328,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
if Bool(compiler.Properties.Use_apex_name_macro) {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX_"+makeDefineString(ctx.apexName())+"__")
}
if ctx.Device() {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_SDK_VERSION__="+strconv.Itoa(ctx.apexSdkVersion()))
}
}
instructionSet := String(compiler.Properties.Instruction_set)