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 |
11 and | 11 and |
12 https://android.googlesource.com/platform/sdk/+/master/files/ant/build.xml | 12 https://android.googlesource.com/platform/sdk/+/master/files/ant/build.xml |
13 """ | 13 """ |
14 # pylint: enable=C0301 | 14 # pylint: enable=C0301 |
15 | 15 |
16 import optparse | 16 import optparse |
17 import os | 17 import os |
18 import shutil | 18 import shutil |
19 | 19 |
20 from util import build_utils | 20 from util import build_utils |
21 | 21 |
22 def ParseArgs(): | 22 def ParseArgs(): |
23 """Parses command line options. | 23 """Parses command line options. |
24 | 24 |
25 Returns: | 25 Returns: |
26 An options object as from optparse.OptionsParser.parse_args() | 26 An options object as from optparse.OptionsParser.parse_args() |
27 """ | 27 """ |
28 parser = optparse.OptionParser() | 28 parser = optparse.OptionParser() |
| 29 build_utils.AddDepfileOption(parser) |
29 parser.add_option('--android-sdk', help='path to the Android SDK folder') | 30 parser.add_option('--android-sdk', help='path to the Android SDK folder') |
30 parser.add_option('--android-sdk-tools', | 31 parser.add_option('--android-sdk-tools', |
31 help='path to the Android SDK build tools folder') | 32 help='path to the Android SDK build tools folder') |
32 | 33 |
33 parser.add_option('--configuration-name', | 34 parser.add_option('--configuration-name', |
34 help='Gyp\'s configuration name (Debug or Release).') | 35 help='Gyp\'s configuration name (Debug or Release).') |
35 | 36 |
36 parser.add_option('--android-manifest', help='AndroidManifest.xml path') | 37 parser.add_option('--android-manifest', help='AndroidManifest.xml path') |
37 parser.add_option('--version-code', help='Version code for apk.') | 38 parser.add_option('--version-code', help='Version code for apk.') |
38 parser.add_option('--version-name', help='Version name for apk.') | 39 parser.add_option('--version-name', help='Version name for apk.') |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 build_utils.ExtractAll(z, path=subdir) | 122 build_utils.ExtractAll(z, path=subdir) |
122 MoveImagesToNonMdpiFolders(subdir) | 123 MoveImagesToNonMdpiFolders(subdir) |
123 package_command += ['-S', subdir] | 124 package_command += ['-S', subdir] |
124 | 125 |
125 if 'Debug' in options.configuration_name: | 126 if 'Debug' in options.configuration_name: |
126 package_command += ['--debug-mode'] | 127 package_command += ['--debug-mode'] |
127 | 128 |
128 build_utils.CheckOutput( | 129 build_utils.CheckOutput( |
129 package_command, print_stdout=False, print_stderr=False) | 130 package_command, print_stdout=False, print_stderr=False) |
130 | 131 |
| 132 if options.depfile: |
| 133 build_utils.WriteDepfile( |
| 134 options.depfile, |
| 135 build_utils.GetPythonDependencies()) |
| 136 |
131 | 137 |
132 if __name__ == '__main__': | 138 if __name__ == '__main__': |
133 main() | 139 main() |
OLD | NEW |