| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Extracts native methods from a Java file and generates the JNI bindings. | 6 """Extracts native methods from a Java file and generates the JNI bindings. |
| 7 If you change this, please run and update the tests.""" | 7 If you change this, please run and update the tests.""" |
| 8 | 8 |
| 9 import collections | 9 import collections |
| 10 import errno | 10 import errno |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 def GetStaticCastForReturnType(return_type): | 341 def GetStaticCastForReturnType(return_type): |
| 342 type_map = { 'String' : 'jstring', | 342 type_map = { 'String' : 'jstring', |
| 343 'java/lang/String' : 'jstring', | 343 'java/lang/String' : 'jstring', |
| 344 'boolean[]': 'jbooleanArray', | 344 'boolean[]': 'jbooleanArray', |
| 345 'byte[]': 'jbyteArray', | 345 'byte[]': 'jbyteArray', |
| 346 'char[]': 'jcharArray', | 346 'char[]': 'jcharArray', |
| 347 'short[]': 'jshortArray', | 347 'short[]': 'jshortArray', |
| 348 'int[]': 'jintArray', | 348 'int[]': 'jintArray', |
| 349 'long[]': 'jlongArray', | 349 'long[]': 'jlongArray', |
| 350 'float[]': 'jfloatArray', |
| 350 'double[]': 'jdoubleArray' } | 351 'double[]': 'jdoubleArray' } |
| 351 ret = type_map.get(return_type, None) | 352 ret = type_map.get(return_type, None) |
| 352 if ret: | 353 if ret: |
| 353 return ret | 354 return ret |
| 354 if return_type.endswith('[]'): | 355 if return_type.endswith('[]'): |
| 355 return 'jobjectArray' | 356 return 'jobjectArray' |
| 356 return None | 357 return None |
| 357 | 358 |
| 358 | 359 |
| 359 def GetEnvCall(is_constructor, is_static, return_type): | 360 def GetEnvCall(is_constructor, is_static, return_type): |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 root_name = os.path.splitext(os.path.basename(input_file))[0] | 1331 root_name = os.path.splitext(os.path.basename(input_file))[0] |
| 1331 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' | 1332 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' |
| 1332 if options.jarjar: | 1333 if options.jarjar: |
| 1333 with open(options.jarjar) as f: | 1334 with open(options.jarjar) as f: |
| 1334 JniParams.SetJarJarMappings(f.read()) | 1335 JniParams.SetJarJarMappings(f.read()) |
| 1335 GenerateJNIHeader(input_file, output_file, options) | 1336 GenerateJNIHeader(input_file, output_file, options) |
| 1336 | 1337 |
| 1337 | 1338 |
| 1338 if __name__ == '__main__': | 1339 if __name__ == '__main__': |
| 1339 sys.exit(main(sys.argv)) | 1340 sys.exit(main(sys.argv)) |
| OLD | NEW |