diff --git a/apex/apex_test.go b/apex/apex_test.go index a94e3b4a7..cc05fd433 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -2831,18 +2831,18 @@ func TestMacro(t *testing.T) { // non-APEX variant does not have __ANDROID_APEX__ defined mylibCFlags := ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static").Rule("cc").Args["cFlags"] ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureNotContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__") + ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MIN_SDK_VERSION__") // APEX variant has __ANDROID_APEX__ and __ANDROID_APEX_SDK__ defined mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex10000").Rule("cc").Args["cFlags"] ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__=10000") + ensureContains(t, mylibCFlags, "-D__ANDROID_APEX_MIN_SDK_VERSION__=10000") ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__") // APEX variant has __ANDROID_APEX__ and __ANDROID_APEX_SDK__ defined mylibCFlags = ctx.ModuleForTests("mylib", "android_arm64_armv8-a_static_apex29").Rule("cc").Args["cFlags"] ensureContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__=29") + ensureContains(t, mylibCFlags, "-D__ANDROID_APEX_MIN_SDK_VERSION__=29") ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__") // When a cc_library sets use_apex_name_macro: true each apex gets a unique variant and @@ -2864,10 +2864,10 @@ func TestMacro(t *testing.T) { ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__") ensureContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__") - // recovery variant does not set __ANDROID_SDK_VERSION__ + // recovery variant does not set __ANDROID_APEX_MIN_SDK_VERSION__ mylibCFlags = ctx.ModuleForTests("mylib3", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"] ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureNotContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__") + ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MIN_SDK_VERSION__") // When a dependency of a cc_library sets use_apex_name_macro: true each apex gets a unique // variant. @@ -2888,10 +2888,10 @@ func TestMacro(t *testing.T) { ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MYAPEX__") ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_OTHERAPEX__") - // recovery variant does not set __ANDROID_SDK_VERSION__ + // recovery variant does not set __ANDROID_APEX_MIN_SDK_VERSION__ mylibCFlags = ctx.ModuleForTests("mylib2", "android_recovery_arm64_armv8-a_static").Rule("cc").Args["cFlags"] ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX__") - ensureNotContains(t, mylibCFlags, "-D__ANDROID_SDK_VERSION__") + ensureNotContains(t, mylibCFlags, "-D__ANDROID_APEX_MIN_SDK_VERSION__") } func TestHeaderLibsDependency(t *testing.T) { diff --git a/cc/compiler.go b/cc/compiler.go index f71dccab6..b78bb6ce9 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -366,7 +366,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps } if ctx.Device() { flags.Global.CommonFlags = append(flags.Global.CommonFlags, - fmt.Sprintf("-D__ANDROID_SDK_VERSION__=%d", + fmt.Sprintf("-D__ANDROID_APEX_MIN_SDK_VERSION__=%d", ctx.apexSdkVersion().FinalOrFutureInt())) } }