OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 | 7 |
8 # Declare a jni target | 8 # Declare a jni target |
9 # | 9 # |
10 # This target generates the native jni bindings for a set of .java files. | 10 # This target generates the native jni bindings for a set of .java files. |
(...skipping 20 matching lines...) Expand all Loading... |
31 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" | 31 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" |
32 jni_output_dir = "${base_output_dir}/jni" | 32 jni_output_dir = "${base_output_dir}/jni" |
33 | 33 |
34 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" | 34 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" |
35 | 35 |
36 foreach_target_name = "${target_name}__jni_gen" | 36 foreach_target_name = "${target_name}__jni_gen" |
37 action_foreach(foreach_target_name) { | 37 action_foreach(foreach_target_name) { |
38 script = "//base/android/jni_generator/jni_generator.py" | 38 script = "//base/android/jni_generator/jni_generator.py" |
39 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" | 39 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" |
40 sources = invoker.sources | 40 sources = invoker.sources |
41 source_prereqs = [ jni_generator_include ] | 41 inputs = [ jni_generator_include ] |
42 outputs = [ | 42 outputs = [ |
43 depfile, | 43 depfile, |
44 "${jni_output_dir}/{{source_name_part}}_jni.h" | 44 "${jni_output_dir}/{{source_name_part}}_jni.h" |
45 ] | 45 ] |
46 | 46 |
47 args = [ | 47 args = [ |
48 "--depfile", rebase_path(depfile, root_build_dir), | 48 "--depfile", rebase_path(depfile, root_build_dir), |
49 "--input_file={{source}}", | 49 "--input_file={{source}}", |
50 "--optimize_generation=1", | 50 "--optimize_generation=1", |
51 "--ptr_type=long", | 51 "--ptr_type=long", |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 # | 175 # |
176 # This target will create a single .srcjar. Adding this target to an | 176 # This target will create a single .srcjar. Adding this target to an |
177 # android_library target's srcjar_deps will make the generated java files be | 177 # android_library target's srcjar_deps will make the generated java files be |
178 # included in that library's final outputs. | 178 # included in that library's final outputs. |
179 # | 179 # |
180 # Variables | 180 # Variables |
181 # sources: list of files to be processed by the C pre-processor. For each | 181 # sources: list of files to be processed by the C pre-processor. For each |
182 # file in sources, there will be one .java file in the final .srcjar. For a | 182 # file in sources, there will be one .java file in the final .srcjar. For a |
183 # file named FooBar.template, a java file will be created with name | 183 # file named FooBar.template, a java file will be created with name |
184 # FooBar.java. | 184 # FooBar.java. |
185 # source_prereqs: additional compile-time dependencies. Any files | 185 # inputs: additional compile-time dependencies. Any files |
186 # `#include`-ed in the templates should be listed here. | 186 # `#include`-ed in the templates should be listed here. |
187 # package_name: this will be the subdirectory for each .java file in the .srcj
ar. | 187 # package_name: this will be the subdirectory for each .java file in the .srcj
ar. |
188 # | 188 # |
189 # Example | 189 # Example |
190 # java_cpp_template("foo_generated_enum") { | 190 # java_cpp_template("foo_generated_enum") { |
191 # sources = [ | 191 # sources = [ |
192 # "android/java/templates/Foo.template", | 192 # "android/java/templates/Foo.template", |
193 # ] | 193 # ] |
194 # source_prereqs = [ | 194 # inputs = [ |
195 # "android/java/templates/native_foo_header.h", | 195 # "android/java/templates/native_foo_header.h", |
196 # ] | 196 # ] |
197 # | 197 # |
198 # package_name = "org/chromium/base/library_loader" | 198 # package_name = "org/chromium/base/library_loader" |
199 # include_path = "android/java/templates" | 199 # include_path = "android/java/templates" |
200 # } | 200 # } |
201 template("java_cpp_template") { | 201 template("java_cpp_template") { |
202 assert(defined(invoker.sources)) | 202 assert(defined(invoker.sources)) |
203 package_name = invoker.package_name + "" | 203 package_name = invoker.package_name + "" |
204 | 204 |
205 if (defined(invoker.include_path)) { | 205 if (defined(invoker.include_path)) { |
206 include_path = invoker.include_path + "" | 206 include_path = invoker.include_path + "" |
207 } else { | 207 } else { |
208 include_path = "//" | 208 include_path = "//" |
209 } | 209 } |
210 | 210 |
211 action_foreach("${target_name}__apply_gcc") { | 211 action_foreach("${target_name}__apply_gcc") { |
212 script = "//build/android/gyp/gcc_preprocess.py" | 212 script = "//build/android/gyp/gcc_preprocess.py" |
213 if (defined(invoker.source_prereqs)) { | 213 if (defined(invoker.inputs)) { |
214 source_prereqs = invoker.source_prereqs + [] | 214 inputs = invoker.inputs + [] |
215 } | 215 } |
216 depfile = "${target_gen_dir}/${target_name}.d" | 216 depfile = "${target_gen_dir}/${target_name}.d" |
217 | 217 |
218 sources = invoker.sources | 218 sources = invoker.sources |
219 | 219 |
220 gen_dir = "${target_gen_dir}/${package_name}" | 220 gen_dir = "${target_gen_dir}/${package_name}" |
221 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" | 221 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" |
222 | 222 |
223 outputs = [ | 223 outputs = [ |
224 depfile, | 224 depfile, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 if (defined(invoker.jar_excluded_patterns)) { | 308 if (defined(invoker.jar_excluded_patterns)) { |
309 jar_excluded_patterns = invoker.jar_excluded_patterns | 309 jar_excluded_patterns = invoker.jar_excluded_patterns |
310 } | 310 } |
311 | 311 |
312 if (defined(invoker.srcjar_deps)) { | 312 if (defined(invoker.srcjar_deps)) { |
313 srcjar_deps = invoker.srcjar_deps | 313 srcjar_deps = invoker.srcjar_deps |
314 } | 314 } |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
OLD | NEW |