Support product variables

Allow modules to vary their properties based on product variables.
For now, DEVICE_USES_LOGD, DEVICE_USES_JEMALLOC, and DEVICE_USES_DLMALLOC,
and BOARD_MALLOC_ALIGNMENT are supported.

Product variables can provide a value (only bool and int supported for
now), and if any of the product variable properties contains a "%d"
then Sprintf will be called with the property value as the format
and the product variable value convert to an int as the only argument.

For example:

    product_variables: {
        dlmalloc_alignment: {
            cflags: ["-DMALLOC_ALIGNMENT=%d"],
        },
    },

will cause -DMALLOC_ALIGNMENT=16 to be added to any top level
properties called "cflags".

Change-Id: I74882a6ab4914d3e222f8d06cfac371b7b829ae5
This commit is contained in:
Colin Cross
2015-07-09 13:57:48 -07:00
parent 8f301d583f
commit 7f64b6de31
7 changed files with 375 additions and 114 deletions

View File

@@ -125,7 +125,7 @@ func InitAndroidModule(m AndroidModule,
base.module = m
base.extendedProperties = make(map[string]struct{})
propertyStructs = append(propertyStructs, &base.commonProperties)
propertyStructs = append(propertyStructs, &base.commonProperties, &base.variableProperties)
return m, propertyStructs
}
@@ -194,6 +194,7 @@ type AndroidModuleBase struct {
module AndroidModule
commonProperties commonProperties
variableProperties variableProperties
hostAndDeviceProperties hostAndDeviceProperties
generalProperties []interface{}
archProperties []*archProperties