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 # | 18 # |
19 # Optional variables: | 19 # Optional variables: |
20 # input_jar_file - The input jar file, if omitted, android_sdk_jar will be used
. | 20 # input_jar_file - The input jar file, if omitted, android_sdk_jar will be used
. |
21 | 21 |
22 { | 22 { |
23 'variables': { | 23 'variables': { |
24 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', | 24 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', |
25 # A comma separated string of include files. | 25 # A comma separated string of include files. |
26 'jni_generator_includes%': ( | 26 'jni_generator_includes%': ( |
27 'base/android/jni_generator/jni_generator_helper.h' | 27 'base/android/jni_generator/jni_generator_helper.h' |
28 ), | 28 ), |
29 }, | 29 }, |
| 30 'dependencies': [ |
| 31 '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy', |
| 32 ], |
30 'actions': [ | 33 'actions': [ |
31 { | 34 { |
32 'action_name': 'generate_jni_headers_from_jar_file', | 35 'action_name': 'generate_jni_headers_from_jar_file', |
33 'inputs': [ | 36 'inputs': [ |
34 '<(jni_generator)', | 37 '<(jni_generator)', |
35 '<(input_jar_file)', | 38 '<(input_jar_file)', |
36 '<(android_sdk_jar)', | 39 '<(android_sdk_jar)', |
37 ], | 40 ], |
38 'variables': { | 41 'variables': { |
39 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")', | 42 'java_class_name': '<!(basename <(input_java_class)|sed "s/\.class//")', |
40 'input_jar_file%': '<(android_sdk_jar)' | 43 'input_jar_file%': '<(android_sdk_jar)' |
41 }, | 44 }, |
42 'outputs': [ | 45 'outputs': [ |
43 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', | 46 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(java_class_name)_jn
i.h', |
44 ], | 47 ], |
45 'action': [ | 48 'action': [ |
46 '<(jni_generator)', | 49 '<(jni_generator)', |
47 '-j', | 50 '-j', |
48 '<(input_jar_file)', | 51 '<(input_jar_file)', |
49 '--input_file', | 52 '--input_file', |
50 '<(input_java_class)', | 53 '<(input_java_class)', |
51 '--output_dir', | 54 '--output_dir', |
52 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', | 55 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni', |
53 '--includes', | 56 '--includes', |
54 '<(jni_generator_includes)', | 57 '<(jni_generator_includes)', |
55 '--optimize_generation', | 58 '--optimize_generation', |
56 '<(optimize_jni_generation)', | 59 '<(optimize_jni_generation)', |
| 60 '--native_exports', |
57 ], | 61 ], |
58 'message': 'Generating JNI bindings from <(input_jar_file)/<(input_java_c
lass)', | 62 'message': 'Generating JNI bindings from <(input_jar_file)/<(input_java_c
lass)', |
59 'process_outputs_as_sources': 1, | 63 'process_outputs_as_sources': 1, |
60 }, | 64 }, |
61 ], | 65 ], |
62 # This target exports a hard dependency because it generates header | 66 # This target exports a hard dependency because it generates header |
63 # files. | 67 # files. |
64 'hard_dependency': 1, | 68 'hard_dependency': 1, |
| 69 'conditions': [ |
| 70 ['component=="static_library"', { |
| 71 'link_settings': { |
| 72 'ldflags': [ |
| 73 # Only export symbols that are specified in version script. |
| 74 '-Wl,--version-script=<(android_linker_script)', |
| 75 ], |
| 76 'ldflags!': [ |
| 77 '-Wl,--exclude-libs=ALL', |
| 78 ], |
| 79 }, |
| 80 }], |
| 81 ], |
65 } | 82 } |
OLD | NEW |