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
5 # found in the LICENSE file.
7 """Invokes Android's aidl
14 from util
import build_utils
18 option_parser
= optparse
.OptionParser()
19 build_utils
.AddDepfileOption(option_parser
)
20 option_parser
.add_option('--aidl-path', help='Path to the aidl binary.')
21 option_parser
.add_option('--imports', help='Files to import.')
22 option_parser
.add_option('--includes',
23 help='Directories to add as import search paths.')
24 option_parser
.add_option('--srcjar', help='Path for srcjar output.')
25 options
, args
= option_parser
.parse_args(argv
[1:])
27 with build_utils
.TempDir() as temp_dir
:
29 classname
= os
.path
.splitext(os
.path
.basename(f
))[0]
30 output
= os
.path
.join(temp_dir
, classname
+ '.java')
31 aidl_cmd
= [options
.aidl_path
]
33 '-p' + s
for s
in build_utils
.ParseGypList(options
.imports
)
35 if options
.includes
is not None:
37 '-I' + s
for s
in build_utils
.ParseGypList(options
.includes
)
43 build_utils
.CheckOutput(aidl_cmd
)
45 build_utils
.ZipDir(options
.srcjar
, temp_dir
)
48 build_utils
.WriteDepfile(
50 build_utils
.GetPythonDependencies())
53 if __name__
== '__main__':
54 sys
.exit(main(sys
.argv
))