Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 1 | // Copyright 2020 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
Colin Cross | d079e0b | 2022-08-16 10:27:33 -0700 | [diff] [blame] | 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package cc |
| 15 | |
| 16 | // This file contains image variant related things, including image mutator functions, utility |
| 17 | // functions to determine where a module is installed, etc. |
| 18 | |
| 19 | import ( |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 20 | "fmt" |
| 21 | "reflect" |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 22 | "strings" |
| 23 | |
| 24 | "android/soong/android" |
Jooyung Han | 85707de | 2023-12-01 14:21:13 +0900 | [diff] [blame] | 25 | |
| 26 | "github.com/google/blueprint/proptools" |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 27 | ) |
| 28 | |
| 29 | var _ android.ImageInterface = (*Module)(nil) |
| 30 | |
Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 31 | type ImageVariantType string |
Inseob Kim | 74d2556 | 2020-08-04 00:41:38 +0900 | [diff] [blame] | 32 | |
| 33 | const ( |
Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 34 | coreImageVariant ImageVariantType = "core" |
| 35 | vendorImageVariant ImageVariantType = "vendor" |
| 36 | productImageVariant ImageVariantType = "product" |
| 37 | ramdiskImageVariant ImageVariantType = "ramdisk" |
| 38 | vendorRamdiskImageVariant ImageVariantType = "vendor_ramdisk" |
| 39 | recoveryImageVariant ImageVariantType = "recovery" |
| 40 | hostImageVariant ImageVariantType = "host" |
Inseob Kim | 74d2556 | 2020-08-04 00:41:38 +0900 | [diff] [blame] | 41 | ) |
| 42 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 43 | const ( |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 44 | // VendorVariation is the variant name used for /vendor code that does not |
| 45 | // compile against the VNDK. |
| 46 | VendorVariation = "vendor" |
| 47 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 48 | // VendorVariationPrefix is the variant prefix used for /vendor code that compiles |
| 49 | // against the VNDK. |
| 50 | VendorVariationPrefix = "vendor." |
| 51 | |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 52 | // ProductVariation is the variant name used for /product code that does not |
| 53 | // compile against the VNDK. |
| 54 | ProductVariation = "product" |
| 55 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 56 | // ProductVariationPrefix is the variant prefix used for /product code that compiles |
| 57 | // against the VNDK. |
| 58 | ProductVariationPrefix = "product." |
| 59 | ) |
| 60 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 61 | func (ctx *moduleContextImpl) inProduct() bool { |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 62 | return ctx.mod.InProduct() |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | func (ctx *moduleContextImpl) inVendor() bool { |
Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 66 | return ctx.mod.InVendor() |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | func (ctx *moduleContextImpl) inRamdisk() bool { |
| 70 | return ctx.mod.InRamdisk() |
| 71 | } |
| 72 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 73 | func (ctx *moduleContextImpl) inVendorRamdisk() bool { |
| 74 | return ctx.mod.InVendorRamdisk() |
| 75 | } |
| 76 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 77 | func (ctx *moduleContextImpl) inRecovery() bool { |
| 78 | return ctx.mod.InRecovery() |
| 79 | } |
| 80 | |
Colin Cross | ea30d85 | 2023-11-29 16:00:16 -0800 | [diff] [blame] | 81 | func (c *Module) InstallInProduct() bool { |
Justin Yun | 7f99ec7 | 2021-04-12 13:19:28 +0900 | [diff] [blame] | 82 | // Additionally check if this module is inProduct() that means it is a "product" variant of a |
| 83 | // module. As well as product specific modules, product variants must be installed to /product. |
| 84 | return c.InProduct() |
| 85 | } |
| 86 | |
Colin Cross | ea30d85 | 2023-11-29 16:00:16 -0800 | [diff] [blame] | 87 | func (c *Module) InstallInVendor() bool { |
Justin Yun | 7f99ec7 | 2021-04-12 13:19:28 +0900 | [diff] [blame] | 88 | // Additionally check if this module is inVendor() that means it is a "vendor" variant of a |
| 89 | // module. As well as SoC specific modules, vendor variants must be installed to /vendor |
| 90 | // unless they have "odm_available: true". |
| 91 | return c.HasVendorVariant() && c.InVendor() && !c.VendorVariantToOdm() |
| 92 | } |
| 93 | |
Colin Cross | ea30d85 | 2023-11-29 16:00:16 -0800 | [diff] [blame] | 94 | func (c *Module) InstallInOdm() bool { |
Justin Yun | 7f99ec7 | 2021-04-12 13:19:28 +0900 | [diff] [blame] | 95 | // Some vendor variants want to be installed to /odm by setting "odm_available: true". |
| 96 | return c.InVendor() && c.VendorVariantToOdm() |
| 97 | } |
| 98 | |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 99 | // Returns true when this module is configured to have core and vendor variants. |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 100 | func (c *Module) HasVendorVariant() bool { |
Justin Yun | ebcf0c5 | 2021-01-08 18:00:19 +0900 | [diff] [blame] | 101 | return Bool(c.VendorProperties.Vendor_available) || Bool(c.VendorProperties.Odm_available) |
| 102 | } |
| 103 | |
| 104 | // Returns true when this module creates a vendor variant and wants to install the vendor variant |
| 105 | // to the odm partition. |
| 106 | func (c *Module) VendorVariantToOdm() bool { |
| 107 | return Bool(c.VendorProperties.Odm_available) |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 108 | } |
| 109 | |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 110 | // Returns true when this module is configured to have core and product variants. |
| 111 | func (c *Module) HasProductVariant() bool { |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 112 | return Bool(c.VendorProperties.Product_available) |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | // Returns true when this module is configured to have core and either product or vendor variants. |
| 116 | func (c *Module) HasNonSystemVariants() bool { |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 117 | return c.HasVendorVariant() || c.HasProductVariant() |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 118 | } |
| 119 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 120 | // Returns true if the module is "product" variant. Usually these modules are installed in /product |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 121 | func (c *Module) InProduct() bool { |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 122 | return c.Properties.ImageVariation == ProductVariation |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | // Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor |
Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 126 | func (c *Module) InVendor() bool { |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 127 | return c.Properties.ImageVariation == VendorVariation |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 128 | } |
| 129 | |
Kiyoung Kim | aa39480 | 2024-01-08 12:55:45 +0900 | [diff] [blame] | 130 | // Returns true if the module is "vendor" or "product" variant. This replaces previous UseVndk usages |
| 131 | // which were misused to check if the module variant is vendor or product. |
| 132 | func (c *Module) InVendorOrProduct() bool { |
| 133 | return c.InVendor() || c.InProduct() |
| 134 | } |
| 135 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 136 | func (c *Module) InRamdisk() bool { |
| 137 | return c.ModuleBase.InRamdisk() || c.ModuleBase.InstallInRamdisk() |
| 138 | } |
| 139 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 140 | func (c *Module) InVendorRamdisk() bool { |
| 141 | return c.ModuleBase.InVendorRamdisk() || c.ModuleBase.InstallInVendorRamdisk() |
| 142 | } |
| 143 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 144 | func (c *Module) InRecovery() bool { |
| 145 | return c.ModuleBase.InRecovery() || c.ModuleBase.InstallInRecovery() |
| 146 | } |
| 147 | |
| 148 | func (c *Module) OnlyInRamdisk() bool { |
| 149 | return c.ModuleBase.InstallInRamdisk() |
| 150 | } |
| 151 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 152 | func (c *Module) OnlyInVendorRamdisk() bool { |
| 153 | return c.ModuleBase.InstallInVendorRamdisk() |
| 154 | } |
| 155 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 156 | func (c *Module) OnlyInRecovery() bool { |
| 157 | return c.ModuleBase.InstallInRecovery() |
| 158 | } |
| 159 | |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 160 | func visitPropsAndCompareVendorAndProductProps(v reflect.Value) bool { |
| 161 | if v.Kind() != reflect.Struct { |
| 162 | return true |
| 163 | } |
| 164 | for i := 0; i < v.NumField(); i++ { |
| 165 | prop := v.Field(i) |
| 166 | if prop.Kind() == reflect.Struct && v.Type().Field(i).Name == "Target" { |
| 167 | vendor_prop := prop.FieldByName("Vendor") |
| 168 | product_prop := prop.FieldByName("Product") |
| 169 | if vendor_prop.Kind() != reflect.Struct && product_prop.Kind() != reflect.Struct { |
| 170 | // Neither Target.Vendor nor Target.Product is defined |
| 171 | continue |
| 172 | } |
| 173 | if vendor_prop.Kind() != reflect.Struct || product_prop.Kind() != reflect.Struct || |
| 174 | !reflect.DeepEqual(vendor_prop.Interface(), product_prop.Interface()) { |
| 175 | // If only one of either Target.Vendor or Target.Product is |
| 176 | // defined or they have different values, it fails the build |
| 177 | // since VNDK must have the same properties for both vendor |
| 178 | // and product variants. |
| 179 | return false |
| 180 | } |
| 181 | } else if !visitPropsAndCompareVendorAndProductProps(prop) { |
| 182 | // Visit the substructures to find Target.Vendor and Target.Product |
| 183 | return false |
| 184 | } |
| 185 | } |
| 186 | return true |
| 187 | } |
| 188 | |
| 189 | // In the case of VNDK, vendor and product variants must have the same properties. |
| 190 | // VNDK installs only one file and shares it for both vendor and product modules on |
| 191 | // runtime. We may not define different versions of a VNDK lib for each partition. |
| 192 | // This function is used only for the VNDK modules that is available to both vendor |
| 193 | // and product partitions. |
| 194 | func (c *Module) compareVendorAndProductProps() bool { |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 195 | if !c.IsVndk() && !Bool(c.VendorProperties.Product_available) { |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 196 | panic(fmt.Errorf("This is only for product available VNDK libs. %q is not a VNDK library or not product available", c.Name())) |
| 197 | } |
| 198 | for _, properties := range c.GetProperties() { |
| 199 | if !visitPropsAndCompareVendorAndProductProps(reflect.ValueOf(properties).Elem()) { |
| 200 | return false |
| 201 | } |
| 202 | } |
| 203 | return true |
| 204 | } |
| 205 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 206 | // ImageMutatableModule provides a common image mutation interface for LinkableInterface modules. |
| 207 | type ImageMutatableModule interface { |
| 208 | android.Module |
| 209 | LinkableInterface |
| 210 | |
| 211 | // AndroidModuleBase returns the android.ModuleBase for this module |
| 212 | AndroidModuleBase() *android.ModuleBase |
| 213 | |
| 214 | // VendorAvailable returns true if this module is available on the vendor image. |
| 215 | VendorAvailable() bool |
| 216 | |
| 217 | // OdmAvailable returns true if this module is available on the odm image. |
| 218 | OdmAvailable() bool |
| 219 | |
| 220 | // ProductAvailable returns true if this module is available on the product image. |
| 221 | ProductAvailable() bool |
| 222 | |
| 223 | // RamdiskAvailable returns true if this module is available on the ramdisk image. |
| 224 | RamdiskAvailable() bool |
| 225 | |
| 226 | // RecoveryAvailable returns true if this module is available on the recovery image. |
| 227 | RecoveryAvailable() bool |
| 228 | |
| 229 | // VendorRamdiskAvailable returns true if this module is available on the vendor ramdisk image. |
| 230 | VendorRamdiskAvailable() bool |
| 231 | |
| 232 | // IsSnapshotPrebuilt returns true if this module is a snapshot prebuilt. |
| 233 | IsSnapshotPrebuilt() bool |
| 234 | |
| 235 | // SnapshotVersion returns the snapshot version for this module. |
| 236 | SnapshotVersion(mctx android.BaseModuleContext) string |
| 237 | |
| 238 | // SdkVersion returns the SDK version for this module. |
| 239 | SdkVersion() string |
| 240 | |
| 241 | // ExtraVariants returns the list of extra variants this module requires. |
| 242 | ExtraVariants() []string |
| 243 | |
| 244 | // AppendExtraVariant returns an extra variant to the list of extra variants this module requires. |
| 245 | AppendExtraVariant(extraVariant string) |
| 246 | |
| 247 | // SetRamdiskVariantNeeded sets whether the Ramdisk Variant is needed. |
| 248 | SetRamdiskVariantNeeded(b bool) |
| 249 | |
| 250 | // SetVendorRamdiskVariantNeeded sets whether the Vendor Ramdisk Variant is needed. |
| 251 | SetVendorRamdiskVariantNeeded(b bool) |
| 252 | |
| 253 | // SetRecoveryVariantNeeded sets whether the Recovery Variant is needed. |
| 254 | SetRecoveryVariantNeeded(b bool) |
| 255 | |
| 256 | // SetCoreVariantNeeded sets whether the Core Variant is needed. |
| 257 | SetCoreVariantNeeded(b bool) |
| 258 | } |
| 259 | |
| 260 | var _ ImageMutatableModule = (*Module)(nil) |
| 261 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 262 | func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) { |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 263 | m.CheckVndkProperties(mctx) |
| 264 | MutateImage(mctx, m) |
| 265 | } |
| 266 | |
| 267 | // CheckVndkProperties checks whether the VNDK-related properties are set correctly. |
| 268 | // If properties are not set correctly, results in a module context property error. |
| 269 | func (m *Module) CheckVndkProperties(mctx android.BaseModuleContext) { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 270 | vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific() |
| 271 | productSpecific := mctx.ProductSpecific() |
| 272 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 273 | if vndkdep := m.vndkdep; vndkdep != nil { |
| 274 | if vndkdep.isVndk() { |
| 275 | if vendorSpecific || productSpecific { |
| 276 | if !vndkdep.isVndkExt() { |
| 277 | mctx.PropertyErrorf("vndk", |
| 278 | "must set `extends: \"...\"` to vndk extension") |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 279 | } else if Bool(m.VendorProperties.Vendor_available) { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 280 | mctx.PropertyErrorf("vendor_available", |
| 281 | "must not set at the same time as `vndk: {extends: \"...\"}`") |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 282 | } else if Bool(m.VendorProperties.Product_available) { |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 283 | mctx.PropertyErrorf("product_available", |
| 284 | "must not set at the same time as `vndk: {extends: \"...\"}`") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 285 | } |
| 286 | } else { |
| 287 | if vndkdep.isVndkExt() { |
| 288 | mctx.PropertyErrorf("vndk", |
| 289 | "must set `vendor: true` or `product_specific: true` to set `extends: %q`", |
| 290 | m.getVndkExtendsModuleName()) |
| 291 | } |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 292 | if !Bool(m.VendorProperties.Vendor_available) { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 293 | mctx.PropertyErrorf("vndk", |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 294 | "vendor_available must be set to true when `vndk: {enabled: true}`") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 295 | } |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 296 | if Bool(m.VendorProperties.Product_available) { |
Justin Yun | fd9e804 | 2020-12-23 18:23:14 +0900 | [diff] [blame] | 297 | // If a VNDK module creates both product and vendor variants, they |
| 298 | // must have the same properties since they share a single VNDK |
| 299 | // library on runtime. |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 300 | if !m.compareVendorAndProductProps() { |
| 301 | mctx.ModuleErrorf("product properties must have the same values with the vendor properties for VNDK modules") |
| 302 | } |
| 303 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 304 | } |
| 305 | } else { |
| 306 | if vndkdep.isVndkSp() { |
| 307 | mctx.PropertyErrorf("vndk", |
| 308 | "must set `enabled: true` to set `support_system_process: true`") |
| 309 | } |
| 310 | if vndkdep.isVndkExt() { |
| 311 | mctx.PropertyErrorf("vndk", |
| 312 | "must set `enabled: true` to set `extends: %q`", |
| 313 | m.getVndkExtendsModuleName()) |
| 314 | } |
| 315 | } |
| 316 | } |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | func (m *Module) VendorAvailable() bool { |
| 320 | return Bool(m.VendorProperties.Vendor_available) |
| 321 | } |
| 322 | |
| 323 | func (m *Module) OdmAvailable() bool { |
| 324 | return Bool(m.VendorProperties.Odm_available) |
| 325 | } |
| 326 | |
| 327 | func (m *Module) ProductAvailable() bool { |
| 328 | return Bool(m.VendorProperties.Product_available) |
| 329 | } |
| 330 | |
| 331 | func (m *Module) RamdiskAvailable() bool { |
| 332 | return Bool(m.Properties.Ramdisk_available) |
| 333 | } |
| 334 | |
| 335 | func (m *Module) VendorRamdiskAvailable() bool { |
| 336 | return Bool(m.Properties.Vendor_ramdisk_available) |
| 337 | } |
| 338 | |
| 339 | func (m *Module) AndroidModuleBase() *android.ModuleBase { |
| 340 | return &m.ModuleBase |
| 341 | } |
| 342 | |
| 343 | func (m *Module) RecoveryAvailable() bool { |
| 344 | return Bool(m.Properties.Recovery_available) |
| 345 | } |
| 346 | |
| 347 | func (m *Module) ExtraVariants() []string { |
Lukacs T. Berki | 2f5c340 | 2021-06-15 11:27:56 +0200 | [diff] [blame] | 348 | return m.Properties.ExtraVersionedImageVariations |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | func (m *Module) AppendExtraVariant(extraVariant string) { |
Lukacs T. Berki | 2f5c340 | 2021-06-15 11:27:56 +0200 | [diff] [blame] | 352 | m.Properties.ExtraVersionedImageVariations = append(m.Properties.ExtraVersionedImageVariations, extraVariant) |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | func (m *Module) SetRamdiskVariantNeeded(b bool) { |
| 356 | m.Properties.RamdiskVariantNeeded = b |
| 357 | } |
| 358 | |
| 359 | func (m *Module) SetVendorRamdiskVariantNeeded(b bool) { |
| 360 | m.Properties.VendorRamdiskVariantNeeded = b |
| 361 | } |
| 362 | |
| 363 | func (m *Module) SetRecoveryVariantNeeded(b bool) { |
| 364 | m.Properties.RecoveryVariantNeeded = b |
| 365 | } |
| 366 | |
| 367 | func (m *Module) SetCoreVariantNeeded(b bool) { |
| 368 | m.Properties.CoreVariantNeeded = b |
| 369 | } |
| 370 | |
| 371 | func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string { |
Ivan Lozano | d1dec54 | 2021-05-26 15:33:11 -0400 | [diff] [blame] | 372 | if snapshot, ok := m.linker.(SnapshotInterface); ok { |
| 373 | return snapshot.Version() |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 374 | } else { |
| 375 | mctx.ModuleErrorf("version is unknown for snapshot prebuilt") |
| 376 | // Should we be panicking here instead? |
| 377 | return "" |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | func (m *Module) KernelHeadersDecorator() bool { |
| 382 | if _, ok := m.linker.(*kernelHeadersDecorator); ok { |
| 383 | return true |
| 384 | } |
| 385 | return false |
| 386 | } |
| 387 | |
| 388 | // MutateImage handles common image mutations for ImageMutatableModule interfaces. |
| 389 | func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) { |
| 390 | // Validation check |
| 391 | vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific() |
| 392 | productSpecific := mctx.ProductSpecific() |
| 393 | |
| 394 | if m.VendorAvailable() { |
| 395 | if vendorSpecific { |
| 396 | mctx.PropertyErrorf("vendor_available", |
| 397 | "doesn't make sense at the same time as `vendor: true`, `proprietary: true`, or `device_specific: true`") |
| 398 | } |
| 399 | if m.OdmAvailable() { |
| 400 | mctx.PropertyErrorf("vendor_available", |
| 401 | "doesn't make sense at the same time as `odm_available: true`") |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | if m.OdmAvailable() { |
| 406 | if vendorSpecific { |
| 407 | mctx.PropertyErrorf("odm_available", |
| 408 | "doesn't make sense at the same time as `vendor: true`, `proprietary: true`, or `device_specific: true`") |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | if m.ProductAvailable() { |
| 413 | if productSpecific { |
| 414 | mctx.PropertyErrorf("product_available", |
| 415 | "doesn't make sense at the same time as `product_specific: true`") |
| 416 | } |
| 417 | if vendorSpecific { |
| 418 | mctx.PropertyErrorf("product_available", |
| 419 | "cannot provide product variant from a vendor module. Please use `product_specific: true` with `vendor_available: true`") |
| 420 | } |
| 421 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 422 | |
| 423 | var coreVariantNeeded bool = false |
| 424 | var ramdiskVariantNeeded bool = false |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 425 | var vendorRamdiskVariantNeeded bool = false |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 426 | var recoveryVariantNeeded bool = false |
| 427 | |
| 428 | var vendorVariants []string |
| 429 | var productVariants []string |
| 430 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 431 | needVndkVersionVendorVariantForLlndk := false |
Kiyoung Kim | 4e765b1 | 2024-04-04 17:33:42 +0900 | [diff] [blame] | 432 | |
Colin Cross | 203b421 | 2021-04-26 17:19:41 -0700 | [diff] [blame] | 433 | if m.NeedsLlndkVariants() { |
Colin Cross | b5f6fa6 | 2021-01-06 17:05:04 -0800 | [diff] [blame] | 434 | // This is an LLNDK library. The implementation of the library will be on /system, |
| 435 | // and vendor and product variants will be created with LLNDK stubs. |
| 436 | // The LLNDK libraries need vendor variants even if there is no VNDK. |
Colin Cross | 203b421 | 2021-04-26 17:19:41 -0700 | [diff] [blame] | 437 | coreVariantNeeded = true |
Kiyoung Kim | fa13ff1 | 2024-03-18 16:01:19 +0900 | [diff] [blame] | 438 | vendorVariants = append(vendorVariants, "") |
| 439 | productVariants = append(productVariants, "") |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 440 | // Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not |
| 441 | // provide the LLNDK stub libraries. |
| 442 | if needVndkVersionVendorVariantForLlndk { |
Kiyoung Kim | 4e765b1 | 2024-04-04 17:33:42 +0900 | [diff] [blame] | 443 | vendorVariants = append(vendorVariants, "") |
Colin Cross | b5f6fa6 | 2021-01-06 17:05:04 -0800 | [diff] [blame] | 444 | } |
Colin Cross | 5271fea | 2021-04-27 13:06:04 -0700 | [diff] [blame] | 445 | } else if m.NeedsVendorPublicLibraryVariants() { |
| 446 | // A vendor public library has the implementation on /vendor, with stub variants |
| 447 | // for system and product. |
| 448 | coreVariantNeeded = true |
Kiyoung Kim | 4e765b1 | 2024-04-04 17:33:42 +0900 | [diff] [blame] | 449 | vendorVariants = append(vendorVariants, "") |
Kiyoung Kim | fa13ff1 | 2024-03-18 16:01:19 +0900 | [diff] [blame] | 450 | productVariants = append(productVariants, "") |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 451 | } else if m.IsSnapshotPrebuilt() { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 452 | // Make vendor variants only for the versions in BOARD_VNDK_VERSION and |
| 453 | // PRODUCT_EXTRA_VNDK_VERSIONS. |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 454 | if m.InstallInRecovery() { |
| 455 | recoveryVariantNeeded = true |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 456 | } else { |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 457 | vendorVariants = append(vendorVariants, m.SnapshotVersion(mctx)) |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 458 | } |
Ivan Lozano | f9e2172 | 2020-12-02 09:00:51 -0500 | [diff] [blame] | 459 | } else if m.HasNonSystemVariants() && !m.IsVndkExt() { |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 460 | // This will be available to /system unless it is product_specific |
| 461 | // which will be handled later. |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 462 | coreVariantNeeded = true |
| 463 | |
| 464 | // We assume that modules under proprietary paths are compatible for |
| 465 | // BOARD_VNDK_VERSION. The other modules are regarded as AOSP, or |
| 466 | // PLATFORM_VNDK_VERSION. |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 467 | if m.HasVendorVariant() { |
Kiyoung Kim | 37693d0 | 2024-04-04 09:56:15 +0900 | [diff] [blame] | 468 | vendorVariants = append(vendorVariants, "") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 469 | } |
| 470 | |
Justin Yun | 6977e8a | 2020-10-29 18:24:11 +0900 | [diff] [blame] | 471 | // product_available modules are available to /product. |
| 472 | if m.HasProductVariant() { |
Kiyoung Kim | fa13ff1 | 2024-03-18 16:01:19 +0900 | [diff] [blame] | 473 | productVariants = append(productVariants, "") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 474 | } |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 475 | } else if vendorSpecific && m.SdkVersion() == "" { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 476 | // This will be available in /vendor (or /odm) only |
Kiyoung Kim | 4e765b1 | 2024-04-04 17:33:42 +0900 | [diff] [blame] | 477 | vendorVariants = append(vendorVariants, "") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 478 | } else { |
| 479 | // This is either in /system (or similar: /data), or is a |
jiajia tang | cd1c27b | 2022-07-21 18:04:37 +0800 | [diff] [blame] | 480 | // module built with the NDK. Modules built with the NDK |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 481 | // will be restricted using the existing link type checks. |
| 482 | coreVariantNeeded = true |
| 483 | } |
| 484 | |
Justin Yun | af1fde4 | 2023-09-27 16:22:10 +0900 | [diff] [blame] | 485 | if coreVariantNeeded && productSpecific && m.SdkVersion() == "" { |
| 486 | // The module has "product_specific: true" that does not create core variant. |
| 487 | coreVariantNeeded = false |
Kiyoung Kim | fa13ff1 | 2024-03-18 16:01:19 +0900 | [diff] [blame] | 488 | productVariants = append(productVariants, "") |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 489 | } |
| 490 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 491 | if m.RamdiskAvailable() { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 492 | ramdiskVariantNeeded = true |
| 493 | } |
| 494 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 495 | if m.AndroidModuleBase().InstallInRamdisk() { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 496 | ramdiskVariantNeeded = true |
| 497 | coreVariantNeeded = false |
| 498 | } |
| 499 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 500 | if m.VendorRamdiskAvailable() { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 501 | vendorRamdiskVariantNeeded = true |
| 502 | } |
| 503 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 504 | if m.AndroidModuleBase().InstallInVendorRamdisk() { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 505 | vendorRamdiskVariantNeeded = true |
| 506 | coreVariantNeeded = false |
| 507 | } |
| 508 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 509 | if m.RecoveryAvailable() { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 510 | recoveryVariantNeeded = true |
| 511 | } |
| 512 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 513 | if m.AndroidModuleBase().InstallInRecovery() { |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 514 | recoveryVariantNeeded = true |
| 515 | coreVariantNeeded = false |
| 516 | } |
| 517 | |
| 518 | for _, variant := range android.FirstUniqueStrings(vendorVariants) { |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 519 | if variant == "" { |
| 520 | m.AppendExtraVariant(VendorVariation) |
| 521 | } else { |
| 522 | m.AppendExtraVariant(VendorVariationPrefix + variant) |
| 523 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | for _, variant := range android.FirstUniqueStrings(productVariants) { |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 527 | if variant == "" { |
| 528 | m.AppendExtraVariant(ProductVariation) |
| 529 | } else { |
| 530 | m.AppendExtraVariant(ProductVariationPrefix + variant) |
| 531 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 532 | } |
| 533 | |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 534 | m.SetRamdiskVariantNeeded(ramdiskVariantNeeded) |
| 535 | m.SetVendorRamdiskVariantNeeded(vendorRamdiskVariantNeeded) |
| 536 | m.SetRecoveryVariantNeeded(recoveryVariantNeeded) |
| 537 | m.SetCoreVariantNeeded(coreVariantNeeded) |
Jose Galmes | 6f843bc | 2020-12-11 13:36:29 -0800 | [diff] [blame] | 538 | |
| 539 | // Disable the module if no variants are needed. |
| 540 | if !ramdiskVariantNeeded && |
| 541 | !recoveryVariantNeeded && |
| 542 | !coreVariantNeeded && |
Ivan Lozano | 3a7d000 | 2021-03-30 12:19:36 -0400 | [diff] [blame] | 543 | len(m.ExtraVariants()) == 0 { |
Jose Galmes | 6f843bc | 2020-12-11 13:36:29 -0800 | [diff] [blame] | 544 | m.Disable() |
| 545 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | func (c *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool { |
| 549 | return c.Properties.CoreVariantNeeded |
| 550 | } |
| 551 | |
| 552 | func (c *Module) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 553 | return c.Properties.RamdiskVariantNeeded |
| 554 | } |
| 555 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 556 | func (c *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 557 | return c.Properties.VendorRamdiskVariantNeeded |
| 558 | } |
| 559 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 560 | func (c *Module) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 561 | return false |
| 562 | } |
| 563 | |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 564 | func (c *Module) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { |
| 565 | return c.Properties.RecoveryVariantNeeded |
| 566 | } |
| 567 | |
| 568 | func (c *Module) ExtraImageVariations(ctx android.BaseModuleContext) []string { |
Lukacs T. Berki | 2f5c340 | 2021-06-15 11:27:56 +0200 | [diff] [blame] | 569 | return c.Properties.ExtraVersionedImageVariations |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 570 | } |
| 571 | |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 572 | func squashVendorSrcs(m *Module) { |
| 573 | if lib, ok := m.compiler.(*libraryDecorator); ok { |
| 574 | lib.baseCompiler.Properties.Srcs = append(lib.baseCompiler.Properties.Srcs, |
| 575 | lib.baseCompiler.Properties.Target.Vendor.Srcs...) |
| 576 | |
| 577 | lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, |
| 578 | lib.baseCompiler.Properties.Target.Vendor.Exclude_srcs...) |
| 579 | |
| 580 | lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources, |
| 581 | lib.baseCompiler.Properties.Target.Vendor.Exclude_generated_sources...) |
Jooyung Han | 85707de | 2023-12-01 14:21:13 +0900 | [diff] [blame] | 582 | |
| 583 | if lib.Properties.Target.Vendor.No_stubs { |
| 584 | proptools.Clear(&lib.Properties.Stubs) |
| 585 | } |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 586 | } |
| 587 | } |
| 588 | |
| 589 | func squashProductSrcs(m *Module) { |
| 590 | if lib, ok := m.compiler.(*libraryDecorator); ok { |
| 591 | lib.baseCompiler.Properties.Srcs = append(lib.baseCompiler.Properties.Srcs, |
| 592 | lib.baseCompiler.Properties.Target.Product.Srcs...) |
| 593 | |
| 594 | lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, |
| 595 | lib.baseCompiler.Properties.Target.Product.Exclude_srcs...) |
| 596 | |
| 597 | lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources, |
| 598 | lib.baseCompiler.Properties.Target.Product.Exclude_generated_sources...) |
Jooyung Han | 85707de | 2023-12-01 14:21:13 +0900 | [diff] [blame] | 599 | |
| 600 | if lib.Properties.Target.Product.No_stubs { |
| 601 | proptools.Clear(&lib.Properties.Stubs) |
| 602 | } |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 603 | } |
| 604 | } |
| 605 | |
| 606 | func squashRecoverySrcs(m *Module) { |
| 607 | if lib, ok := m.compiler.(*libraryDecorator); ok { |
| 608 | lib.baseCompiler.Properties.Srcs = append(lib.baseCompiler.Properties.Srcs, |
| 609 | lib.baseCompiler.Properties.Target.Recovery.Srcs...) |
| 610 | |
| 611 | lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, |
| 612 | lib.baseCompiler.Properties.Target.Recovery.Exclude_srcs...) |
| 613 | |
| 614 | lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources, |
| 615 | lib.baseCompiler.Properties.Target.Recovery.Exclude_generated_sources...) |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | func squashVendorRamdiskSrcs(m *Module) { |
| 620 | if lib, ok := m.compiler.(*libraryDecorator); ok { |
| 621 | lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, lib.baseCompiler.Properties.Target.Vendor_ramdisk.Exclude_srcs...) |
| 622 | } |
| 623 | } |
| 624 | |
Christopher Ferris | e0202c4 | 2023-07-27 17:06:46 -0700 | [diff] [blame] | 625 | func squashRamdiskSrcs(m *Module) { |
| 626 | if lib, ok := m.compiler.(*libraryDecorator); ok { |
| 627 | lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, lib.baseCompiler.Properties.Target.Ramdisk.Exclude_srcs...) |
| 628 | } |
| 629 | } |
| 630 | |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 631 | func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string) { |
Yifan Hong | 6da33c2 | 2020-10-27 15:01:21 -0700 | [diff] [blame] | 632 | if variant == android.RamdiskVariation { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 633 | c.MakeAsPlatform() |
| 634 | squashRamdiskSrcs(c) |
Yifan Hong | 6da33c2 | 2020-10-27 15:01:21 -0700 | [diff] [blame] | 635 | } else if variant == android.VendorRamdiskVariation { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 636 | c.MakeAsPlatform() |
| 637 | squashVendorRamdiskSrcs(c) |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 638 | } else if variant == android.RecoveryVariation { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 639 | c.MakeAsPlatform() |
| 640 | squashRecoverySrcs(c) |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 641 | } else if strings.HasPrefix(variant, VendorVariation) { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 642 | c.Properties.ImageVariation = VendorVariation |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 643 | |
| 644 | if strings.HasPrefix(variant, VendorVariationPrefix) { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 645 | c.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix) |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 646 | } |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 647 | squashVendorSrcs(c) |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 648 | } else if strings.HasPrefix(variant, ProductVariation) { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 649 | c.Properties.ImageVariation = ProductVariation |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 650 | if strings.HasPrefix(variant, ProductVariationPrefix) { |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 651 | c.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix) |
Kiyoung Kim | b5fdb2e | 2024-01-03 14:24:34 +0900 | [diff] [blame] | 652 | } |
Jihoon Kang | 7583e83 | 2024-06-13 21:25:45 +0000 | [diff] [blame^] | 653 | squashProductSrcs(c) |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 654 | } |
Colin Cross | 5271fea | 2021-04-27 13:06:04 -0700 | [diff] [blame] | 655 | |
| 656 | if c.NeedsVendorPublicLibraryVariants() && |
| 657 | (variant == android.CoreVariation || strings.HasPrefix(variant, ProductVariationPrefix)) { |
| 658 | c.VendorProperties.IsVendorPublicLibrary = true |
| 659 | } |
Inseob Kim | e498dd9 | 2020-08-04 09:24:04 +0900 | [diff] [blame] | 660 | } |