aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Stetson <alexstetson@google.com>2021-05-05 12:17:31 -0700
committerAlex Stetson <alexstetson@google.com>2021-05-05 14:57:47 -0700
commit52a5ebb1e4faf5bec4c9944d6aed78e559908c44 (patch)
tree28de9da1834dadfcff8393f1f127854cc1b7d0a7
parent3ea627f47fb4ec4cf3e60397ce3585bf72deacd8 (diff)
downloadtests-52a5ebb1e4faf5bec4c9944d6aed78e559908c44.tar.gz
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
-rw-r--r--tools/rro/resource_utils.py7
1 files 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: