summaryrefslogtreecommitdiff
path: root/cc/compiler.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-10-01 05:38:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-10-01 05:38:46 +0000
commite380697b98a2bc85644c033ffa9aed7d945702d0 (patch)
treee2ac1e742404e816844bafde4997eb212bc8a182 /cc/compiler.go
parentb730259a099c98be09793d2adde3e85f7c78d270 (diff)
parent791d422206fbc744fdbf021d9a03c9e7fff68e06 (diff)
Merge "Define __ANDROID_VENDOR_API__ for product variants" into main
Diffstat (limited to 'cc/compiler.go')
-rw-r--r--cc/compiler.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index 396ec886b..a6f623f5b 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -437,18 +437,20 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VNDK__")
if ctx.inVendor() {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR__")
-
- vendorApiLevel := ctx.Config().VendorApiLevel()
- if vendorApiLevel == "" {
- // TODO(b/314036847): This is a fallback for UDC targets.
- // This must be a build failure when UDC is no longer built
- // from this source tree.
- vendorApiLevel = ctx.Config().PlatformSdkVersion().String()
- }
- flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel)
} else if ctx.inProduct() {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_PRODUCT__")
}
+
+ // Define __ANDROID_VENDOR_API__ for both product and vendor variants
+ // because they both use the same LLNDK libraries.
+ vendorApiLevel := ctx.Config().VendorApiLevel()
+ if vendorApiLevel == "" {
+ // TODO(b/314036847): This is a fallback for UDC targets.
+ // This must be a build failure when UDC is no longer built
+ // from this source tree.
+ vendorApiLevel = ctx.Config().PlatformSdkVersion().String()
+ }
+ flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel)
}
if ctx.inRecovery() {