| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 def GetStaticCastForReturnType(return_type): | 348 def GetStaticCastForReturnType(return_type): |
| 349 type_map = { 'String' : 'jstring', | 349 type_map = { 'String' : 'jstring', |
| 350 'java/lang/String' : 'jstring', | 350 'java/lang/String' : 'jstring', |
| 351 'boolean[]': 'jbooleanArray', | 351 'boolean[]': 'jbooleanArray', |
| 352 'byte[]': 'jbyteArray', | 352 'byte[]': 'jbyteArray', |
| 353 'char[]': 'jcharArray', | 353 'char[]': 'jcharArray', |
| 354 'short[]': 'jshortArray', | 354 'short[]': 'jshortArray', |
| 355 'int[]': 'jintArray', | 355 'int[]': 'jintArray', |
| 356 'long[]': 'jlongArray', | 356 'long[]': 'jlongArray', |
| 357 'float[]': 'jfloatArray', |
| 357 'double[]': 'jdoubleArray' } | 358 'double[]': 'jdoubleArray' } |
| 358 ret = type_map.get(return_type, None) | 359 ret = type_map.get(return_type, None) |
| 359 if ret: | 360 if ret: |
| 360 return ret | 361 return ret |
| 361 if return_type.endswith('[]'): | 362 if return_type.endswith('[]'): |
| 362 return 'jobjectArray' | 363 return 'jobjectArray' |
| 363 return None | 364 return None |
| 364 | 365 |
| 365 | 366 |
| 366 def GetEnvCall(is_constructor, is_static, return_type): | 367 def GetEnvCall(is_constructor, is_static, return_type): |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 root_name = os.path.splitext(os.path.basename(input_file))[0] | 1344 root_name = os.path.splitext(os.path.basename(input_file))[0] |
| 1344 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' | 1345 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' |
| 1345 if options.jarjar: | 1346 if options.jarjar: |
| 1346 with open(options.jarjar) as f: | 1347 with open(options.jarjar) as f: |
| 1347 JniParams.SetJarJarMappings(f.read()) | 1348 JniParams.SetJarJarMappings(f.read()) |
| 1348 GenerateJNIHeader(input_file, output_file, options) | 1349 GenerateJNIHeader(input_file, output_file, options) |
| 1349 | 1350 |
| 1350 | 1351 |
| 1351 if __name__ == '__main__': | 1352 if __name__ == '__main__': |
| 1352 sys.exit(main(sys.argv)) | 1353 sys.exit(main(sys.argv)) |
| OLD | NEW |