Add `aapt_include_all_resources`

The equivalent of Make's LOCAL_AAPT_INCLUDE_ALL_RESOURCES.

Test: build LatinIME with Soong
Change-Id: Ib76bea5f28e365b59fa9477b9bceabb84012ff8e
This commit is contained in:
Dan Willemsen 2018-10-24 20:24:57 -07:00 committed by Colin Cross
parent 000b4d1abf
commit 72be5901eb
3 changed files with 32 additions and 25 deletions

View File

@ -161,24 +161,25 @@ func init() {
addStandardProperties(bpparser.BoolType,
map[string]string{
// Bool properties
"LOCAL_IS_HOST_MODULE": "host",
"LOCAL_CLANG": "clang",
"LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
"LOCAL_NATIVE_COVERAGE": "native_coverage",
"LOCAL_NO_CRT": "nocrt",
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
"LOCAL_RTTI_FLAG": "rtti",
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
"LOCAL_TIDY": "tidy",
"LOCAL_USE_CLANG_LLD": "use_clang_lld",
"LOCAL_PROPRIETARY_MODULE": "proprietary",
"LOCAL_VENDOR_MODULE": "vendor",
"LOCAL_ODM_MODULE": "device_specific",
"LOCAL_PRODUCT_MODULE": "product_specific",
"LOCAL_PRODUCT_SERVICES_MODULE": "product_services_specific",
"LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
"LOCAL_PRIVILEGED_MODULE": "privileged",
"LOCAL_IS_HOST_MODULE": "host",
"LOCAL_CLANG": "clang",
"LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
"LOCAL_NATIVE_COVERAGE": "native_coverage",
"LOCAL_NO_CRT": "nocrt",
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
"LOCAL_RTTI_FLAG": "rtti",
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
"LOCAL_TIDY": "tidy",
"LOCAL_USE_CLANG_LLD": "use_clang_lld",
"LOCAL_PROPRIETARY_MODULE": "proprietary",
"LOCAL_VENDOR_MODULE": "vendor",
"LOCAL_ODM_MODULE": "device_specific",
"LOCAL_PRODUCT_MODULE": "product_specific",
"LOCAL_PRODUCT_SERVICES_MODULE": "product_services_specific",
"LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
"LOCAL_PRIVILEGED_MODULE": "privileged",
"LOCAL_AAPT_INCLUDE_ALL_RESOURCES": "aapt_include_all_resources",
"LOCAL_DEX_PREOPT": "dex_preopt.enabled",
"LOCAL_DEX_PREOPT_APP_IMAGE": "dex_preopt.app_image",

View File

@ -47,6 +47,10 @@ type aaptProperties struct {
// flags passed to aapt when creating the apk
Aaptflags []string
// include all resource configurations, not just the product-configured
// ones.
Aapt_include_all_resources *bool
// list of directories relative to the Blueprints file containing assets.
// Defaults to "assets"
Asset_dirs []string

View File

@ -194,14 +194,16 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
linkFlags = append(linkFlags, "--product", ctx.Config().ProductAAPTCharacteristics())
}
// Product AAPT config
for _, aaptConfig := range ctx.Config().ProductAAPTConfig() {
linkFlags = append(linkFlags, "-c", aaptConfig)
}
if !Bool(a.aaptProperties.Aapt_include_all_resources) {
// Product AAPT config
for _, aaptConfig := range ctx.Config().ProductAAPTConfig() {
linkFlags = append(linkFlags, "-c", aaptConfig)
}
// Product AAPT preferred config
if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 {
linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig())
// Product AAPT preferred config
if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 {
linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig())
}
}
// TODO: LOCAL_PACKAGE_OVERRIDES