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

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

Issue 1162943008: Make aapt and aidl paths flexible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN builds Created 5 years, 6 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 | « build/android/gyp/package_resources.py ('k') | build/android/package_resources_action.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Process Android resources to generate R.java, and prepare for packaging. 7 """Process Android resources to generate R.java, and prepare for packaging.
8 8
9 This will crunch images and generate v14 compatible resources 9 This will crunch images and generate v14 compatible resources
10 (see generate_v14_compatible_resources.py). 10 (see generate_v14_compatible_resources.py).
(...skipping 20 matching lines...) Expand all
31 def ParseArgs(args): 31 def ParseArgs(args):
32 """Parses command line options. 32 """Parses command line options.
33 33
34 Returns: 34 Returns:
35 An options object as from optparse.OptionsParser.parse_args() 35 An options object as from optparse.OptionsParser.parse_args()
36 """ 36 """
37 parser = optparse.OptionParser() 37 parser = optparse.OptionParser()
38 build_utils.AddDepfileOption(parser) 38 build_utils.AddDepfileOption(parser)
39 39
40 parser.add_option('--android-sdk', help='path to the Android SDK folder') 40 parser.add_option('--android-sdk', help='path to the Android SDK folder')
41 parser.add_option('--android-sdk-tools', 41 parser.add_option('--aapt-path',
42 help='path to the Android SDK build tools folder') 42 help='path to the Android aapt tool')
43 parser.add_option('--non-constant-id', action='store_true') 43 parser.add_option('--non-constant-id', action='store_true')
44 44
45 parser.add_option('--android-manifest', help='AndroidManifest.xml path') 45 parser.add_option('--android-manifest', help='AndroidManifest.xml path')
46 parser.add_option('--custom-package', help='Java package for R.java') 46 parser.add_option('--custom-package', help='Java package for R.java')
47 parser.add_option( 47 parser.add_option(
48 '--shared-resources', 48 '--shared-resources',
49 action='store_true', 49 action='store_true',
50 help='Make a resource package that can be loaded by a different' 50 help='Make a resource package that can be loaded by a different'
51 'application at runtime to access the package\'s resources.') 51 'application at runtime to access the package\'s resources.')
52 52
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 parser.add_option('--stamp', help='File to touch on success') 95 parser.add_option('--stamp', help='File to touch on success')
96 96
97 (options, args) = parser.parse_args(args) 97 (options, args) = parser.parse_args(args)
98 98
99 if args: 99 if args:
100 parser.error('No positional arguments should be given.') 100 parser.error('No positional arguments should be given.')
101 101
102 # Check that required options have been provided. 102 # Check that required options have been provided.
103 required_options = ( 103 required_options = (
104 'android_sdk', 104 'android_sdk',
105 'android_sdk_tools', 105 'aapt_path',
106 'android_manifest', 106 'android_manifest',
107 'dependencies_res_zips', 107 'dependencies_res_zips',
108 'resource_dirs', 108 'resource_dirs',
109 'resource_zip_out', 109 'resource_zip_out',
110 ) 110 )
111 build_utils.CheckOptions(options, parser, required=required_options) 111 build_utils.CheckOptions(options, parser, required=required_options)
112 112
113 if (options.R_dir is None) == (options.srcjar_out is None): 113 if (options.R_dir is None) == (options.srcjar_out is None):
114 raise Exception('Exactly one of --R-dir or --srcjar-out must be specified.') 114 raise Exception('Exactly one of --R-dir or --srcjar-out must be specified.')
115 115
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 for name in inzip.namelist(): 296 for name in inzip.namelist():
297 new_name = '%d/%s' % (i, name) 297 new_name = '%d/%s' % (i, name)
298 outzip.writestr(new_name, inzip.read(name)) 298 outzip.writestr(new_name, inzip.read(name))
299 299
300 300
301 def main(): 301 def main():
302 args = build_utils.ExpandFileArgs(sys.argv[1:]) 302 args = build_utils.ExpandFileArgs(sys.argv[1:])
303 303
304 options = ParseArgs(args) 304 options = ParseArgs(args)
305 android_jar = os.path.join(options.android_sdk, 'android.jar') 305 android_jar = os.path.join(options.android_sdk, 'android.jar')
306 aapt = os.path.join(options.android_sdk_tools, 'aapt') 306 aapt = options.aapt_path
307 307
308 input_files = [] 308 input_files = []
309 309
310 with build_utils.TempDir() as temp_dir: 310 with build_utils.TempDir() as temp_dir:
311 deps_dir = os.path.join(temp_dir, 'deps') 311 deps_dir = os.path.join(temp_dir, 'deps')
312 build_utils.MakeDirectory(deps_dir) 312 build_utils.MakeDirectory(deps_dir)
313 v14_dir = os.path.join(temp_dir, 'v14') 313 v14_dir = os.path.join(temp_dir, 'v14')
314 build_utils.MakeDirectory(v14_dir) 314 build_utils.MakeDirectory(v14_dir)
315 315
316 gen_dir = os.path.join(temp_dir, 'gen') 316 gen_dir = os.path.join(temp_dir, 'gen')
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if options.depfile: 411 if options.depfile:
412 input_files += build_utils.GetPythonDependencies() 412 input_files += build_utils.GetPythonDependencies()
413 build_utils.WriteDepfile(options.depfile, input_files) 413 build_utils.WriteDepfile(options.depfile, input_files)
414 414
415 if options.stamp: 415 if options.stamp:
416 build_utils.Touch(options.stamp) 416 build_utils.Touch(options.stamp)
417 417
418 418
419 if __name__ == '__main__': 419 if __name__ == '__main__':
420 main() 420 main()
OLDNEW
« no previous file with comments | « build/android/gyp/package_resources.py ('k') | build/android/package_resources_action.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698