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
3 # found in the LICENSE file.
5 # This file is meant to be included into a target to provide a rule
6 # to generate jni bindings for Java-files in a consistent manner.
8 # To use this, create a gyp target with the following form:
10 # 'target_name': 'base_jni_headers',
13 # 'android/java/src/org/chromium/base/BuildInfo.java',
16 # 'android/java/src/org/chromium/base/SystemMessageHandler.java',
19 # 'jni_gen_package': 'base',
21 # 'includes': [ '../build/jni_generator.gypi' ],
24 # The generated file name pattern can be seen on the "outputs" section below.
25 # (note that RULE_INPUT_ROOT is the basename for the java file).
27 # See base/android/jni_generator/jni_generator.py for more info about the
28 # format of generating JNI bindings.
32 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py',
33 'jni_generator_jarjar_file%': '',
34 'jni_generator_ptr_type%': 'long',
35 # A comma separated string of include files.
36 'jni_generator_includes%': (
37 'base/android/jni_generator/jni_generator_helper.h'
39 'native_exports%': '',
42 '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy',
46 'rule_name': 'generate_jni_headers',
52 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/<(RULE_INPUT_ROOT)_jni.h',
59 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni',
61 '<(jni_generator_includes)',
62 '--optimize_generation',
63 '<(optimize_jni_generation)',
65 '<(jni_generator_jarjar_file)',
67 '<(jni_generator_ptr_type)',
70 'message': 'Generating JNI bindings from <(RULE_INPUT_PATH)',
71 'process_outputs_as_sources': 1,
73 ['jni_generator_jarjar_file != ""', {
75 '<(jni_generator_jarjar_file)',
81 'direct_dependent_settings': {
83 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)',
86 # This target exports a hard dependency because it generates header
90 ['android_webview_build==1', {
92 'native_exports%': '--native_exports',
95 '<(DEPTH)/build/linker_script_copy.gyp:linker_script_copy',
98 ['component=="static_library"', {
101 # Only export symbols that are specified in version script.
102 '-Wl,--version-script=<(android_linker_script)',
105 '-Wl,--exclude-libs=ALL',