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("config.gni") | 5 import("config.gni") |
6 import("internal_rules.gni") | 6 import("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 18 matching lines...) Expand all Loading... |
29 assert(defined(invoker.jni_package)) | 29 assert(defined(invoker.jni_package)) |
30 jni_package = invoker.jni_package | 30 jni_package = invoker.jni_package |
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 sources = invoker.sources | 40 sources = invoker.sources |
40 source_prereqs = [ jni_generator_include ] | 41 source_prereqs = [ jni_generator_include ] |
41 outputs = [ | 42 outputs = [ |
| 43 depfile, |
42 "${jni_output_dir}/{{source_name_part}}_jni.h" | 44 "${jni_output_dir}/{{source_name_part}}_jni.h" |
43 ] | 45 ] |
44 | 46 |
45 args = [ | 47 args = [ |
| 48 "--depfile", rebase_path(depfile, root_build_dir), |
46 "--input_file={{source}}", | 49 "--input_file={{source}}", |
47 "--optimize_generation=1", | 50 "--optimize_generation=1", |
48 "--ptr_type=long", | 51 "--ptr_type=long", |
49 "--output_dir", rebase_path(jni_output_dir, root_build_dir), | 52 "--output_dir", rebase_path(jni_output_dir, root_build_dir), |
50 "--includes", rebase_path(jni_generator_include, "//"), | 53 "--includes", rebase_path(jni_generator_include, "//"), |
51 ] | 54 ] |
52 if (defined(invoker.jni_generator_jarjar_file)) { | 55 if (defined(invoker.jni_generator_jarjar_file)) { |
53 args += [ | 56 args += [ |
54 "--jarjar", rebase_path(jni_generator_jarjar_file, root_build_dir), | 57 "--jarjar", rebase_path(jni_generator_jarjar_file, root_build_dir), |
55 ] | 58 ] |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 # TODO(cjhopman): make jni_generator.py support generating jni for multiple | 119 # TODO(cjhopman): make jni_generator.py support generating jni for multiple |
117 # .class files from a .jar. | 120 # .class files from a .jar. |
118 jni_actions = [] | 121 jni_actions = [] |
119 foreach(class, invoker.classes) { | 122 foreach(class, invoker.classes) { |
120 classname_list = process_file_template( | 123 classname_list = process_file_template( |
121 [class], "{{source_name_part}}") | 124 [class], "{{source_name_part}}") |
122 classname = classname_list[0] | 125 classname = classname_list[0] |
123 jni_target_name = "${target_name}__jni_${classname}" | 126 jni_target_name = "${target_name}__jni_${classname}" |
124 jni_actions += [ ":$jni_target_name" ] | 127 jni_actions += [ ":$jni_target_name" ] |
125 action(jni_target_name) { | 128 action(jni_target_name) { |
| 129 depfile = "$target_gen_dir/$target_name.d" |
126 script = "//base/android/jni_generator/jni_generator.py" | 130 script = "//base/android/jni_generator/jni_generator.py" |
127 sources = [ | 131 sources = [ |
128 jni_generator_include, | 132 jni_generator_include, |
129 jar_file, | 133 jar_file, |
130 ] | 134 ] |
131 outputs = [ | 135 outputs = [ |
| 136 depfile, |
132 "${jni_output_dir}/${classname}_jni.h" | 137 "${jni_output_dir}/${classname}_jni.h" |
133 ] | 138 ] |
134 | 139 |
135 args = [ | 140 args = [ |
| 141 "--depfile", rebase_path(depfile, root_build_dir), |
136 "--jar_file", rebase_path(jar_file, root_build_dir), | 142 "--jar_file", rebase_path(jar_file, root_build_dir), |
137 "--input_file", class, | 143 "--input_file", class, |
138 "--optimize_generation=1", | 144 "--optimize_generation=1", |
139 "--ptr_type=long", | 145 "--ptr_type=long", |
140 "--output_dir", rebase_path(jni_output_dir, root_build_dir), | 146 "--output_dir", rebase_path(jni_output_dir, root_build_dir), |
141 "--includes", rebase_path(jni_generator_include, "//"), | 147 "--includes", rebase_path(jni_generator_include, "//"), |
142 ] | 148 ] |
143 } | 149 } |
144 } | 150 } |
145 | 151 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 include_path = invoker.include_path + "" | 204 include_path = invoker.include_path + "" |
199 } else { | 205 } else { |
200 include_path = "//" | 206 include_path = "//" |
201 } | 207 } |
202 | 208 |
203 action_foreach("${target_name}__apply_gcc") { | 209 action_foreach("${target_name}__apply_gcc") { |
204 script = "//build/android/gyp/gcc_preprocess.py" | 210 script = "//build/android/gyp/gcc_preprocess.py" |
205 if (defined(invoker.source_prereqs)) { | 211 if (defined(invoker.source_prereqs)) { |
206 source_prereqs = invoker.source_prereqs + [] | 212 source_prereqs = invoker.source_prereqs + [] |
207 } | 213 } |
| 214 depfile = "${target_gen_dir}/${target_name}.d" |
208 | 215 |
209 sources = invoker.sources | 216 sources = invoker.sources |
210 | 217 |
211 gen_dir = "${target_gen_dir}/${package_name}" | 218 gen_dir = "${target_gen_dir}/${package_name}" |
212 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" | 219 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" |
213 | 220 |
214 outputs = [ | 221 outputs = [ |
| 222 depfile, |
215 gcc_template_output_pattern | 223 gcc_template_output_pattern |
216 ] | 224 ] |
217 | 225 |
218 args = [ | 226 args = [ |
| 227 "--depfile", rebase_path(depfile, root_build_dir), |
219 "--include-path", rebase_path(include_path, root_build_dir), | 228 "--include-path", rebase_path(include_path, root_build_dir), |
220 "--output", rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.
java", | 229 "--output", rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.
java", |
221 "--template={{source}}", | 230 "--template={{source}}", |
222 ] | 231 ] |
223 } | 232 } |
224 | 233 |
225 apply_gcc_outputs = get_target_outputs(":${target_name}__apply_gcc") | 234 apply_gcc_outputs = get_target_outputs(":${target_name}__apply_gcc") |
226 base_gen_dir = get_label_info(":${target_name}__apply_gcc", "target_gen_dir") | 235 base_gen_dir = get_label_info(":${target_name}__apply_gcc", "target_gen_dir") |
227 | 236 |
228 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 237 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
229 zip("${target_name}__zip_srcjar") { | 238 zip("${target_name}__zip_srcjar") { |
230 inputs = apply_gcc_outputs | 239 inputs = apply_gcc_outputs |
231 output = srcjar_path | 240 output = srcjar_path |
232 base_dir = base_gen_dir | 241 base_dir = base_gen_dir |
233 } | 242 } |
234 | 243 |
235 group(target_name) { | 244 group(target_name) { |
236 deps = [ | 245 deps = [ |
237 ":${target_name}__zip_srcjar" | 246 ":${target_name}__zip_srcjar" |
238 ] | 247 ] |
239 } | 248 } |
240 } | 249 } |
OLD | NEW |