michael@0: # Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: # This file is meant to be included into a target to provide a rule michael@0: # to generate jni bindings for Java-files in a consistent manner. michael@0: # michael@0: # To use this, create a gyp target with the following form: michael@0: # { michael@0: # 'target_name': 'base_jni_headers', michael@0: # 'type': 'none', michael@0: # 'sources': [ michael@0: # 'android/java/src/org/chromium/base/BuildInfo.java', michael@0: # ... michael@0: # ... michael@0: # 'android/java/src/org/chromium/base/SystemMessageHandler.java', michael@0: # ], michael@0: # 'variables': { michael@0: # 'jni_gen_dir': 'base', michael@0: # }, michael@0: # 'includes': [ '../build/jni_generator.gypi' ], michael@0: # }, michael@0: # michael@0: # The generated file name pattern can be seen on the "outputs" section below. michael@0: # (note that RULE_INPUT_ROOT is the basename for the java file). michael@0: # michael@0: # See base/android/jni_generator/jni_generator.py for more info about the michael@0: # format of generating JNI bindings. michael@0: michael@0: { michael@0: 'variables': { michael@0: 'jni_generator': '<(DEPTH)/base/android/jni_generator/jni_generator.py', michael@0: }, michael@0: 'rules': [ michael@0: { michael@0: 'rule_name': 'generate_jni_headers', michael@0: 'extension': 'java', michael@0: 'inputs': [ michael@0: '<(jni_generator)', michael@0: ], michael@0: 'outputs': [ michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_dir)/jni/<(RULE_INPUT_ROOT)_jni.h', michael@0: ], michael@0: 'action': [ michael@0: '<(jni_generator)', michael@0: '--input_file', michael@0: '<(RULE_INPUT_PATH)', michael@0: '--output_dir', michael@0: '<(SHARED_INTERMEDIATE_DIR)/<(jni_gen_dir)/jni', michael@0: ], michael@0: 'message': 'Generating JNI bindings from <(RULE_INPUT_PATH)', michael@0: 'process_outputs_as_sources': 1, michael@0: }, michael@0: ], michael@0: # This target exports a hard dependency because it generates header michael@0: # files. michael@0: 'hard_dependency': 1, michael@0: }