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

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

Issue 1473273002: GN(Android): Add libosmesa.so to ContentShell.apk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2015 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 """Adds the code parts to a resource APK.""" 7 """Adds the code parts to a resource APK."""
8 8
9 import argparse 9 import argparse
10 import itertools 10 import itertools
(...skipping 27 matching lines...) Expand all
38 help='Same as --assets, except disables compression.', 38 help='Same as --assets, except disables compression.',
39 default='[]') 39 default='[]')
40 parser.add_argument('--resource-apk', 40 parser.add_argument('--resource-apk',
41 help='An .ap_ file built using aapt', 41 help='An .ap_ file built using aapt',
42 required=True) 42 required=True)
43 parser.add_argument('--output-apk', 43 parser.add_argument('--output-apk',
44 help='Path to the output file', 44 help='Path to the output file',
45 required=True) 45 required=True)
46 parser.add_argument('--dex-file', 46 parser.add_argument('--dex-file',
47 help='Path to the classes.dex to use') 47 help='Path to the classes.dex to use')
48 # TODO(agrieve): Switch this to be a list of files rather than a directory. 48 # TODO(agrieve): Pass all libs via --native-libs and remove --native-libs-dir.
49 parser.add_argument('--native-libs-dir', 49 parser.add_argument('--native-libs-dir',
50 help='Directory containing native libraries to include', 50 help='Directory containing native libraries to include',
51 default=[]) 51 default=[])
52 parser.add_argument('--native-libs',
53 help='List of native libraries to include',
54 default='[]')
52 parser.add_argument('--android-abi', 55 parser.add_argument('--android-abi',
53 help='Android architecture to use for native libraries') 56 help='Android architecture to use for native libraries')
54 parser.add_argument('--native-lib-placeholders', 57 parser.add_argument('--native-lib-placeholders',
55 help='GYP-list of native library placeholders to add.', 58 help='GYP-list of native library placeholders to add.',
56 default='[]') 59 default='[]')
57 parser.add_argument('--emma-device-jar', 60 parser.add_argument('--emma-device-jar',
58 help='Path to emma_device.jar to include.') 61 help='Path to emma_device.jar to include.')
59 options = parser.parse_args(args) 62 options = parser.parse_args(args)
60 options.assets = build_utils.ParseGypList(options.assets) 63 options.assets = build_utils.ParseGypList(options.assets)
61 options.uncompressed_assets = build_utils.ParseGypList( 64 options.uncompressed_assets = build_utils.ParseGypList(
62 options.uncompressed_assets) 65 options.uncompressed_assets)
66 options.native_libs = build_utils.ParseGypList(options.native_libs)
63 options.native_lib_placeholders = build_utils.ParseGypList( 67 options.native_lib_placeholders = build_utils.ParseGypList(
64 options.native_lib_placeholders) 68 options.native_lib_placeholders)
65 69
66 if not options.android_abi and (options.native_libs_dir or 70 if not options.android_abi and (options.native_libs or
71 options.native_libs_dir or
67 options.native_lib_placeholders): 72 options.native_lib_placeholders):
68 raise Exception('Must specify --android-abi with --native-libs-dir') 73 raise Exception('Must specify --android-abi when native libs exist.')
69 return options 74 return options
70 75
71 76
72 def _ListSubPaths(path): 77 def _ListSubPaths(path):
73 """Returns a list of full paths to all files in the given path.""" 78 """Returns a list of full paths to all files in the given path."""
74 return [os.path.join(path, name) for name in os.listdir(path)] 79 return [os.path.join(path, name) for name in os.listdir(path)]
75 80
76 81
77 def _SplitAssetPath(path): 82 def _SplitAssetPath(path):
78 """Returns (src, dest) given an asset path in the form src[:dest].""" 83 """Returns (src, dest) given an asset path in the form src[:dest]."""
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 120
116 def _CreateAssetsList(paths): 121 def _CreateAssetsList(paths):
117 """Returns a newline-separated list of asset paths for the given paths.""" 122 """Returns a newline-separated list of asset paths for the given paths."""
118 return '\n'.join(_SplitAssetPath(p)[1] for p in sorted(paths)) + '\n' 123 return '\n'.join(_SplitAssetPath(p)[1] for p in sorted(paths)) + '\n'
119 124
120 125
121 def main(args): 126 def main(args):
122 args = build_utils.ExpandFileArgs(args) 127 args = build_utils.ExpandFileArgs(args)
123 options = _ParseArgs(args) 128 options = _ParseArgs(args)
124 129
125 native_libs = [] 130 native_libs = options.native_libs
126 if options.native_libs_dir: 131 if options.native_libs_dir:
127 native_libs = _ListSubPaths(options.native_libs_dir) 132 native_libs += _ListSubPaths(options.native_libs_dir)
128 133
129 input_paths = [options.resource_apk, __file__] + native_libs 134 input_paths = [options.resource_apk, __file__] + native_libs
130 if options.dex_file: 135 if options.dex_file:
131 input_paths.append(options.dex_file) 136 input_paths.append(options.dex_file)
132 137
133 if options.emma_device_jar: 138 if options.emma_device_jar:
134 input_paths.append(options.emma_device_jar) 139 input_paths.append(options.emma_device_jar)
135 140
136 input_strings = [options.android_abi, options.native_lib_placeholders] 141 input_strings = [options.android_abi, options.native_lib_placeholders]
137 142
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 build_utils.CallAndWriteDepfileIfStale( 207 build_utils.CallAndWriteDepfileIfStale(
203 on_stale_md5, 208 on_stale_md5,
204 options, 209 options,
205 input_paths=input_paths, 210 input_paths=input_paths,
206 input_strings=input_strings, 211 input_strings=input_strings,
207 output_paths=[options.output_apk]) 212 output_paths=[options.output_apk])
208 213
209 214
210 if __name__ == '__main__': 215 if __name__ == '__main__':
211 main(sys.argv[1:]) 216 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | build/config/android/internal_rules.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698