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

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

Issue 1647353002: Use gn_helpers to [se]serialize GN lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@python_impl
Patch Set: more Created 4 years, 4 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/findbugs_diff.py ('k') | build/android/gyp/apk_obfuscate.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 """Invokes Android's aidl 7 """Invokes Android's aidl
8 """ 8 """
9 9
10 import optparse 10 import optparse
(...skipping 14 matching lines...) Expand all
25 help='Directories to add as import search paths.') 25 help='Directories to add as import search paths.')
26 option_parser.add_option('--srcjar', help='Path for srcjar output.') 26 option_parser.add_option('--srcjar', help='Path for srcjar output.')
27 options, args = option_parser.parse_args(argv[1:]) 27 options, args = option_parser.parse_args(argv[1:])
28 28
29 with build_utils.TempDir() as temp_dir: 29 with build_utils.TempDir() as temp_dir:
30 for f in args: 30 for f in args:
31 classname = os.path.splitext(os.path.basename(f))[0] 31 classname = os.path.splitext(os.path.basename(f))[0]
32 output = os.path.join(temp_dir, classname + '.java') 32 output = os.path.join(temp_dir, classname + '.java')
33 aidl_cmd = [options.aidl_path] 33 aidl_cmd = [options.aidl_path]
34 aidl_cmd += [ 34 aidl_cmd += [
35 '-p' + s for s in build_utils.ParseGypList(options.imports) 35 '-p' + s for s in build_utils.ParseGnList(options.imports)
36 ] 36 ]
37 if options.includes is not None: 37 if options.includes is not None:
38 aidl_cmd += [ 38 aidl_cmd += [
39 '-I' + s for s in build_utils.ParseGypList(options.includes) 39 '-I' + s for s in build_utils.ParseGnList(options.includes)
40 ] 40 ]
41 aidl_cmd += [ 41 aidl_cmd += [
42 f, 42 f,
43 output 43 output
44 ] 44 ]
45 build_utils.CheckOutput(aidl_cmd) 45 build_utils.CheckOutput(aidl_cmd)
46 46
47 with zipfile.ZipFile(options.srcjar, 'w') as srcjar: 47 with zipfile.ZipFile(options.srcjar, 'w') as srcjar:
48 for path in build_utils.FindInDirectory(temp_dir, '*.java'): 48 for path in build_utils.FindInDirectory(temp_dir, '*.java'):
49 with open(path) as fileobj: 49 with open(path) as fileobj:
50 data = fileobj.read() 50 data = fileobj.read()
51 pkg_name = re.search(r'^\s*package\s+(.*?)\s*;', data, re.M).group(1) 51 pkg_name = re.search(r'^\s*package\s+(.*?)\s*;', data, re.M).group(1)
52 arcname = '%s/%s' % (pkg_name.replace('.', '/'), os.path.basename(path)) 52 arcname = '%s/%s' % (pkg_name.replace('.', '/'), os.path.basename(path))
53 srcjar.writestr(arcname, data) 53 srcjar.writestr(arcname, data)
54 54
55 if options.depfile: 55 if options.depfile:
56 build_utils.WriteDepfile( 56 build_utils.WriteDepfile(
57 options.depfile, 57 options.depfile,
58 build_utils.GetPythonDependencies()) 58 build_utils.GetPythonDependencies())
59 59
60 60
61 if __name__ == '__main__': 61 if __name__ == '__main__':
62 sys.exit(main(sys.argv)) 62 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/findbugs_diff.py ('k') | build/android/gyp/apk_obfuscate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698