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
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 @@
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 @@
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 @@
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: