OLD | NEW |
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 with build_utils.TempDir() as temp_dir: | 93 with build_utils.TempDir() as temp_dir: |
94 package_command = [aapt, | 94 package_command = [aapt, |
95 'package', | 95 'package', |
96 '--version-code', options.version_code, | 96 '--version-code', options.version_code, |
97 '--version-name', options.version_name, | 97 '--version-name', options.version_name, |
98 '-M', options.android_manifest, | 98 '-M', options.android_manifest, |
99 '--no-crunch', | 99 '--no-crunch', |
100 '-f', | 100 '-f', |
101 '--auto-add-overlay', | 101 '--auto-add-overlay', |
| 102 '-0', 'pak', |
102 | 103 |
103 '-I', android_jar, | 104 '-I', android_jar, |
104 '-F', options.apk_path, | 105 '-F', options.apk_path, |
105 ] | 106 ] |
106 | 107 |
107 if os.path.exists(options.asset_dir): | 108 if os.path.exists(options.asset_dir): |
108 package_command += ['-A', options.asset_dir] | 109 package_command += ['-A', options.asset_dir] |
109 | 110 |
110 dep_zips = build_utils.ParseGypList(options.resource_zips) | 111 dep_zips = build_utils.ParseGypList(options.resource_zips) |
111 for z in dep_zips: | 112 for z in dep_zips: |
112 subdir = os.path.join(temp_dir, os.path.basename(z)) | 113 subdir = os.path.join(temp_dir, os.path.basename(z)) |
113 if os.path.exists(subdir): | 114 if os.path.exists(subdir): |
114 raise Exception('Resource zip name conflict: ' + os.path.basename(z)) | 115 raise Exception('Resource zip name conflict: ' + os.path.basename(z)) |
115 build_utils.ExtractAll(z, path=subdir) | 116 build_utils.ExtractAll(z, path=subdir) |
116 MoveImagesToNonMdpiFolders(subdir) | 117 MoveImagesToNonMdpiFolders(subdir) |
117 package_command += ['-S', subdir] | 118 package_command += ['-S', subdir] |
118 | 119 |
119 if 'Debug' in options.configuration_name: | 120 if 'Debug' in options.configuration_name: |
120 package_command += ['--debug-mode'] | 121 package_command += ['--debug-mode'] |
121 | 122 |
122 build_utils.CheckOutput( | 123 build_utils.CheckOutput( |
123 package_command, print_stdout=False, print_stderr=False) | 124 package_command, print_stdout=False, print_stderr=False) |
124 | 125 |
125 | 126 |
126 if __name__ == '__main__': | 127 if __name__ == '__main__': |
127 main() | 128 main() |
OLD | NEW |