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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Process Android resources to generate R.java, and prepare for packaging. 7 """Process Android resources to generate R.java, and prepare for packaging.
8 8
9 This will crunch images and generate v14 compatible resources 9 This will crunch images and generate v14 compatible resources
10 (see generate_v14_compatible_resources.py). 10 (see generate_v14_compatible_resources.py).
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 public static {{ e.java_type }} {{ e.name }} = {{ e.value }}; 217 public static {{ e.java_type }} {{ e.name }} = {{ e.value }};
218 {% else %} 218 {% else %}
219 public static final {{ e.java_type }} {{ e.name }} = {{ e.value }}; 219 public static final {{ e.java_type }} {{ e.name }} = {{ e.value }};
220 {% endif %} 220 {% endif %}
221 {% endfor %} 221 {% endfor %}
222 } 222 }
223 {% endfor %} 223 {% endfor %}
224 {% if shared_resources %} 224 {% if shared_resources %}
225 public static void onResourcesLoaded(int packageId) { 225 public static void onResourcesLoaded(int packageId) {
226 {% for resource_type in resource_types %} 226 {% for resource_type in resource_types %}
227 {% for e in resources[resource_type] %} 227 onResourcesLoaded{{ resource_type|title }}(packageId);
agrieve 2016/07/20 17:21:36 Actually, please do a add a {# comment #} here poi
228 {% if resource_type != 'styleable' and e.java_type != 'int[]' %}
229 """ + create_id + """
230 {% endif %}
231 {% endfor %}
232 {% for e in resources[resource_type] %} 228 {% for e in resources[resource_type] %}
233 {% if e.java_type == 'int[]' %} 229 {% if e.java_type == 'int[]' %}
234 for(int i = 0; i < {{ e.resource_type }}.{{ e.name }}.length; ++i) { 230 for(int i = 0; i < {{ e.resource_type }}.{{ e.name }}.length; ++i) {
235 """ + create_id_arr + """ 231 """ + create_id_arr + """
236 } 232 }
237 {% endif %} 233 {% endif %}
238 {% endfor %} 234 {% endfor %}
239 {% endfor %} 235 {% endfor %}
240 } 236 }
237 {% for resource_type in resource_types %}
238 private static void onResourcesLoaded{{ resource_type|title }}(int packageId ) {
PEConn 2016/07/20 15:58:40 This exceeds the line length limit but in a templa
PEConn 2016/07/20 16:58:26 The line length is causing the presubmit to fail.
Bernhard Bauer 2016/07/20 17:08:33 This is just a string, right? You could construct
agrieve 2016/07/20 17:20:27 yeah, I'd say choose a shorter variable name for p
PEConn 2016/07/20 17:41:37 Done.
239 {% for e in resources[resource_type] %}
240 {% if resource_type != 'styleable' and e.java_type != 'int[]' %}
241 """ + create_id + """
242 {% endif %}
243 {% endfor %}
244 }
245 {% endfor %}
241 {% endif %} 246 {% endif %}
242 } 247 }
243 """, trim_blocks=True, lstrip_blocks=True) 248 """, trim_blocks=True, lstrip_blocks=True)
244 249
245 return template.render(package=package, 250 return template.render(package=package,
246 resources=resources_by_type, 251 resources=resources_by_type,
247 resource_types=sorted(resources_by_type), 252 resource_types=sorted(resources_by_type),
248 shared_resources=shared_resources) 253 shared_resources=shared_resources)
249 254
250 255
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 options, 528 options,
524 input_paths=input_paths, 529 input_paths=input_paths,
525 input_strings=input_strings, 530 input_strings=input_strings,
526 output_paths=output_paths, 531 output_paths=output_paths,
527 # TODO(agrieve): Remove R_dir when it's no longer used (used only by GYP). 532 # TODO(agrieve): Remove R_dir when it's no longer used (used only by GYP).
528 force=options.R_dir) 533 force=options.R_dir)
529 534
530 535
531 if __name__ == '__main__': 536 if __name__ == '__main__':
532 main(sys.argv[1:]) 537 main(sys.argv[1:])
OLDNEW
« 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