Assert that platform_sdk_codename is set
This is already the case for bazel. Soong should do the same.
Bug: 271277773
Test: m nothing
Change-Id: Ibb680801872bd04eade511e1a174cc629af80722
diff --git a/android/config.go b/android/config.go
index e0b661b..666e721 100644
--- a/android/config.go
+++ b/android/config.go
@@ -905,8 +905,16 @@
return c.PlatformSdkVersion()
}
codename := c.PlatformSdkCodename()
+ hostOnlyBuild := c.productVariables.DeviceArch == nil
if codename == "" {
- return NoneApiLevel
+ // There are some host-only builds (those are invoked by build-prebuilts.sh) which
+ // don't set platform sdk codename. Platform sdk codename makes sense only when we
+ // are building the platform. So we don't enforce the below panic for the host-only
+ // builds.
+ if hostOnlyBuild {
+ return NoneApiLevel
+ }
+ panic("Platform_sdk_codename must be set")
}
if codename == "REL" {
panic("Platform_sdk_codename should not be REL when Platform_sdk_final is true")