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 Java-files in a consistent manner. | 6 # to generate jni bindings for 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': 'base_jni_headers', | 10 # 'target_name': 'base_jni_headers', |
11 # 'type': 'none', | 11 # 'type': 'none', |
12 # 'variables': { | 12 # 'sources': [ |
13 # 'java_sources': [ | 13 # 'android/java/src/org/chromium/base/BuildInfo.java', |
14 # 'android/java/org/chromium/base/BuildInfo.java', | 14 # ... |
15 # 'android/java/org/chromium/base/PathUtils.java', | 15 # ... |
16 # 'android/java/org/chromium/base/SystemMessageHandler.java', | 16 # 'android/java/src/org/chromium/base/SystemMessageHandler.java', |
17 # ], | 17 # ], |
18 # 'jni_headers': [ | 18 # 'variables': { |
19 # '<(SHARED_INTERMEDIATE_DIR)/base/jni/build_info_jni.h', | 19 # 'jni_gen_dir': 'base', |
20 # '<(SHARED_INTERMEDIATE_DIR)/base/jni/path_utils_jni.h', | 20 # }, |
21 # '<(SHARED_INTERMEDIATE_DIR)/base/jni/system_message_handler_jni.h', | 21 # 'includes': [ '../build/jni_generator.gypi' ], |
22 # ], | 22 # }, |
23 # }, | |
24 # 'includes': [ '../build/jni_generator.gypi' ], | |
25 # } | |
26 # | 23 # |
27 # The ordering of the java_sources must match the ordering of jni_headers. The | 24 # The generated file name pattern can be seen on the "outputs" section below. |
28 # result is that for each Java file listed in java_sources, the corresponding | 25 # (note that RULE_INPUT_ROOT is the basename for the java file). |
29 # entry in jni_headers contains the JNI bindings produced from running the | |
30 # jni_generator on the input file. | |
31 # | 26 # |
32 # See base/android/jni_generator/jni_generator.py for more info about the | 27 # See base/android/jni_generator/jni_generator.py for more info about the |
33 # format of generating JNI bindings. | 28 # format of generating JNI bindings. |
34 | 29 |
35 { | 30 { |
36 'actions': [ | 31 'variables': { |
37 { | 32 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', |
38 'action_name': 'generate_jni_headers', | 33 }, |
39 'type': 'none', | 34 'rules': [ |
40 'inputs': [ | 35 { |
41 '<(DEPTH)/base/android/jni_generator/jni_generator.py', | 36 'rule_name': 'generate_jni_headers', |
42 '<@(java_sources)', | 37 'extension': 'java', |
43 ], | 38 'inputs': [ |
44 'outputs': [ | 39 '<(jni_generator)', |
45 '<@(jni_headers)', | 40 ], |
46 ], | 41 'outputs': [ |
47 'action': [ | 42 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_dir)/jni/<(RULE_INPUT_ROOT)_jni.h'
, |
48 'python', | 43 ], |
49 '<(DEPTH)/base/android/jni_generator/jni_generator.py', | 44 'action': [ |
50 '-o', | 45 '<(jni_generator)', |
51 '<@(_inputs)', | 46 '--input_file', |
52 '<@(_outputs)', | 47 '<(RULE_INPUT_PATH)', |
53 ], | 48 '--output_dir', |
54 }, | 49 '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_dir)/jni', |
| 50 ], |
| 51 'message': 'Generating JNI bindings from <(RULE_INPUT_PATH)', |
| 52 'process_outputs_as_sources': 1, |
| 53 }, |
55 ], | 54 ], |
| 55 # This target exports a hard dependency because it generates header |
| 56 # files. |
| 57 'hard_dependency': 1, |
56 } | 58 } |
OLD | NEW |