OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to generate jni bindings for system Java-files in a consistent manner. | 6 # to generate jni bindings for system Java-files in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'android_jar_jni_headers', | 10 # 'target_name': 'android_jar_jni_headers', |
11 # 'type': 'none', | 11 # 'type': 'none', |
12 # 'variables': { | 12 # 'variables': { |
13 # 'jni_gen_package': 'chrome', | 13 # 'jni_gen_package': 'chrome', |
14 # 'input_java_class': 'java/io/InputStream.class', | 14 # 'input_java_class': 'java/io/InputStream.class', |
15 # }, | 15 # }, |
16 # 'includes': [ '../build/jar_file_jni_generator.gypi' ], | 16 # 'includes': [ '../build/jar_file_jni_generator.gypi' ], |
17 # }, | 17 # }, |
| 18 # |
| 19 # Optional variables: |
| 20 # input_jar_file - The input jar file, if omitted, android_sdk_jar will be used
. |
18 | 21 |
19 { | 22 { |
20 'variables': { | 23 'variables': { |
21 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', | 24 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', |
22 }, | 25 }, |
23 'actions': [ | 26 'actions': [ |
24 { | 27 { |
25 'action_name': 'generate_jni_headers_from_jar_file', | 28 'action_name': 'generate_jni_headers_from_jar_file', |
26 'inputs': [ | 29 'inputs': [ |
27 '<(jni_generator)', | 30 '<(jni_generator)', |
| 31 '<(input_jar_file)', |
28 '<(android_sdk_jar)', | 32 '<(android_sdk_jar)', |
29 ], | 33 ], |
30 'variables': { | 34 'variables': { |
31 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")' | 35 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")', |
| 36 'input_jar_file%': '<(android_sdk_jar)' |
32 }, | 37 }, |
33 'outputs': [ | 38 'outputs': [ |
34 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', | 39 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', |
35 ], | 40 ], |
36 'action': [ | 41 'action': [ |
37 '<(jni_generator)', | 42 '<(jni_generator)', |
38 '-j', | 43 '-j', |
39 '<(android_sdk_jar)', | 44 '<(input_jar_file)', |
40 '--input_file', | 45 '--input_file', |
41 '<(input_java_class)', | 46 '<(input_java_class)', |
42 '--output_dir', | 47 '--output_dir', |
43 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', | 48 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', |
44 '--optimize_generation', | 49 '--optimize_generation', |
45 '<(optimize_jni_generation)', | 50 '<(optimize_jni_generation)', |
46 ], | 51 ], |
47 'message': 'Generating JNI bindings from <(android_sdk_jar)/<(input_java_
class)', | 52 'message': 'Generating JNI bindings from <(input_jar_file)/<(input_java_c
lass)', |
48 'process_outputs_as_sources': 1, | 53 'process_outputs_as_sources': 1, |
49 }, | 54 }, |
50 ], | 55 ], |
51 # This target exports a hard dependency because it generates header | 56 # This target exports a hard dependency because it generates header |
52 # files. | 57 # files. |
53 'hard_dependency': 1, | 58 'hard_dependency': 1, |
54 } | 59 } |
OLD | NEW |