OLD | NEW |
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 options.include_all_resources, | 470 options.include_all_resources, |
471 options.non_constant_id, | 471 options.non_constant_id, |
472 options.shared_resources, | 472 options.shared_resources, |
473 options.v14_skip, | 473 options.v14_skip, |
474 ] | 474 ] |
475 | 475 |
476 input_paths = [ options.android_manifest ] | 476 input_paths = [ options.android_manifest ] |
477 input_paths.extend(options.dependencies_res_zips) | 477 input_paths.extend(options.dependencies_res_zips) |
478 input_paths.extend(p for p in options.extra_r_text_files if os.path.exists(p)) | 478 input_paths.extend(p for p in options.extra_r_text_files if os.path.exists(p)) |
479 | 479 |
480 for d in options.resource_dirs: | 480 resource_names = [] |
481 for root, _, filenames in os.walk(d): | 481 for resource_dir in options.resource_dirs: |
482 input_paths.extend(os.path.join(root, f) for f in filenames) | 482 for resource_file in build_utils.FindInDirectory(resource_dir, '*'): |
| 483 input_paths.append(resource_file) |
| 484 resource_names.append(os.path.relpath(resource_file, resource_dir)) |
| 485 |
| 486 # Resource filenames matter to the output, so add them to strings as well. |
| 487 # This matters if a file is renamed but not changed (http://crbug.com/597126). |
| 488 input_strings.extend(sorted(resource_names)) |
483 | 489 |
484 build_utils.CallAndWriteDepfileIfStale( | 490 build_utils.CallAndWriteDepfileIfStale( |
485 lambda: _OnStaleMd5(options), | 491 lambda: _OnStaleMd5(options), |
486 options, | 492 options, |
487 input_paths=input_paths, | 493 input_paths=input_paths, |
488 input_strings=input_strings, | 494 input_strings=input_strings, |
489 output_paths=output_paths, | 495 output_paths=output_paths, |
490 # TODO(agrieve): Remove R_dir when it's no longer used (used only by GYP). | 496 # TODO(agrieve): Remove R_dir when it's no longer used (used only by GYP). |
491 force=options.R_dir) | 497 force=options.R_dir) |
492 | 498 |
493 | 499 |
494 if __name__ == '__main__': | 500 if __name__ == '__main__': |
495 main(sys.argv[1:]) | 501 main(sys.argv[1:]) |
OLD | NEW |