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

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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = [] 103 res_dirs = []
104 subdirs = [os.path.join(d, s) for s in os.listdir(d)] 104 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)]) 105 subdirs = [s for s in subdirs if os.path.isdir(s)]
106 if subdirs and os.path.basename(subdirs[0]) == '0': 106 is_multi = True
107 res_dirs = subdirs 107 for s in subdirs:
newt (away) 2015/03/13 23:13:45 How about just checking if 0 is present, like befo
cjhopman 2015/03/16 20:04:53 Done.
108 try:
109 float(os.path.basename(s))
newt (away) 2015/03/13 23:13:45 why float and not int?
cjhopman 2015/03/16 20:04:53 Done.
110 except ValueError:
111 is_multi = False
112 break
113
114 if is_multi:
115 res_dirs = sorted(subdirs, key=lambda p : float(os.path.basename(p)))
108 else: 116 else:
109 res_dirs = [d] 117 res_dirs = [d]
110 package_command = [] 118 package_command = []
111 for d in res_dirs: 119 for d in res_dirs:
112 MoveImagesToNonMdpiFolders(d) 120 MoveImagesToNonMdpiFolders(d)
113 package_command += ['-S', d] 121 package_command += ['-S', d]
114 return package_command 122 return package_command
115 123
116 124
117 def main(): 125 def main():
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 package_command, print_stdout=False, print_stderr=False) 166 package_command, print_stdout=False, print_stderr=False)
159 167
160 if options.depfile: 168 if options.depfile:
161 build_utils.WriteDepfile( 169 build_utils.WriteDepfile(
162 options.depfile, 170 options.depfile,
163 build_utils.GetPythonDependencies()) 171 build_utils.GetPythonDependencies())
164 172
165 173
166 if __name__ == '__main__': 174 if __name__ == '__main__':
167 main() 175 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