OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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. |
| 4 |
| 5 # Declare a jni target |
| 6 # |
| 7 # This target generates the native jni bindings for a set of .java files. |
| 8 # |
| 9 # See base/android/jni_generator/jni_generator.py for more info about the |
| 10 # format of generating JNI bindings. |
| 11 # |
| 12 # Variables |
| 13 # sources: list of .java files to generate jni for |
| 14 # jni_package: subdirectory path for generated bindings |
| 15 # |
| 16 # Example |
| 17 # generate_jni("foo_jni") { |
| 18 # sources = [ |
| 19 # "android/java/src/org/chromium/foo/Foo.java", |
| 20 # "android/java/src/org/chromium/foo/FooUtil.java", |
| 21 # ] |
| 22 # jni_package = "foo" |
| 23 # } |
| 24 template("generate_jni") { |
| 25 assert(defined(invoker.sources)) |
| 26 assert(defined(invoker.jni_package)) |
| 27 jni_package = invoker.jni_package |
| 28 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" |
| 29 jni_output_dir = "${base_output_dir}/jni" |
| 30 |
| 31 jni_generator_includes = |
| 32 rebase_path("//base/android/jni_generator/jni_generator_helper.h") |
| 33 |
| 34 config("jni_includes_${target_name}") { |
| 35 include_dirs = [ base_output_dir ] |
| 36 } |
| 37 |
| 38 action_foreach(target_name) { |
| 39 script = "//base/android/jni_generator/jni_generator.py" |
| 40 direct_dependent_configs = [ ":jni_includes_${target_name}" ] |
| 41 sources = invoker.sources |
| 42 outputs = [ |
| 43 "${jni_output_dir}/{{source_name_part}}_jni.h" |
| 44 ] |
| 45 |
| 46 args = [ |
| 47 "--input_file={{source}}", |
| 48 "--optimize_generation=1", |
| 49 "--ptr_type=long", |
| 50 "--output_dir", rebase_path(jni_output_dir), |
| 51 "--includes=${jni_generator_includes}", |
| 52 ] |
| 53 if (defined(invoker.jni_generator_jarjar_file)) { |
| 54 args += [ |
| 55 "--jarjar", rebase_path(jni_generator_jarjar_file) |
| 56 ] |
| 57 } |
| 58 |
| 59 hard_dep = true |
| 60 } |
| 61 } |
OLD | NEW |