diff options
author | 2024-10-01 05:38:46 +0000 | |
---|---|---|
committer | 2024-10-01 05:38:46 +0000 | |
commit | e380697b98a2bc85644c033ffa9aed7d945702d0 (patch) | |
tree | e2ac1e742404e816844bafde4997eb212bc8a182 | |
parent | b730259a099c98be09793d2adde3e85f7c78d270 (diff) | |
parent | 791d422206fbc744fdbf021d9a03c9e7fff68e06 (diff) |
Merge "Define __ANDROID_VENDOR_API__ for product variants" into main
-rw-r--r-- | cc/compiler.go | 20 | ||||
-rw-r--r-- | rust/bindgen.go | 20 |
2 files changed, 22 insertions, 18 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() { diff --git a/rust/bindgen.go b/rust/bindgen.go index 31aa13725..abb51814e 100644 --- a/rust/bindgen.go +++ b/rust/bindgen.go @@ -198,18 +198,20 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr cflags = append(cflags, "-D__ANDROID_VNDK__") if ctx.RustModule().InVendor() { cflags = append(cflags, "-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() - } - cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.RustModule().InProduct() { cflags = append(cflags, "-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() + } + cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } if ctx.RustModule().InRecovery() { |