From 52a5ebb1e4faf5bec4c9944d6aed78e559908c44 Mon Sep 17 00:00:00 2001 From: Alex Stetson Date: Wed, 5 May 2021 12:17:31 -0700 Subject: Only use default strings.xml file as overlayable If we reference all strings.xml files and then remove a string, the resource will still be present in our overlayable.xml file. Then, when translations are imported and the additional references are removed, the application will no longer build. Bug: 187225456 Test: manual (on CarSettings) Change-Id: I114b1fd37cac6d50571bd5173e0bab601db87698 --- tools/rro/resource_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/rro/resource_utils.py b/tools/rro/resource_utils.py index 5e860f9..aae73a1 100644 --- a/tools/rro/resource_utils.py +++ b/tools/rro/resource_utils.py @@ -75,7 +75,8 @@ def get_all_resources(resDir, excluded_resource_files=[]): for file in os.listdir(os.path.join(resDir, dir)): filePath = os.path.abspath(os.path.join(resDir, dir, file)) if file.endswith('.xml') and filePath not in excluded_resource_files: - for resource in get_resources_from_single_file(os.path.join(resDir, dir, file)): + for resource in get_resources_from_single_file(os.path.join(resDir, dir, file), + dir != "values"): add_resource_to_set(resources, resource) return resources @@ -87,7 +88,7 @@ def get_ids_from_layout_file(filename): add_resource_to_set(result, Resource(i, 'id', ResourceLocation(filename))) return result -def get_resources_from_single_file(filename): +def get_resources_from_single_file(filename, ignore_strings=False): doc = etree.parse(filename) root = doc.getroot() result = set() @@ -100,6 +101,8 @@ def get_resources_from_single_file(filename): resType = "array" if resource.tag == 'item' or resource.tag == 'public': resType = resource.get('type') + if resType == 'string' and ignore_strings: + continue if resType == 'overlayable': for policy in resource: for overlayable in policy: -- cgit v1.2.3