blob: 4f67520d077453cb719e26cd787e09fc003ea6d3 [file] [log] [blame]
Roberto Perez982a0752019-09-18 12:00:52 -07001#
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 Perezceabe602019-09-26 10:21:24 -070017# Generates one RRO for a given package.
Roberto Perez982a0752019-09-18 12:00:52 -070018# $(1) target package name
19# $(2) name of the RRO set (e.g. "base")
20# $(3) resources folder
21define generate-rro
22 include $$(CLEAR_VARS)
23
24 rro_package_name := $(2)-$(subst .,-,$(1))
25 LOCAL_RESOURCE_DIR := $(3)
Roberto Perezceabe602019-09-26 10:21:24 -070026 LOCAL_RRO_THEME := $$(rro_package_name)
Roberto Perez982a0752019-09-18 12:00:52 -070027 LOCAL_PACKAGE_NAME := $$(rro_package_name)
Roberto Perez982a0752019-09-18 12:00:52 -070028 LOCAL_CERTIFICATE := platform
29 LOCAL_SDK_VERSION := current
Roberto Perezd4f52712019-10-04 11:00:40 -070030 LOCAL_USE_AAPT2 := true
Roberto Perez982a0752019-09-18 12:00:52 -070031
Cole Faustba9c8db2019-12-13 13:41:35 -080032 # 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 Perez982a0752019-09-18 12:00:52 -070036 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)
45endef
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
52CAR_UI_RRO_SET_NAME :=
53CAR_UI_RESOURCE_DIR :=
54CAR_UI_RRO_TARGETS :=