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 # 'input_jar_file': '<(android_sdk)/android.jar', | |
16 # }, | 15 # }, |
17 # 'includes': [ '../build/jar_file_jni_generator.gypi' ], | 16 # 'includes': [ '../build/jar_file_jni_generator.gypi' ], |
18 # }, | 17 # }, |
19 | 18 |
20 { | 19 { |
21 'variables': { | 20 'variables': { |
22 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', | 21 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', |
23 }, | 22 }, |
24 'actions': [ | 23 'actions': [ |
25 { | 24 { |
26 'action_name': 'generate_jni_headers_from_jar_file', | 25 'action_name': 'generate_jni_headers_from_jar_file', |
27 'inputs': [ | 26 'inputs': [ |
28 '<(jni_generator)', | 27 '<(jni_generator)', |
29 '<(input_jar_file)', | 28 '<(android_sdk_jar)', |
30 ], | 29 ], |
31 'variables': { | 30 'variables': { |
32 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")' | 31 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")' |
33 }, | 32 }, |
34 'outputs': [ | 33 'outputs': [ |
35 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', | 34 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', |
36 ], | 35 ], |
37 'action': [ | 36 'action': [ |
38 '<(jni_generator)', | 37 '<(jni_generator)', |
39 '-j', | 38 '-j', |
40 '<(input_jar_file)', | 39 '<(android_sdk_jar)', |
41 '--input_file', | 40 '--input_file', |
42 '<(input_java_class)', | 41 '<(input_java_class)', |
43 '--output_dir', | 42 '--output_dir', |
44 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', | 43 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', |
45 '--optimize_generation', | 44 '--optimize_generation', |
46 '<(optimize_jni_generation)', | 45 '<(optimize_jni_generation)', |
47 ], | 46 ], |
48 'message': 'Generating JNI bindings from <(input_jar_file)/<(input_java_c
lass)', | 47 'message': 'Generating JNI bindings from <(android_sdk_jar)/<(input_java_
class)', |
49 'process_outputs_as_sources': 1, | 48 'process_outputs_as_sources': 1, |
50 }, | 49 }, |
51 ], | 50 ], |
52 # This target exports a hard dependency because it generates header | 51 # This target exports a hard dependency because it generates header |
53 # files. | 52 # files. |
54 'hard_dependency': 1, | 53 'hard_dependency': 1, |
55 } | 54 } |
OLD | NEW |