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

Side by Side Diff: base/android/jni_generator/jni_generator.py

Issue 294323002: Add generate_jar_jni template (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase (+fix specified output file) Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 return os.sep.join(script_components[base_index:]) 1332 return os.sep.join(script_components[base_index:])
1333 1333
1334 1334
1335 def main(argv): 1335 def main(argv):
1336 usage = """usage: %prog [OPTIONS] 1336 usage = """usage: %prog [OPTIONS]
1337 This script will parse the given java source code extracting the native 1337 This script will parse the given java source code extracting the native
1338 declarations and print the header file to stdout (or a file). 1338 declarations and print the header file to stdout (or a file).
1339 See SampleForTests.java for more details. 1339 See SampleForTests.java for more details.
1340 """ 1340 """
1341 option_parser = optparse.OptionParser(usage=usage) 1341 option_parser = optparse.OptionParser(usage=usage)
1342 option_parser.add_option('-j', dest='jar_file', 1342 option_parser.add_option('-j', '--jar_file', dest='jar_file',
1343 help='Extract the list of input files from' 1343 help='Extract the list of input files from'
1344 ' a specified jar file.' 1344 ' a specified jar file.'
1345 ' Uses javap to extract the methods from a' 1345 ' Uses javap to extract the methods from a'
1346 ' pre-compiled class. --input should point' 1346 ' pre-compiled class. --input should point'
1347 ' to pre-compiled Java .class files.') 1347 ' to pre-compiled Java .class files.')
1348 option_parser.add_option('-n', dest='namespace', 1348 option_parser.add_option('-n', dest='namespace',
1349 help='Uses as a namespace in the generated header ' 1349 help='Uses as a namespace in the generated header '
1350 'instead of the javap class name, or when there is ' 1350 'instead of the javap class name, or when there is '
1351 'no JNINamespace annotation in the java source.') 1351 'no JNINamespace annotation in the java source.')
1352 option_parser.add_option('--input_file', 1352 option_parser.add_option('--input_file',
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 root_name = os.path.splitext(os.path.basename(input_file))[0] 1409 root_name = os.path.splitext(os.path.basename(input_file))[0]
1410 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' 1410 output_file = os.path.join(options.output_dir, root_name) + '_jni.h'
1411 if options.jarjar: 1411 if options.jarjar:
1412 with open(options.jarjar) as f: 1412 with open(options.jarjar) as f:
1413 JniParams.SetJarJarMappings(f.read()) 1413 JniParams.SetJarJarMappings(f.read())
1414 GenerateJNIHeader(input_file, output_file, options) 1414 GenerateJNIHeader(input_file, output_file, options)
1415 1415
1416 1416
1417 if __name__ == '__main__': 1417 if __name__ == '__main__':
1418 sys.exit(main(sys.argv)) 1418 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | build/config/android/config.gni » ('j') | ui/snapshot/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698