| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Generate JNI registration entry points | 6 """Generate JNI registration entry points |
| 7 | 7 |
| 8 Creates a header file with two static functions: RegisterMainDexNatives() and | 8 Creates a header file with two static functions: RegisterMainDexNatives() and |
| 9 RegisterNonMainDexNatives(). Together, these will use manual JNI registration | 9 RegisterNonMainDexNatives(). Together, these will use manual JNI registration |
| 10 to register all native methods that exist within an application.""" | 10 to register all native methods that exist within an application.""" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 help='A list of .sources files which contain Java ' | 154 help='A list of .sources files which contain Java ' |
| 155 'file paths. Must be used with --output.') | 155 'file paths. Must be used with --output.') |
| 156 arg_parser.add_argument('--output', | 156 arg_parser.add_argument('--output', |
| 157 help='The output file path.') | 157 help='The output file path.') |
| 158 arg_parser.add_argument('--no_register_java', | 158 arg_parser.add_argument('--no_register_java', |
| 159 help='A list of Java files which should be ignored ' | 159 help='A list of Java files which should be ignored ' |
| 160 'by the parser.') | 160 'by the parser.') |
| 161 args = arg_parser.parse_args(build_utils.ExpandFileArgs(argv[1:])) | 161 args = arg_parser.parse_args(build_utils.ExpandFileArgs(argv[1:])) |
| 162 args.sources_files = build_utils.ParseGnList(args.sources_files) | 162 args.sources_files = build_utils.ParseGnList(args.sources_files) |
| 163 | 163 |
| 164 if args.sources_files: | 164 if not args.sources_files: |
| 165 java_file_paths = [] | |
| 166 for f in args.sources_files: | |
| 167 # java_file_paths stores each Java file path as a string. | |
| 168 java_file_paths += build_utils.ReadSourcesList(f) | |
| 169 else: | |
| 170 print '\nError: Must specify --sources_files.' | 165 print '\nError: Must specify --sources_files.' |
| 171 return 1 | 166 return 1 |
| 167 |
| 168 java_file_paths = [] |
| 169 for f in args.sources_files: |
| 170 # java_file_paths stores each Java file path as a string. |
| 171 java_file_paths += build_utils.ReadSourcesList(f) |
| 172 output_file = args.output | 172 output_file = args.output |
| 173 GenerateJNIHeader(java_file_paths, output_file, args) | 173 GenerateJNIHeader(java_file_paths, output_file, args) |
| 174 | 174 |
| 175 if args.depfile: | 175 if args.depfile: |
| 176 build_utils.WriteDepfile(args.depfile, output_file) | 176 build_utils.WriteDepfile(args.depfile, output_file, |
| 177 args.sources_files + java_file_paths) |
| 177 | 178 |
| 178 | 179 |
| 179 if __name__ == '__main__': | 180 if __name__ == '__main__': |
| 180 sys.exit(main(sys.argv)) | 181 sys.exit(main(sys.argv)) |
| OLD | NEW |