Commit 46ba0c2b authored by cjhopman's avatar cjhopman Committed by Commit bot

Fix android resources in gn builds

Dependent libraries need to be passed in the reverse order that
build_utils.GetSortedTransitiveDependencies returns.

Also, a multi-library resource zip in package_libraries should be sorted
on the numeric values of the directories in the zip, not the string
values.

Review URL: https://codereview.chromium.org/1007043002

Cr-Commit-Position: refs/heads/master@{#320802}
parent 927c9f42
......@@ -100,11 +100,11 @@ def PackageArgsForExtractedZip(d):
multiple targets. If it is multiple targets merged into one, the actual
resource directories will be contained in the subdirectories 0, 1, 2, ...
"""
res_dirs = []
subdirs = [os.path.join(d, s) for s in os.listdir(d)]
subdirs = sorted([s for s in subdirs if os.path.isdir(s)])
if subdirs and os.path.basename(subdirs[0]) == '0':
res_dirs = subdirs
subdirs = [s for s in subdirs if os.path.isdir(s)]
is_multi = '0' in [os.path.basename(s) for s in subdirs]
if is_multi:
res_dirs = sorted(subdirs, key=lambda p : int(os.path.basename(p)))
else:
res_dirs = [d]
package_command = []
......
......@@ -139,6 +139,9 @@ def main(argv):
direct_resources_deps = DepsOfType('android_resources', direct_deps_configs)
all_resources_deps = DepsOfType('android_resources', all_deps_configs)
# Resources should be ordered with the highest-level dependency first so that
# overrides are done correctly.
all_resources_deps.reverse()
# Initialize some common config.
config = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment