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

Side by Side Diff: build/android/gyp/package_resources.py

Issue 1007043002: Fix android resources in gn builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stack_debug_better
Patch Set: Created 5 years, 9 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 | build/android/gyp/write_build_config.py » ('j') | 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 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 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 # pylint: disable=C0301 7 # pylint: disable=C0301
8 """Package resources into an apk. 8 """Package resources into an apk.
9 9
10 See https://android.googlesource.com/platform/tools/base/+/master/legacy/ant-tas ks/src/main/java/com/android/ant/AaptExecTask.java 10 See https://android.googlesource.com/platform/tools/base/+/master/legacy/ant-tas ks/src/main/java/com/android/ant/AaptExecTask.java
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 shutil.move(src_file, dst_file) 93 shutil.move(src_file, dst_file)
94 94
95 95
96 def PackageArgsForExtractedZip(d): 96 def PackageArgsForExtractedZip(d):
97 """Returns the aapt args for an extracted resources zip. 97 """Returns the aapt args for an extracted resources zip.
98 98
99 A resources zip either contains the resources for a single target or for 99 A resources zip either contains the resources for a single target or for
100 multiple targets. If it is multiple targets merged into one, the actual 100 multiple targets. If it is multiple targets merged into one, the actual
101 resource directories will be contained in the subdirectories 0, 1, 2, ... 101 resource directories will be contained in the subdirectories 0, 1, 2, ...
102 """ 102 """
103 res_dirs = []
104 subdirs = [os.path.join(d, s) for s in os.listdir(d)] 103 subdirs = [os.path.join(d, s) for s in os.listdir(d)]
105 subdirs = sorted([s for s in subdirs if os.path.isdir(s)]) 104 subdirs = [s for s in subdirs if os.path.isdir(s)]
106 if subdirs and os.path.basename(subdirs[0]) == '0': 105 is_multi = '0' in [os.path.basename(s) for s in subdirs]
107 res_dirs = subdirs 106 if is_multi:
107 res_dirs = sorted(subdirs, key=lambda p : int(os.path.basename(p)))
108 else: 108 else:
109 res_dirs = [d] 109 res_dirs = [d]
110 package_command = [] 110 package_command = []
111 for d in res_dirs: 111 for d in res_dirs:
112 MoveImagesToNonMdpiFolders(d) 112 MoveImagesToNonMdpiFolders(d)
113 package_command += ['-S', d] 113 package_command += ['-S', d]
114 return package_command 114 return package_command
115 115
116 116
117 def main(): 117 def main():
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 package_command, print_stdout=False, print_stderr=False) 158 package_command, print_stdout=False, print_stderr=False)
159 159
160 if options.depfile: 160 if options.depfile:
161 build_utils.WriteDepfile( 161 build_utils.WriteDepfile(
162 options.depfile, 162 options.depfile,
163 build_utils.GetPythonDependencies()) 163 build_utils.GetPythonDependencies())
164 164
165 165
166 if __name__ == '__main__': 166 if __name__ == '__main__':
167 main() 167 main()
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/write_build_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698