Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3727)

Unified Diff: build/android/gyp/process_resources.py

Issue 2163993002: Split onResourcesLoaded into multiple functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed stupid bug Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/process_resources.py
diff --git a/build/android/gyp/process_resources.py b/build/android/gyp/process_resources.py
index 055ec8261c5686778d9269ebc9de4fd5947088bf..4f0b4169274f7b4aaebed2f4211850a8dd254be2 100755
--- a/build/android/gyp/process_resources.py
+++ b/build/android/gyp/process_resources.py
@@ -205,6 +205,10 @@ def _CreateRJavaFile(package, resources_by_type, shared_resources):
create_id_arr = ('{{ e.resource_type }}.{{ e.name }}[i] = '
'({{ e.resource_type }}.{{ e.name }}[i] & 0x00ffffff) |'
' (packageId << 24);')
+ # Here we diverge from what aapt does. Because we have so many
+ # resources, the onResourcesLoaded method was exceeding the 64KB limit that
+ # Java imposes. For this reason we split onResourcesLoaded into different
+ # methods for each resource type.
template = Template("""/* AUTO-GENERATED FILE. DO NOT MODIFY. */
package {{ package }};
@@ -224,11 +228,7 @@ public final class R {
{% if shared_resources %}
public static void onResourcesLoaded(int packageId) {
{% for resource_type in resource_types %}
- {% for e in resources[resource_type] %}
- {% if resource_type != 'styleable' and e.java_type != 'int[]' %}
- """ + create_id + """
- {% endif %}
- {% endfor %}
+ onResourcesLoaded{{ resource_type|title }}(packageId);
{% for e in resources[resource_type] %}
{% if e.java_type == 'int[]' %}
for(int i = 0; i < {{ e.resource_type }}.{{ e.name }}.length; ++i) {
@@ -238,6 +238,15 @@ public final class R {
{% endfor %}
{% endfor %}
}
+ {% for res_type in resource_types %}
+ private static void onResourcesLoaded{{ res_type|title }}(int packageId) {
+ {% for e in resources[res_type] %}
+ {% if res_type != 'styleable' and e.java_type != 'int[]' %}
+ """ + create_id + """
+ {% endif %}
+ {% endfor %}
+ }
+ {% endfor %}
{% endif %}
}
""", trim_blocks=True, lstrip_blocks=True)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698