Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2019 The Android Open-Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
Roberto Perez | ceabe60 | 2019-09-26 10:21:24 -0700 | [diff] [blame] | 17 | # Generates one RRO for a given package. |
Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 18 | # $(1) target package name |
| 19 | # $(2) name of the RRO set (e.g. "base") |
| 20 | # $(3) resources folder |
| 21 | define generate-rro |
| 22 | include $$(CLEAR_VARS) |
| 23 | |
| 24 | rro_package_name := $(2)-$(subst .,-,$(1)) |
| 25 | LOCAL_RESOURCE_DIR := $(3) |
Roberto Perez | ceabe60 | 2019-09-26 10:21:24 -0700 | [diff] [blame] | 26 | LOCAL_RRO_THEME := $$(rro_package_name) |
Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 27 | LOCAL_PACKAGE_NAME := $$(rro_package_name) |
Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 28 | LOCAL_CERTIFICATE := platform |
| 29 | LOCAL_SDK_VERSION := current |
Roberto Perez | d4f5271 | 2019-10-04 11:00:40 -0700 | [diff] [blame] | 30 | LOCAL_USE_AAPT2 := true |
Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 31 | |
Cole Faust | ba9c8db | 2019-12-13 13:41:35 -0800 | [diff] [blame] | 32 | # Add --no-resource-deduping to prevent overlays to "values-port" with the same |
| 33 | # value as in "values" from being removed |
| 34 | LOCAL_AAPT_FLAGS := --no-resource-deduping |
| 35 | |
Roberto Perez | 982a075 | 2019-09-18 12:00:52 -0700 | [diff] [blame] | 36 | gen := $$(call intermediates-dir-for,ETC,$$(rro_package_name))/AndroidManifest.xml |
| 37 | $$(gen): $(LOCAL_PATH)/AndroidManifest.xml |
| 38 | @echo Generate $$@ |
| 39 | $$(hide) mkdir -p $$(dir $$@) |
| 40 | $$(hide) sed -e "s/{{TARGET_PACKAGE_NAME}}/$(1)/" \ |
| 41 | -e "s/{{RRO_PACKAGE_NAME}}/$(1).$(2).rro/" $$< > $$@ |
| 42 | LOCAL_FULL_MANIFEST_FILE := $$(gen) |
| 43 | |
| 44 | include $$(BUILD_RRO_PACKAGE) |
| 45 | endef |
| 46 | |
| 47 | $(foreach t,\ |
| 48 | $(CAR_UI_RRO_TARGETS),\ |
| 49 | $(eval $(call generate-rro,$(t),$(CAR_UI_RRO_SET_NAME),$(CAR_UI_RESOURCE_DIR)))) |
| 50 | |
| 51 | # Clear variables |
| 52 | CAR_UI_RRO_SET_NAME := |
| 53 | CAR_UI_RESOURCE_DIR := |
| 54 | CAR_UI_RRO_TARGETS := |