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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//tools/grit/grit_rule.gni") | 8 import("//tools/grit/grit_rule.gni") |
9 import("//tools/relocation_packer/config.gni") | 9 import("//tools/relocation_packer/config.gni") |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 # | 23 # |
24 # Example | 24 # Example |
25 # generate_jni("foo_jni") { | 25 # generate_jni("foo_jni") { |
26 # sources = [ | 26 # sources = [ |
27 # "android/java/src/org/chromium/foo/Foo.java", | 27 # "android/java/src/org/chromium/foo/Foo.java", |
28 # "android/java/src/org/chromium/foo/FooUtil.java", | 28 # "android/java/src/org/chromium/foo/FooUtil.java", |
29 # ] | 29 # ] |
30 # jni_package = "foo" | 30 # jni_package = "foo" |
31 # } | 31 # } |
32 template("generate_jni") { | 32 template("generate_jni") { |
33 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 33 if (defined(invoker.testonly)) { |
| 34 testonly = invoker.testonly |
| 35 } |
34 | 36 |
35 assert(defined(invoker.sources)) | 37 assert(defined(invoker.sources)) |
36 assert(defined(invoker.jni_package)) | 38 assert(defined(invoker.jni_package)) |
37 jni_package = invoker.jni_package | 39 jni_package = invoker.jni_package |
38 base_output_dir = "${target_gen_dir}/${target_name}" | 40 base_output_dir = "${target_gen_dir}/${target_name}" |
39 package_output_dir = "${base_output_dir}/${jni_package}" | 41 package_output_dir = "${base_output_dir}/${jni_package}" |
40 jni_output_dir = "${package_output_dir}/jni" | 42 jni_output_dir = "${package_output_dir}/jni" |
41 | 43 |
42 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" | 44 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" |
43 | 45 |
44 foreach_target_name = "${target_name}__jni_gen" | 46 foreach_target_name = "${target_name}__jni_gen" |
45 action_foreach(foreach_target_name) { | 47 action_foreach(foreach_target_name) { |
46 script = "//base/android/jni_generator/jni_generator.py" | 48 script = "//base/android/jni_generator/jni_generator.py" |
47 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" | 49 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" |
48 sources = invoker.sources | 50 sources = invoker.sources |
49 inputs = [ jni_generator_include ] | 51 inputs = [ |
| 52 jni_generator_include, |
| 53 ] |
50 outputs = [ | 54 outputs = [ |
51 depfile, | 55 depfile, |
52 "${jni_output_dir}/{{source_name_part}}_jni.h" | 56 "${jni_output_dir}/{{source_name_part}}_jni.h", |
53 ] | 57 ] |
54 | 58 |
55 args = [ | 59 args = [ |
56 "--depfile", rebase_path(depfile, root_build_dir), | 60 "--depfile", |
| 61 rebase_path(depfile, root_build_dir), |
57 "--input_file={{source}}", | 62 "--input_file={{source}}", |
58 "--optimize_generation=1", | 63 "--optimize_generation=1", |
59 "--ptr_type=long", | 64 "--ptr_type=long", |
60 "--output_dir", rebase_path(jni_output_dir, root_build_dir), | 65 "--output_dir", |
61 "--includes", rebase_path(jni_generator_include, "//"), | 66 rebase_path(jni_output_dir, root_build_dir), |
| 67 "--includes", |
| 68 rebase_path(jni_generator_include, "//"), |
62 ] | 69 ] |
63 if (defined(invoker.jni_generator_jarjar_file)) { | 70 if (defined(invoker.jni_generator_jarjar_file)) { |
64 args += [ | 71 args += [ |
65 "--jarjar", rebase_path(jni_generator_jarjar_file, root_build_dir), | 72 "--jarjar", |
| 73 rebase_path(jni_generator_jarjar_file, root_build_dir), |
66 ] | 74 ] |
67 } | 75 } |
68 } | 76 } |
69 | 77 |
70 config("jni_includes_${target_name}") { | 78 config("jni_includes_${target_name}") { |
71 # TODO(cjhopman): #includes should probably all be relative to | 79 # TODO(cjhopman): #includes should probably all be relative to |
72 # base_output_dir. Remove that from this config once the includes are | 80 # base_output_dir. Remove that from this config once the includes are |
73 # updated. | 81 # updated. |
74 include_dirs = [ | 82 include_dirs = [ |
75 base_output_dir, | 83 base_output_dir, |
76 package_output_dir, | 84 package_output_dir, |
77 ] | 85 ] |
78 } | 86 } |
79 | 87 |
80 group(target_name) { | 88 group(target_name) { |
81 deps = [ ":$foreach_target_name" ] | 89 deps = [ |
| 90 ":$foreach_target_name", |
| 91 ] |
82 public_configs = [ ":jni_includes_${target_name}" ] | 92 public_configs = [ ":jni_includes_${target_name}" ] |
83 | 93 |
84 if (defined(invoker.deps)) { | 94 if (defined(invoker.deps)) { |
85 deps += invoker.deps | 95 deps += invoker.deps |
86 } | 96 } |
87 if (defined(invoker.public_deps)) { | 97 if (defined(invoker.public_deps)) { |
88 public_deps = invoker.public_deps | 98 public_deps = invoker.public_deps |
89 } | 99 } |
90 | 100 |
91 if (defined(invoker.visibility)) { visibility = invoker.visibility } | 101 if (defined(invoker.visibility)) { |
| 102 visibility = invoker.visibility |
| 103 } |
92 } | 104 } |
93 } | 105 } |
94 | 106 |
95 | |
96 # Declare a jni target for a prebuilt jar | 107 # Declare a jni target for a prebuilt jar |
97 # | 108 # |
98 # This target generates the native jni bindings for a set of classes in a .jar. | 109 # This target generates the native jni bindings for a set of classes in a .jar. |
99 # | 110 # |
100 # See base/android/jni_generator/jni_generator.py for more info about the | 111 # See base/android/jni_generator/jni_generator.py for more info about the |
101 # format of generating JNI bindings. | 112 # format of generating JNI bindings. |
102 # | 113 # |
103 # Variables | 114 # Variables |
104 # classes: list of .class files in the jar to generate jni for. These should | 115 # classes: list of .class files in the jar to generate jni for. These should |
105 # include the full path to the .class file. | 116 # include the full path to the .class file. |
106 # jni_package: subdirectory path for generated bindings | 117 # jni_package: subdirectory path for generated bindings |
107 # jar_file: the path to the .jar. If not provided, will default to the sdk's | 118 # jar_file: the path to the .jar. If not provided, will default to the sdk's |
108 # android.jar | 119 # android.jar |
109 # | 120 # |
110 # deps, public_deps: As normal | 121 # deps, public_deps: As normal |
111 # | 122 # |
112 # Example | 123 # Example |
113 # generate_jar_jni("foo_jni") { | 124 # generate_jar_jni("foo_jni") { |
114 # classes = [ | 125 # classes = [ |
115 # "android/view/Foo.class", | 126 # "android/view/Foo.class", |
116 # ] | 127 # ] |
117 # jni_package = "foo" | 128 # jni_package = "foo" |
118 # } | 129 # } |
119 template("generate_jar_jni") { | 130 template("generate_jar_jni") { |
120 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 131 if (defined(invoker.testonly)) { |
| 132 testonly = invoker.testonly |
| 133 } |
121 | 134 |
122 assert(defined(invoker.classes)) | 135 assert(defined(invoker.classes)) |
123 assert(defined(invoker.jni_package)) | 136 assert(defined(invoker.jni_package)) |
124 | 137 |
125 if (defined(invoker.jar_file)) { | 138 if (defined(invoker.jar_file)) { |
126 jar_file = invoker.jar_file | 139 jar_file = invoker.jar_file |
127 } else { | 140 } else { |
128 jar_file = android_sdk_jar | 141 jar_file = android_sdk_jar |
129 } | 142 } |
130 | 143 |
131 jni_package = invoker.jni_package | 144 jni_package = invoker.jni_package |
132 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" | 145 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" |
133 jni_output_dir = "${base_output_dir}/jni" | 146 jni_output_dir = "${base_output_dir}/jni" |
134 | 147 |
135 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" | 148 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" |
136 | 149 |
137 # TODO(cjhopman): make jni_generator.py support generating jni for multiple | 150 # TODO(cjhopman): make jni_generator.py support generating jni for multiple |
138 # .class files from a .jar. | 151 # .class files from a .jar. |
139 jni_actions = [] | 152 jni_actions = [] |
140 foreach(class, invoker.classes) { | 153 foreach(class, invoker.classes) { |
141 _classname_list = [] | 154 _classname_list = [] |
142 _classname_list = process_file_template( | 155 _classname_list = process_file_template([ class ], "{{source_name_part}}") |
143 [class], "{{source_name_part}}") | |
144 classname = _classname_list[0] | 156 classname = _classname_list[0] |
145 jni_target_name = "${target_name}__jni_${classname}" | 157 jni_target_name = "${target_name}__jni_${classname}" |
146 jni_actions += [ ":$jni_target_name" ] | 158 jni_actions += [ ":$jni_target_name" ] |
147 action(jni_target_name) { | 159 action(jni_target_name) { |
148 depfile = "$target_gen_dir/$target_name.d" | 160 depfile = "$target_gen_dir/$target_name.d" |
149 script = "//base/android/jni_generator/jni_generator.py" | 161 script = "//base/android/jni_generator/jni_generator.py" |
150 sources = [ | 162 sources = [ |
151 jni_generator_include, | 163 jni_generator_include, |
152 jar_file, | 164 jar_file, |
153 ] | 165 ] |
154 outputs = [ | 166 outputs = [ |
155 depfile, | 167 depfile, |
156 "${jni_output_dir}/${classname}_jni.h" | 168 "${jni_output_dir}/${classname}_jni.h", |
157 ] | 169 ] |
158 | 170 |
159 args = [ | 171 args = [ |
160 "--depfile", rebase_path(depfile, root_build_dir), | 172 "--depfile", |
161 "--jar_file", rebase_path(jar_file, root_build_dir), | 173 rebase_path(depfile, root_build_dir), |
162 "--input_file", class, | 174 "--jar_file", |
| 175 rebase_path(jar_file, root_build_dir), |
| 176 "--input_file", |
| 177 class, |
163 "--optimize_generation=1", | 178 "--optimize_generation=1", |
164 "--ptr_type=long", | 179 "--ptr_type=long", |
165 "--output_dir", rebase_path(jni_output_dir, root_build_dir), | 180 "--output_dir", |
166 "--includes", rebase_path(jni_generator_include, root_build_dir), | 181 rebase_path(jni_output_dir, root_build_dir), |
| 182 "--includes", |
| 183 rebase_path(jni_generator_include, root_build_dir), |
167 ] | 184 ] |
168 } | 185 } |
169 } | 186 } |
170 | 187 |
171 config("jni_includes_${target_name}") { | 188 config("jni_includes_${target_name}") { |
172 include_dirs = [ base_output_dir ] | 189 include_dirs = [ base_output_dir ] |
173 } | 190 } |
174 | 191 |
175 group(target_name) { | 192 group(target_name) { |
176 deps = jni_actions | 193 deps = jni_actions |
177 if (defined(invoker.deps)) { | 194 if (defined(invoker.deps)) { |
178 deps += invoker.deps | 195 deps += invoker.deps |
179 } | 196 } |
180 if (defined(invoker.public_deps)) { | 197 if (defined(invoker.public_deps)) { |
181 public_deps = invoker.public_deps | 198 public_deps = invoker.public_deps |
182 } | 199 } |
183 public_configs = [ ":jni_includes_${target_name}" ] | 200 public_configs = [ ":jni_includes_${target_name}" ] |
184 } | 201 } |
185 } | 202 } |
186 | 203 |
187 | |
188 # Declare a target for c-preprocessor-generated java files | 204 # Declare a target for c-preprocessor-generated java files |
189 # | 205 # |
190 # NOTE: For generating Java conterparts to enums prefer using the java_cpp_enum | 206 # NOTE: For generating Java conterparts to enums prefer using the java_cpp_enum |
191 # rule instead. | 207 # rule instead. |
192 # | 208 # |
193 # This target generates java files using the host C pre-processor. Each file in | 209 # This target generates java files using the host C pre-processor. Each file in |
194 # sources will be compiled using the C pre-processor. If include_path is | 210 # sources will be compiled using the C pre-processor. If include_path is |
195 # specified, it will be passed (with --I) to the pre-processor. | 211 # specified, it will be passed (with --I) to the pre-processor. |
196 # | 212 # |
197 # This target will create a single .srcjar. Adding this target to an | 213 # This target will create a single .srcjar. Adding this target to an |
(...skipping 16 matching lines...) Expand all Loading... |
214 # "android/java/templates/Foo.template", | 230 # "android/java/templates/Foo.template", |
215 # ] | 231 # ] |
216 # inputs = [ | 232 # inputs = [ |
217 # "android/java/templates/native_foo_header.h", | 233 # "android/java/templates/native_foo_header.h", |
218 # ] | 234 # ] |
219 # | 235 # |
220 # package_name = "org/chromium/base/library_loader" | 236 # package_name = "org/chromium/base/library_loader" |
221 # include_path = "android/java/templates" | 237 # include_path = "android/java/templates" |
222 # } | 238 # } |
223 template("java_cpp_template") { | 239 template("java_cpp_template") { |
224 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 240 if (defined(invoker.testonly)) { |
| 241 testonly = invoker.testonly |
| 242 } |
225 | 243 |
226 assert(defined(invoker.sources)) | 244 assert(defined(invoker.sources)) |
227 package_name = invoker.package_name + "" | 245 package_name = invoker.package_name + "" |
228 | 246 |
229 if (defined(invoker.include_path)) { | 247 if (defined(invoker.include_path)) { |
230 include_path = invoker.include_path + "" | 248 include_path = invoker.include_path + "" |
231 } else { | 249 } else { |
232 include_path = "//" | 250 include_path = "//" |
233 } | 251 } |
234 | 252 |
235 action_foreach("${target_name}__apply_gcc") { | 253 action_foreach("${target_name}__apply_gcc") { |
236 script = "//build/android/gyp/gcc_preprocess.py" | 254 script = "//build/android/gyp/gcc_preprocess.py" |
237 if (defined(invoker.inputs)) { | 255 if (defined(invoker.inputs)) { |
238 inputs = invoker.inputs + [] | 256 inputs = invoker.inputs + [] |
239 } | 257 } |
240 depfile = "${target_gen_dir}/${target_name}_{{source_name_part}}.d" | 258 depfile = "${target_gen_dir}/${target_name}_{{source_name_part}}.d" |
241 | 259 |
242 sources = invoker.sources | 260 sources = invoker.sources |
243 | 261 |
244 gen_dir = "${target_gen_dir}/${target_name}/java_cpp_template/${package_name
}" | 262 gen_dir = |
| 263 "${target_gen_dir}/${target_name}/java_cpp_template/${package_name}" |
245 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" | 264 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" |
246 | 265 |
247 outputs = [ | 266 outputs = [ |
248 depfile, | 267 depfile, |
249 gcc_template_output_pattern | 268 gcc_template_output_pattern, |
250 ] | 269 ] |
251 | 270 |
252 args = [ | 271 args = [ |
253 "--depfile", rebase_path(depfile, root_build_dir), | 272 "--depfile", |
254 "--include-path", rebase_path(include_path, root_build_dir), | 273 rebase_path(depfile, root_build_dir), |
255 "--output", rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.
java", | 274 "--include-path", |
| 275 rebase_path(include_path, root_build_dir), |
| 276 "--output", |
| 277 rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.java", |
256 "--template={{source}}", | 278 "--template={{source}}", |
257 ] | 279 ] |
258 | 280 |
259 if (defined(invoker.defines)) { | 281 if (defined(invoker.defines)) { |
260 foreach(def, invoker.defines) { | 282 foreach(def, invoker.defines) { |
261 args += ["--defines", def] | 283 args += [ |
| 284 "--defines", |
| 285 def, |
| 286 ] |
262 } | 287 } |
263 } | 288 } |
264 } | 289 } |
265 | 290 |
266 apply_gcc_outputs = get_target_outputs(":${target_name}__apply_gcc") | 291 apply_gcc_outputs = get_target_outputs(":${target_name}__apply_gcc") |
267 base_gen_dir = get_label_info(":${target_name}__apply_gcc", "target_gen_dir") | 292 base_gen_dir = get_label_info(":${target_name}__apply_gcc", "target_gen_dir") |
268 | 293 |
269 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 294 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
270 zip("${target_name}__zip_srcjar") { | 295 zip("${target_name}__zip_srcjar") { |
271 inputs = apply_gcc_outputs | 296 inputs = apply_gcc_outputs |
272 output = srcjar_path | 297 output = srcjar_path |
273 base_dir = base_gen_dir | 298 base_dir = base_gen_dir |
274 } | 299 } |
275 | 300 |
276 group(target_name) { | 301 group(target_name) { |
277 deps = [ | 302 deps = [ |
278 ":${target_name}__zip_srcjar" | 303 ":${target_name}__zip_srcjar", |
279 ] | 304 ] |
280 } | 305 } |
281 } | 306 } |
282 | 307 |
283 # Declare a target for generating Java classes from C++ enums. | 308 # Declare a target for generating Java classes from C++ enums. |
284 # | 309 # |
285 # This target generates Java files from C++ enums using a script. | 310 # This target generates Java files from C++ enums using a script. |
286 # | 311 # |
287 # This target will create a single .srcjar. Adding this target to an | 312 # This target will create a single .srcjar. Adding this target to an |
288 # android_library target's srcjar_deps will make the generated java files be | 313 # android_library target's srcjar_deps will make the generated java files be |
(...skipping 12 matching lines...) Expand all Loading... |
301 # Example | 326 # Example |
302 # java_cpp_enum("foo_generated_enum") { | 327 # java_cpp_enum("foo_generated_enum") { |
303 # sources = [ | 328 # sources = [ |
304 # "src/native_foo_header.h", | 329 # "src/native_foo_header.h", |
305 # ] | 330 # ] |
306 # outputs = [ | 331 # outputs = [ |
307 # "org/chromium/FooEnum.java", | 332 # "org/chromium/FooEnum.java", |
308 # ] | 333 # ] |
309 # } | 334 # } |
310 template("java_cpp_enum") { | 335 template("java_cpp_enum") { |
311 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 336 if (defined(invoker.testonly)) { |
| 337 testonly = invoker.testonly |
| 338 } |
312 | 339 |
313 assert(defined(invoker.sources)) | 340 assert(defined(invoker.sources)) |
314 assert(defined(invoker.outputs)) | 341 assert(defined(invoker.outputs)) |
315 | 342 |
316 action("${target_name}__generate_enum") { | 343 action("${target_name}__generate_enum") { |
317 sources = invoker.sources | 344 sources = invoker.sources |
318 script = "//build/android/gyp/java_cpp_enum.py" | 345 script = "//build/android/gyp/java_cpp_enum.py" |
319 gen_dir = "${target_gen_dir}/${target_name}/enums" | 346 gen_dir = "${target_gen_dir}/${target_name}/enums" |
320 outputs = get_path_info( | 347 outputs = |
321 rebase_path(invoker.outputs, ".", gen_dir), "abspath") | 348 get_path_info(rebase_path(invoker.outputs, ".", gen_dir), "abspath") |
322 | 349 |
323 args = [ | 350 args = [ |
324 "--output_dir", rebase_path(gen_dir, root_build_dir), | 351 "--output_dir", |
| 352 rebase_path(gen_dir, root_build_dir), |
325 ] | 353 ] |
326 foreach(output, rebase_path(outputs, root_build_dir)) { | 354 foreach(output, rebase_path(outputs, root_build_dir)) { |
327 args += ["--assert_file", output] | 355 args += [ |
| 356 "--assert_file", |
| 357 output, |
| 358 ] |
328 } | 359 } |
329 args += rebase_path(invoker.sources, root_build_dir) | 360 args += rebase_path(invoker.sources, root_build_dir) |
330 } | 361 } |
331 | 362 |
332 generate_enum_outputs = get_target_outputs(":${target_name}__generate_enum") | 363 generate_enum_outputs = get_target_outputs(":${target_name}__generate_enum") |
333 base_gen_dir = get_label_info(":${target_name}__generate_enum", | 364 base_gen_dir = |
334 "target_gen_dir") | 365 get_label_info(":${target_name}__generate_enum", "target_gen_dir") |
335 | 366 |
336 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 367 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
337 zip("${target_name}__zip_srcjar") { | 368 zip("${target_name}__zip_srcjar") { |
338 inputs = generate_enum_outputs | 369 inputs = generate_enum_outputs |
339 output = srcjar_path | 370 output = srcjar_path |
340 base_dir = base_gen_dir | 371 base_dir = base_gen_dir |
341 } | 372 } |
342 | 373 |
343 group(target_name) { | 374 group(target_name) { |
344 deps = [ | 375 deps = [ |
345 ":${target_name}__zip_srcjar" | 376 ":${target_name}__zip_srcjar", |
346 ] | 377 ] |
347 } | 378 } |
348 } | 379 } |
349 | 380 |
350 # Declare a target for processing a Jinja template. | 381 # Declare a target for processing a Jinja template. |
351 # | 382 # |
352 # Variables | 383 # Variables |
353 # input: The template file to be processed. | 384 # input: The template file to be processed. |
354 # output: Where to save the result. | 385 # output: Where to save the result. |
355 # variables: (Optional) A list of variables to make available to the template | 386 # variables: (Optional) A list of variables to make available to the template |
356 # processing environment, e.g. ["name=foo", "color=red"]. | 387 # processing environment, e.g. ["name=foo", "color=red"]. |
357 # | 388 # |
358 # Example | 389 # Example |
359 # jinja_template("chrome_shell_manifest") { | 390 # jinja_template("chrome_shell_manifest") { |
360 # input = "shell/java/AndroidManifest.xml" | 391 # input = "shell/java/AndroidManifest.xml" |
361 # output = "$target_gen_dir/AndroidManifest.xml" | 392 # output = "$target_gen_dir/AndroidManifest.xml" |
362 # } | 393 # } |
363 template("jinja_template") { | 394 template("jinja_template") { |
364 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 395 if (defined(invoker.testonly)) { |
| 396 testonly = invoker.testonly |
| 397 } |
365 | 398 |
366 assert(defined(invoker.input)) | 399 assert(defined(invoker.input)) |
367 assert(defined(invoker.output)) | 400 assert(defined(invoker.output)) |
368 | 401 |
369 action(target_name) { | 402 action(target_name) { |
370 sources = [invoker.input] | 403 sources = [ |
| 404 invoker.input, |
| 405 ] |
371 script = "//build/android/gyp/jinja_template.py" | 406 script = "//build/android/gyp/jinja_template.py" |
372 depfile = "$target_gen_dir/$target_name.d" | 407 depfile = "$target_gen_dir/$target_name.d" |
373 | 408 |
374 outputs = [ | 409 outputs = [ |
375 depfile, | 410 depfile, |
376 invoker.output, | 411 invoker.output, |
377 ] | 412 ] |
378 | 413 |
379 args = [ | 414 args = [ |
380 "--inputs", rebase_path(invoker.input, root_build_dir), | 415 "--inputs", |
381 "--output", rebase_path(invoker.output, root_build_dir), | 416 rebase_path(invoker.input, root_build_dir), |
382 "--depfile", rebase_path(depfile, root_build_dir), | 417 "--output", |
| 418 rebase_path(invoker.output, root_build_dir), |
| 419 "--depfile", |
| 420 rebase_path(depfile, root_build_dir), |
383 ] | 421 ] |
384 if (defined(invoker.variables)) { | 422 if (defined(invoker.variables)) { |
385 variables = invoker.variables | 423 variables = invoker.variables |
386 args += ["--variables=${variables}" ] | 424 args += [ "--variables=${variables}" ] |
387 } | 425 } |
388 } | 426 } |
389 } | 427 } |
390 | 428 |
391 # Declare a target for processing Android resources as Jinja templates. | 429 # Declare a target for processing Android resources as Jinja templates. |
392 # | 430 # |
393 # This takes an Android resource directory where each resource is a Jinja | 431 # This takes an Android resource directory where each resource is a Jinja |
394 # template, processes each template, then packages the results in a zip file | 432 # template, processes each template, then packages the results in a zip file |
395 # which can be consumed by an android resources, library, or apk target. | 433 # which can be consumed by an android resources, library, or apk target. |
396 # | 434 # |
397 # If this target is included in the deps of an android resources/library/apk, | 435 # If this target is included in the deps of an android resources/library/apk, |
398 # the resources will be included with that target. | 436 # the resources will be included with that target. |
399 # | 437 # |
400 # Variables | 438 # Variables |
401 # resources: The list of resources files to process. | 439 # resources: The list of resources files to process. |
402 # res_dir: The resource directory containing the resources. | 440 # res_dir: The resource directory containing the resources. |
403 # variables: (Optional) A list of variables to make available to the template | 441 # variables: (Optional) A list of variables to make available to the template |
404 # processing environment, e.g. ["name=foo", "color=red"]. | 442 # processing environment, e.g. ["name=foo", "color=red"]. |
405 # | 443 # |
406 # Example | 444 # Example |
407 # jinja_template_resources("chrome_shell_template_resources") { | 445 # jinja_template_resources("chrome_shell_template_resources") { |
408 # res_dir = "shell/res_template" | 446 # res_dir = "shell/res_template" |
409 # resources = ["shell/res_template/xml/syncable.xml"] | 447 # resources = ["shell/res_template/xml/syncable.xml"] |
410 # variables = ["color=red"] | 448 # variables = ["color=red"] |
411 # } | 449 # } |
412 template("jinja_template_resources") { | 450 template("jinja_template_resources") { |
413 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 451 if (defined(invoker.testonly)) { |
| 452 testonly = invoker.testonly |
| 453 } |
414 | 454 |
415 assert(defined(invoker.resources)) | 455 assert(defined(invoker.resources)) |
416 assert(defined(invoker.res_dir)) | 456 assert(defined(invoker.res_dir)) |
417 | 457 |
418 _base_path = "$target_gen_dir/$target_name" | 458 _base_path = "$target_gen_dir/$target_name" |
419 _resources_zip = _base_path + ".resources.zip" | 459 _resources_zip = _base_path + ".resources.zip" |
420 _build_config = _base_path + ".build_config" | 460 _build_config = _base_path + ".build_config" |
421 | 461 |
422 write_build_config("${target_name}__build_config") { | 462 write_build_config("${target_name}__build_config") { |
423 build_config = _build_config | 463 build_config = _build_config |
424 resources_zip = _resources_zip | 464 resources_zip = _resources_zip |
425 type = "android_resources" | 465 type = "android_resources" |
426 } | 466 } |
427 | 467 |
428 action("${target_name}__template") { | 468 action("${target_name}__template") { |
429 sources = invoker.resources | 469 sources = invoker.resources |
430 script = "//build/android/gyp/jinja_template.py" | 470 script = "//build/android/gyp/jinja_template.py" |
431 depfile = "$target_gen_dir/$target_name.d" | 471 depfile = "$target_gen_dir/$target_name.d" |
432 | 472 |
433 outputs = [ | 473 outputs = [ |
434 depfile, | 474 depfile, |
435 _resources_zip, | 475 _resources_zip, |
436 ] | 476 ] |
437 | 477 |
438 rebased_resources = rebase_path(invoker.resources, root_build_dir) | 478 rebased_resources = rebase_path(invoker.resources, root_build_dir) |
439 args = [ | 479 args = [ |
440 "--inputs=${rebased_resources}", | 480 "--inputs=${rebased_resources}", |
441 "--inputs-base-dir", rebase_path(invoker.res_dir, root_build_dir), | 481 "--inputs-base-dir", |
442 "--outputs-zip", rebase_path(_resources_zip, root_build_dir), | 482 rebase_path(invoker.res_dir, root_build_dir), |
443 "--depfile", rebase_path(depfile, root_build_dir), | 483 "--outputs-zip", |
| 484 rebase_path(_resources_zip, root_build_dir), |
| 485 "--depfile", |
| 486 rebase_path(depfile, root_build_dir), |
444 ] | 487 ] |
445 if (defined(invoker.variables)) { | 488 if (defined(invoker.variables)) { |
446 variables = invoker.variables | 489 variables = invoker.variables |
447 args += ["--variables=${variables}" ] | 490 args += [ "--variables=${variables}" ] |
448 } | 491 } |
449 } | 492 } |
450 | 493 |
451 group(target_name) { | 494 group(target_name) { |
452 deps = [ | 495 deps = [ |
453 ":${target_name}__build_config", | 496 ":${target_name}__build_config", |
454 ":${target_name}__template", | 497 ":${target_name}__template", |
455 ] | 498 ] |
456 } | 499 } |
457 } | 500 } |
(...skipping 22 matching lines...) Expand all Loading... |
480 # shared_resources: If true make a resource package that can be loaded by a | 523 # shared_resources: If true make a resource package that can be loaded by a |
481 # different application at runtime to access the package's resources. | 524 # different application at runtime to access the package's resources. |
482 # | 525 # |
483 # Example | 526 # Example |
484 # android_resources("foo_resources") { | 527 # android_resources("foo_resources") { |
485 # deps = [":foo_strings_grd"] | 528 # deps = [":foo_strings_grd"] |
486 # resource_dirs = ["res"] | 529 # resource_dirs = ["res"] |
487 # custom_package = "org.chromium.foo" | 530 # custom_package = "org.chromium.foo" |
488 # } | 531 # } |
489 template("android_resources") { | 532 template("android_resources") { |
490 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 533 if (defined(invoker.testonly)) { |
| 534 testonly = invoker.testonly |
| 535 } |
491 | 536 |
492 assert(defined(invoker.resource_dirs)) | 537 assert(defined(invoker.resource_dirs)) |
493 assert(defined(invoker.android_manifest) || defined(invoker.custom_package)) | 538 assert(defined(invoker.android_manifest) || defined(invoker.custom_package)) |
494 | 539 |
495 base_path = "$target_gen_dir/$target_name" | 540 base_path = "$target_gen_dir/$target_name" |
496 zip_path = base_path + ".resources.zip" | 541 zip_path = base_path + ".resources.zip" |
497 srcjar_path = base_path + ".srcjar" | 542 srcjar_path = base_path + ".srcjar" |
498 build_config = base_path + ".build_config" | 543 build_config = base_path + ".build_config" |
499 | 544 |
500 write_build_config("${target_name}__build_config") { | 545 write_build_config("${target_name}__build_config") { |
501 type = "android_resources" | 546 type = "android_resources" |
502 resources_zip = zip_path | 547 resources_zip = zip_path |
503 srcjar = srcjar_path | 548 srcjar = srcjar_path |
504 if (defined(invoker.deps)) { deps = invoker.deps } | 549 if (defined(invoker.deps)) { |
505 if (defined(invoker.android_manifest)) { android_manifest = invoker.android_
manifest } | 550 deps = invoker.deps |
506 if (defined(invoker.custom_package)) { custom_package = invoker.custom_packa
ge } | 551 } |
| 552 if (defined(invoker.android_manifest)) { |
| 553 android_manifest = invoker.android_manifest |
| 554 } |
| 555 if (defined(invoker.custom_package)) { |
| 556 custom_package = invoker.custom_package |
| 557 } |
507 } | 558 } |
508 | 559 |
509 android_manifest = "//build/android/AndroidManifest.xml" | 560 android_manifest = "//build/android/AndroidManifest.xml" |
510 if (defined(invoker.android_manifest)) { | 561 if (defined(invoker.android_manifest)) { |
511 android_manifest = invoker.android_manifest | 562 android_manifest = invoker.android_manifest |
512 } | 563 } |
513 | 564 |
514 process_resources("${target_name}__process_resources") { | 565 process_resources("${target_name}__process_resources") { |
515 resource_dirs = invoker.resource_dirs | 566 resource_dirs = invoker.resource_dirs |
516 if (defined(invoker.custom_package)) { | 567 if (defined(invoker.custom_package)) { |
(...skipping 10 matching lines...) Expand all Loading... |
527 } | 578 } |
528 | 579 |
529 group(target_name) { | 580 group(target_name) { |
530 deps = [ | 581 deps = [ |
531 ":${target_name}__build_config", | 582 ":${target_name}__build_config", |
532 ":${target_name}__process_resources", | 583 ":${target_name}__process_resources", |
533 ] | 584 ] |
534 } | 585 } |
535 } | 586 } |
536 | 587 |
537 | |
538 # Declare a target that generates localized strings.xml from a .grd file. | 588 # Declare a target that generates localized strings.xml from a .grd file. |
539 # | 589 # |
540 # If this target is included in the deps of an android resources/library/apk, | 590 # If this target is included in the deps of an android resources/library/apk, |
541 # the strings.xml will be included with that target. | 591 # the strings.xml will be included with that target. |
542 # | 592 # |
543 # Variables | 593 # Variables |
544 # deps: Specifies the dependencies of this target. | 594 # deps: Specifies the dependencies of this target. |
545 # grd_file: Path to the .grd file to generate strings.xml from. | 595 # grd_file: Path to the .grd file to generate strings.xml from. |
546 # outputs: Expected grit outputs (see grit rule). | 596 # outputs: Expected grit outputs (see grit rule). |
547 # | 597 # |
548 # Example | 598 # Example |
549 # java_strings_grd("foo_strings_grd") { | 599 # java_strings_grd("foo_strings_grd") { |
550 # grd_file = "foo_strings.grd" | 600 # grd_file = "foo_strings.grd" |
551 # } | 601 # } |
552 template("java_strings_grd") { | 602 template("java_strings_grd") { |
553 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 603 if (defined(invoker.testonly)) { |
| 604 testonly = invoker.testonly |
| 605 } |
554 | 606 |
555 base_path = "$target_gen_dir/$target_name" | 607 base_path = "$target_gen_dir/$target_name" |
556 resources_zip = base_path + ".resources.zip" | 608 resources_zip = base_path + ".resources.zip" |
557 build_config = base_path + ".build_config" | 609 build_config = base_path + ".build_config" |
558 | 610 |
559 write_build_config("${target_name}__build_config") { | 611 write_build_config("${target_name}__build_config") { |
560 type = "android_resources" | 612 type = "android_resources" |
561 if (defined(invoker.deps)) { | 613 if (defined(invoker.deps)) { |
562 deps = invoker.deps | 614 deps = invoker.deps |
563 } | 615 } |
564 } | 616 } |
565 | 617 |
566 # Put grit files into this subdirectory of target_gen_dir. | 618 # Put grit files into this subdirectory of target_gen_dir. |
567 extra_output_path = target_name + "_grit_output" | 619 extra_output_path = target_name + "_grit_output" |
568 | 620 |
569 grit_target_name = "${target_name}__grit" | 621 grit_target_name = "${target_name}__grit" |
570 grit_output_dir = "$target_gen_dir/$extra_output_path" | 622 grit_output_dir = "$target_gen_dir/$extra_output_path" |
571 grit(grit_target_name) { | 623 grit(grit_target_name) { |
572 grit_flags = [ | 624 grit_flags = [ |
573 "-E", "ANDROID_JAVA_TAGGED_ONLY=false", | 625 "-E", |
| 626 "ANDROID_JAVA_TAGGED_ONLY=false", |
574 ] | 627 ] |
575 output_dir = grit_output_dir | 628 output_dir = grit_output_dir |
576 resource_ids = "" | 629 resource_ids = "" |
577 source = invoker.grd_file | 630 source = invoker.grd_file |
578 outputs = invoker.outputs | 631 outputs = invoker.outputs |
579 } | 632 } |
580 | 633 |
581 # This needs to get outputs from grit's internal target, not the final | 634 # This needs to get outputs from grit's internal target, not the final |
582 # source_set. | 635 # source_set. |
583 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") | 636 generate_strings_outputs = get_target_outputs(":${grit_target_name}_grit") |
(...skipping 22 matching lines...) Expand all Loading... |
606 # generated_files: list of android resource files to package. | 659 # generated_files: list of android resource files to package. |
607 # | 660 # |
608 # Example | 661 # Example |
609 # java_strings_grd_prebuilt("foo_strings_grd") { | 662 # java_strings_grd_prebuilt("foo_strings_grd") { |
610 # grit_output_dir = "$root_gen_dir/foo/grit" | 663 # grit_output_dir = "$root_gen_dir/foo/grit" |
611 # generated_files = [ | 664 # generated_files = [ |
612 # "values/strings.xml" | 665 # "values/strings.xml" |
613 # ] | 666 # ] |
614 # } | 667 # } |
615 template("java_strings_grd_prebuilt") { | 668 template("java_strings_grd_prebuilt") { |
616 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 669 if (defined(invoker.testonly)) { |
| 670 testonly = invoker.testonly |
| 671 } |
617 | 672 |
618 base_path = "$target_gen_dir/$target_name" | 673 base_path = "$target_gen_dir/$target_name" |
619 resources_zip = base_path + ".resources.zip" | 674 resources_zip = base_path + ".resources.zip" |
620 build_config = base_path + ".build_config" | 675 build_config = base_path + ".build_config" |
621 | 676 |
622 write_build_config("${target_name}__build_config") { | 677 write_build_config("${target_name}__build_config") { |
623 type = "android_resources" | 678 type = "android_resources" |
624 if (defined(invoker.deps)) { | 679 if (defined(invoker.deps)) { |
625 deps = invoker.deps | 680 deps = invoker.deps |
626 } | 681 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 # Example | 721 # Example |
667 # java_library("foo") { | 722 # java_library("foo") { |
668 # java_files = [ "org/chromium/foo/FooMain.java" ] | 723 # java_files = [ "org/chromium/foo/FooMain.java" ] |
669 # deps = [ ":bar_java" ] | 724 # deps = [ ":bar_java" ] |
670 # main_class = "org.chromium.foo.FooMain" | 725 # main_class = "org.chromium.foo.FooMain" |
671 # } | 726 # } |
672 template("java_binary") { | 727 template("java_binary") { |
673 # TODO(cjhopman): This should not act like a java_library for dependents (i.e. | 728 # TODO(cjhopman): This should not act like a java_library for dependents (i.e. |
674 # dependents shouldn't get the jar in their classpath, etc.). | 729 # dependents shouldn't get the jar in their classpath, etc.). |
675 java_library_impl(target_name) { | 730 java_library_impl(target_name) { |
676 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } | 731 if (defined(invoker.DEPRECATED_java_in_dir)) { |
677 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} | 732 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
678 if (defined(invoker.datadeps)) { deps = invoker.datadeps } | 733 } |
679 if (defined(invoker.deps)) { deps = invoker.deps } | 734 if (defined(invoker.chromium_code)) { |
680 if (defined(invoker.java_files)) { java_files = invoker.java_files } | 735 chromium_code = invoker.chromium_code |
681 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } | 736 } |
682 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } | 737 if (defined(invoker.datadeps)) { |
683 if (defined(invoker.bypass_platform_checks)) { bypass_platform_checks = invo
ker.bypass_platform_checks } | 738 deps = invoker.datadeps |
684 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 739 } |
| 740 if (defined(invoker.deps)) { |
| 741 deps = invoker.deps |
| 742 } |
| 743 if (defined(invoker.java_files)) { |
| 744 java_files = invoker.java_files |
| 745 } |
| 746 if (defined(invoker.srcjar_deps)) { |
| 747 srcjar_deps = invoker.srcjar_deps |
| 748 } |
| 749 if (defined(invoker.srcjars)) { |
| 750 srcjars = invoker.srcjars |
| 751 } |
| 752 if (defined(invoker.bypass_platform_checks)) { |
| 753 bypass_platform_checks = invoker.bypass_platform_checks |
| 754 } |
| 755 if (defined(invoker.testonly)) { |
| 756 testonly = invoker.testonly |
| 757 } |
685 | 758 |
686 main_class = invoker.main_class | 759 main_class = invoker.main_class |
687 } | 760 } |
688 } | 761 } |
689 | 762 |
690 | |
691 # Declare an java library target | 763 # Declare an java library target |
692 # | 764 # |
693 # Variables | 765 # Variables |
694 # deps: Specifies the dependencies of this target. Java targets in this list | 766 # deps: Specifies the dependencies of this target. Java targets in this list |
695 # will be added to the javac classpath. | 767 # will be added to the javac classpath. |
696 # | 768 # |
697 # java_files: List of .java files included in this library. | 769 # java_files: List of .java files included in this library. |
698 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 770 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
699 # will be added to java_files and be included in this library. | 771 # will be added to java_files and be included in this library. |
700 # srcjars: List of srcjars to be included in this library, together with the | 772 # srcjars: List of srcjars to be included in this library, together with the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 # ] | 804 # ] |
733 # srcjar_deps = [ | 805 # srcjar_deps = [ |
734 # ":foo_generated_enum" | 806 # ":foo_generated_enum" |
735 # ] | 807 # ] |
736 # jar_excluded_patterns = [ | 808 # jar_excluded_patterns = [ |
737 # "*/FooService.class", "*/FooService##*.class" | 809 # "*/FooService.class", "*/FooService##*.class" |
738 # ] | 810 # ] |
739 # } | 811 # } |
740 template("java_library") { | 812 template("java_library") { |
741 java_library_impl(target_name) { | 813 java_library_impl(target_name) { |
742 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } | 814 if (defined(invoker.DEPRECATED_java_in_dir)) { |
743 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} | 815 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
744 if (defined(invoker.datadeps)) { deps = invoker.datadeps } | 816 } |
745 if (defined(invoker.deps)) { deps = invoker.deps } | 817 if (defined(invoker.chromium_code)) { |
746 if (defined(invoker.jar_excluded_patterns)) { jar_excluded_patterns = invoke
r.jar_excluded_patterns } | 818 chromium_code = invoker.chromium_code |
747 if (defined(invoker.java_files)) { java_files = invoker.java_files } | 819 } |
748 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } | 820 if (defined(invoker.datadeps)) { |
749 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } | 821 deps = invoker.datadeps |
750 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } | 822 } |
751 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } | 823 if (defined(invoker.deps)) { |
752 if (defined(invoker.bypass_platform_checks)) { bypass_platform_checks = invo
ker.bypass_platform_checks } | 824 deps = invoker.deps |
753 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 825 } |
754 if (defined(invoker.jar_path)) { jar_path = invoker.jar_path } | 826 if (defined(invoker.jar_excluded_patterns)) { |
| 827 jar_excluded_patterns = invoker.jar_excluded_patterns |
| 828 } |
| 829 if (defined(invoker.java_files)) { |
| 830 java_files = invoker.java_files |
| 831 } |
| 832 if (defined(invoker.proguard_config)) { |
| 833 proguard_config = invoker.proguard_config |
| 834 } |
| 835 if (defined(invoker.proguard_preprocess)) { |
| 836 proguard_preprocess = invoker.proguard_preprocess |
| 837 } |
| 838 if (defined(invoker.srcjar_deps)) { |
| 839 srcjar_deps = invoker.srcjar_deps |
| 840 } |
| 841 if (defined(invoker.srcjars)) { |
| 842 srcjars = invoker.srcjars |
| 843 } |
| 844 if (defined(invoker.bypass_platform_checks)) { |
| 845 bypass_platform_checks = invoker.bypass_platform_checks |
| 846 } |
| 847 if (defined(invoker.testonly)) { |
| 848 testonly = invoker.testonly |
| 849 } |
| 850 if (defined(invoker.jar_path)) { |
| 851 jar_path = invoker.jar_path |
| 852 } |
755 | 853 |
756 if (defined(invoker.supports_android) && invoker.supports_android) { | 854 if (defined(invoker.supports_android) && invoker.supports_android) { |
757 supports_android = true | 855 supports_android = true |
758 } | 856 } |
759 } | 857 } |
760 } | 858 } |
761 | 859 |
762 | |
763 # Declare an java library target for a prebuilt jar | 860 # Declare an java library target for a prebuilt jar |
764 # | 861 # |
765 # Variables | 862 # Variables |
766 # deps: Specifies the dependencies of this target. Java targets in this list | 863 # deps: Specifies the dependencies of this target. Java targets in this list |
767 # will be added to the javac classpath. | 864 # will be added to the javac classpath. |
768 # jar_path: Path to the prebuilt jar. | 865 # jar_path: Path to the prebuilt jar. |
769 # proguard_preprocess: If true, proguard preprocessing will be run. This can | 866 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
770 # be used to remove unwanted parts of the library. | 867 # be used to remove unwanted parts of the library. |
771 # proguard_config: Path to the proguard config for preprocessing. | 868 # proguard_config: Path to the proguard config for preprocessing. |
772 # | 869 # |
773 # Example | 870 # Example |
774 # java_prebuilt("foo_java") { | 871 # java_prebuilt("foo_java") { |
775 # jar_path = "foo.jar" | 872 # jar_path = "foo.jar" |
776 # deps = [ | 873 # deps = [ |
777 # ":foo_resources", | 874 # ":foo_resources", |
778 # ":bar_java" | 875 # ":bar_java" |
779 # ] | 876 # ] |
780 # } | 877 # } |
781 template("java_prebuilt") { | 878 template("java_prebuilt") { |
782 java_prebuilt_impl(target_name) { | 879 java_prebuilt_impl(target_name) { |
783 jar_path = invoker.jar_path | 880 jar_path = invoker.jar_path |
784 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 881 if (defined(invoker.testonly)) { |
785 if (defined(invoker.deps)) { deps = invoker.deps } | 882 testonly = invoker.testonly |
786 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } | 883 } |
787 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } | 884 if (defined(invoker.deps)) { |
| 885 deps = invoker.deps |
| 886 } |
| 887 if (defined(invoker.proguard_config)) { |
| 888 proguard_config = invoker.proguard_config |
| 889 } |
| 890 if (defined(invoker.proguard_preprocess)) { |
| 891 proguard_preprocess = invoker.proguard_preprocess |
| 892 } |
788 } | 893 } |
789 } | 894 } |
790 | 895 |
791 # Declare an Android library target | 896 # Declare an Android library target |
792 # | 897 # |
793 # This target creates an Android library containing java code and Android | 898 # This target creates an Android library containing java code and Android |
794 # resources. | 899 # resources. |
795 # | 900 # |
796 # Variables | 901 # Variables |
797 # deps: Specifies the dependencies of this target. Java targets in this list | 902 # deps: Specifies the dependencies of this target. Java targets in this list |
(...skipping 10 matching lines...) Expand all Loading... |
808 # ease the gyp->gn conversion and will be removed in the future. | 913 # ease the gyp->gn conversion and will be removed in the future. |
809 # | 914 # |
810 # chromium_code: If true, extra analysis warning/errors will be enabled. | 915 # chromium_code: If true, extra analysis warning/errors will be enabled. |
811 # jar_excluded_patterns: List of patterns of .class files to exclude from the | 916 # jar_excluded_patterns: List of patterns of .class files to exclude from the |
812 # final jar. | 917 # final jar. |
813 # | 918 # |
814 # proguard_preprocess: If true, proguard preprocessing will be run. This can | 919 # proguard_preprocess: If true, proguard preprocessing will be run. This can |
815 # be used to remove unwanted parts of the library. | 920 # be used to remove unwanted parts of the library. |
816 # proguard_config: Path to the proguard config for preprocessing. | 921 # proguard_config: Path to the proguard config for preprocessing. |
817 # | 922 # |
| 923 # dex_path: If set, the resulting .dex.jar file will be placed under this |
| 924 # path. |
| 925 # standalone_dex_path: If set, a standalone .dex.jar containing the code from |
| 926 # the library and all dependencies will be placed under this path. |
| 927 # |
818 # | 928 # |
819 # Example | 929 # Example |
820 # android_library("foo_java") { | 930 # android_library("foo_java") { |
821 # java_files = [ | 931 # java_files = [ |
822 # "android/org/chromium/foo/Foo.java", | 932 # "android/org/chromium/foo/Foo.java", |
823 # "android/org/chromium/foo/FooInterface.java", | 933 # "android/org/chromium/foo/FooInterface.java", |
824 # "android/org/chromium/foo/FooService.java", | 934 # "android/org/chromium/foo/FooService.java", |
825 # ] | 935 # ] |
826 # deps = [ | 936 # deps = [ |
827 # ":bar_java" | 937 # ":bar_java" |
828 # ] | 938 # ] |
829 # srcjar_deps = [ | 939 # srcjar_deps = [ |
830 # ":foo_generated_enum" | 940 # ":foo_generated_enum" |
831 # ] | 941 # ] |
832 # jar_excluded_patterns = [ | 942 # jar_excluded_patterns = [ |
833 # "*/FooService.class", "*/FooService##*.class" | 943 # "*/FooService.class", "*/FooService##*.class" |
834 # ] | 944 # ] |
835 # } | 945 # } |
836 template("android_library") { | 946 template("android_library") { |
837 assert(!defined(invoker.jar_path), | 947 assert(!defined(invoker.jar_path), |
838 "android_library does not support a custom jar path") | 948 "android_library does not support a custom jar path") |
839 java_library_impl(target_name) { | 949 java_library_impl(target_name) { |
840 if (defined(invoker.DEPRECATED_java_in_dir)) { DEPRECATED_java_in_dir = invo
ker.DEPRECATED_java_in_dir } | 950 if (defined(invoker.DEPRECATED_java_in_dir)) { |
841 if (defined(invoker.chromium_code)) { chromium_code = invoker.chromium_code
} | 951 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
842 if (defined(invoker.datadeps)) { deps = invoker.datadeps } | 952 } |
843 if (defined(invoker.deps)) { deps = invoker.deps } | 953 if (defined(invoker.chromium_code)) { |
844 if (defined(invoker.jar_excluded_patterns)) { jar_excluded_patterns = invoke
r.jar_excluded_patterns } | 954 chromium_code = invoker.chromium_code |
845 if (defined(invoker.java_files)) { java_files = invoker.java_files } | 955 } |
846 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } | 956 if (defined(invoker.datadeps)) { |
847 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } | 957 deps = invoker.datadeps |
848 if (defined(invoker.srcjar_deps)) { srcjar_deps = invoker.srcjar_deps } | 958 } |
849 if (defined(invoker.srcjars)) { srcjars = invoker.srcjars } | 959 if (defined(invoker.deps)) { |
850 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 960 deps = invoker.deps |
851 if (defined(invoker.dex_path)) { dex_path = invoker.dex_path } | 961 } |
| 962 if (defined(invoker.jar_excluded_patterns)) { |
| 963 jar_excluded_patterns = invoker.jar_excluded_patterns |
| 964 } |
| 965 if (defined(invoker.java_files)) { |
| 966 java_files = invoker.java_files |
| 967 } |
| 968 if (defined(invoker.proguard_config)) { |
| 969 proguard_config = invoker.proguard_config |
| 970 } |
| 971 if (defined(invoker.proguard_preprocess)) { |
| 972 proguard_preprocess = invoker.proguard_preprocess |
| 973 } |
| 974 if (defined(invoker.srcjar_deps)) { |
| 975 srcjar_deps = invoker.srcjar_deps |
| 976 } |
| 977 if (defined(invoker.srcjars)) { |
| 978 srcjars = invoker.srcjars |
| 979 } |
| 980 if (defined(invoker.testonly)) { |
| 981 testonly = invoker.testonly |
| 982 } |
| 983 if (defined(invoker.visibility)) { |
| 984 visibility = invoker.visibility |
| 985 } |
| 986 if (defined(invoker.dex_path)) { |
| 987 dex_path = invoker.dex_path |
| 988 } |
| 989 if (defined(invoker.standalone_dex_path)) { |
| 990 standalone_dex_path = invoker.standalone_dex_path |
| 991 } |
852 | 992 |
853 supports_android = true | 993 supports_android = true |
854 requires_android = true | 994 requires_android = true |
855 | 995 |
856 if (!defined(jar_excluded_patterns)) { jar_excluded_patterns = [] } | 996 if (!defined(jar_excluded_patterns)) { |
| 997 jar_excluded_patterns = [] |
| 998 } |
857 jar_excluded_patterns += [ | 999 jar_excluded_patterns += [ |
858 "*/R.class", "*/R##*.class", | 1000 "*/R.class", |
859 "*/Manifest.class", "*/Manifest##*.class", | 1001 "*/R##*.class", |
| 1002 "*/Manifest.class", |
| 1003 "*/Manifest##*.class", |
860 ] | 1004 ] |
861 } | 1005 } |
862 } | 1006 } |
863 | 1007 |
864 # Declare an Android library target for a prebuilt jar | 1008 # Declare an Android library target for a prebuilt jar |
865 # | 1009 # |
866 # This target creates an Android library containing java code and Android | 1010 # This target creates an Android library containing java code and Android |
867 # resources. | 1011 # resources. |
868 # | 1012 # |
869 # Variables | 1013 # Variables |
(...skipping 11 matching lines...) Expand all Loading... |
881 # deps = [ | 1025 # deps = [ |
882 # ":foo_resources", | 1026 # ":foo_resources", |
883 # ":bar_java" | 1027 # ":bar_java" |
884 # ] | 1028 # ] |
885 # } | 1029 # } |
886 template("android_java_prebuilt") { | 1030 template("android_java_prebuilt") { |
887 java_prebuilt_impl(target_name) { | 1031 java_prebuilt_impl(target_name) { |
888 jar_path = invoker.jar_path | 1032 jar_path = invoker.jar_path |
889 supports_android = true | 1033 supports_android = true |
890 requires_android = true | 1034 requires_android = true |
891 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1035 if (defined(invoker.testonly)) { |
892 if (defined(invoker.deps)) { deps = invoker.deps } | 1036 testonly = invoker.testonly |
893 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c
onfig } | 1037 } |
894 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr
oguard_preprocess } | 1038 if (defined(invoker.deps)) { |
| 1039 deps = invoker.deps |
| 1040 } |
| 1041 if (defined(invoker.proguard_config)) { |
| 1042 proguard_config = invoker.proguard_config |
| 1043 } |
| 1044 if (defined(invoker.proguard_preprocess)) { |
| 1045 proguard_preprocess = invoker.proguard_preprocess |
| 1046 } |
895 } | 1047 } |
896 } | 1048 } |
897 | 1049 |
898 | |
899 | |
900 # Declare an Android apk target | 1050 # Declare an Android apk target |
901 # | 1051 # |
902 # This target creates an Android APK containing java code, resources, assets, | 1052 # This target creates an Android APK containing java code, resources, assets, |
903 # and (possibly) native libraries. | 1053 # and (possibly) native libraries. |
904 # | 1054 # |
905 # Variables | 1055 # Variables |
906 # android_manifest: Path to AndroidManifest.xml. | 1056 # android_manifest: Path to AndroidManifest.xml. |
907 # datadeps: List of dependencies needed at runtime. These will be built but | 1057 # datadeps: List of dependencies needed at runtime. These will be built but |
908 # won't change the generated .apk in any way (in fact they may be built | 1058 # won't change the generated .apk in any way (in fact they may be built |
909 # after the .apk is). | 1059 # after the .apk is). |
(...skipping 29 matching lines...) Expand all Loading... |
939 # ":foo_resources" | 1089 # ":foo_resources" |
940 # ] | 1090 # ] |
941 # srcjar_deps = [ | 1091 # srcjar_deps = [ |
942 # ":foo_generated_enum" | 1092 # ":foo_generated_enum" |
943 # ] | 1093 # ] |
944 # native_libs = [ | 1094 # native_libs = [ |
945 # native_lib_path | 1095 # native_lib_path |
946 # ] | 1096 # ] |
947 # } | 1097 # } |
948 template("android_apk") { | 1098 template("android_apk") { |
949 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1099 if (defined(invoker.testonly)) { |
| 1100 testonly = invoker.testonly |
| 1101 } |
950 | 1102 |
951 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) | 1103 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
952 gen_dir = "$target_gen_dir/$target_name" | 1104 gen_dir = "$target_gen_dir/$target_name" |
953 base_path = "$gen_dir/$target_name" | 1105 base_path = "$gen_dir/$target_name" |
954 _build_config = "$base_path.build_config" | 1106 _build_config = "$base_path.build_config" |
955 resources_zip_path = "$base_path.resources.zip" | 1107 resources_zip_path = "$base_path.resources.zip" |
956 all_resources_zip_path = "$base_path.resources.all.zip" | 1108 all_resources_zip_path = "$base_path.resources.all.zip" |
957 jar_path = "$base_path.jar" | 1109 jar_path = "$base_path.jar" |
958 final_dex_path = "$gen_dir/classes.dex" | 1110 final_dex_path = "$gen_dir/classes.dex" |
959 _template_name = target_name | 1111 _template_name = target_name |
960 _final_apk_path = "" | 1112 _final_apk_path = "" |
961 if (defined(invoker.final_apk_path)) { | 1113 if (defined(invoker.final_apk_path)) { |
962 _final_apk_path = invoker.final_apk_path | 1114 _final_apk_path = invoker.final_apk_path |
963 } else if (defined(invoker.apk_name)) { | 1115 } else if (defined(invoker.apk_name)) { |
964 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 1116 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
965 } | 1117 } |
966 _dist_jar_path_list = process_file_template( | 1118 _dist_jar_path_list = |
967 [ _final_apk_path ], | 1119 process_file_template( |
968 "$root_build_dir/test.lib.java/{{source_name_part}}.jar" | 1120 [ _final_apk_path ], |
969 ) | 1121 "$root_build_dir/test.lib.java/{{source_name_part}}.jar") |
970 _dist_jar_path = _dist_jar_path_list[0] | 1122 _dist_jar_path = _dist_jar_path_list[0] |
971 | 1123 |
972 _native_libs = [] | 1124 _native_libs = [] |
973 | 1125 |
974 _keystore_path = android_default_keystore_path | 1126 _keystore_path = android_default_keystore_path |
975 _keystore_name = android_default_keystore_name | 1127 _keystore_name = android_default_keystore_name |
976 _keystore_password = android_default_keystore_password | 1128 _keystore_password = android_default_keystore_password |
977 | 1129 |
978 if (defined(invoker.keystore_path)) { | 1130 if (defined(invoker.keystore_path)) { |
979 _keystore_path = invoker.keystore_path | 1131 _keystore_path = invoker.keystore_path |
980 _keystore_name = invoker.keystore_name | 1132 _keystore_name = invoker.keystore_name |
981 _keystore_password = invoker.keystore_password | 1133 _keystore_password = invoker.keystore_password |
982 } | 1134 } |
983 | 1135 |
984 _srcjar_deps = [] | 1136 _srcjar_deps = [] |
985 if (defined(invoker.srcjar_deps)) { | 1137 if (defined(invoker.srcjar_deps)) { |
986 _srcjar_deps += invoker.srcjar_deps | 1138 _srcjar_deps += invoker.srcjar_deps |
987 } | 1139 } |
988 | 1140 |
989 _load_library_from_apk = false | 1141 _load_library_from_apk = false |
990 | 1142 |
991 if (defined(invoker.native_libs)) { | 1143 if (defined(invoker.native_libs)) { |
992 _use_chromium_linker = false | 1144 _use_chromium_linker = false |
993 if (defined(invoker.use_chromium_linker)) { | 1145 if (defined(invoker.use_chromium_linker)) { |
994 _use_chromium_linker = (invoker.use_chromium_linker && | 1146 _use_chromium_linker = |
995 chromium_linker_supported) | 1147 invoker.use_chromium_linker && chromium_linker_supported |
996 } | 1148 } |
997 | 1149 |
998 if (defined(invoker.load_library_from_apk) && | 1150 if (defined(invoker.load_library_from_apk) && |
999 invoker.load_library_from_apk) { | 1151 invoker.load_library_from_apk) { |
1000 _load_library_from_apk = true | 1152 _load_library_from_apk = true |
1001 assert(_use_chromium_linker, "Loading library from the apk requires use" + | 1153 assert(_use_chromium_linker, |
1002 " of the Chromium linker.") | 1154 "Loading library from the apk requires use" + |
| 1155 " of the Chromium linker.") |
1003 } | 1156 } |
1004 | 1157 |
1005 _enable_relocation_packing = false | 1158 _enable_relocation_packing = false |
1006 if (defined(invoker.enable_relocation_packing) && | 1159 if (defined(invoker.enable_relocation_packing) && |
1007 invoker.enable_relocation_packing) { | 1160 invoker.enable_relocation_packing) { |
1008 _enable_relocation_packing = relocation_packing_supported | 1161 _enable_relocation_packing = relocation_packing_supported |
1009 assert(_use_chromium_linker, "Relocation packing requires use of the" + | 1162 assert(_use_chromium_linker, |
1010 " Chromium linker.") | 1163 "Relocation packing requires use of the" + " Chromium linker.") |
1011 } | 1164 } |
1012 | 1165 |
1013 _native_libs = process_file_template( | 1166 _native_libs = process_file_template( |
1014 invoker.native_libs, | 1167 invoker.native_libs, |
1015 "$root_build_dir/lib.stripped/{{source_file_part}}") | 1168 "$root_build_dir/lib.stripped/{{source_file_part}}") |
1016 | 1169 |
1017 _native_libs_dir = base_path + "/libs" | 1170 _native_libs_dir = base_path + "/libs" |
1018 | 1171 |
1019 if (_use_chromium_linker) { | 1172 if (_use_chromium_linker) { |
1020 _native_libs += [ | 1173 _native_libs += |
1021 "$root_build_dir/lib.stripped/libchromium_android_linker.so" | 1174 [ "$root_build_dir/lib.stripped/libchromium_android_linker.so" ] |
1022 ] | |
1023 } | 1175 } |
1024 | 1176 |
1025 _enable_relocation_packing = false | 1177 _enable_relocation_packing = false |
1026 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && | 1178 if (_use_chromium_linker && defined(invoker.enable_relocation_packing) && |
1027 invoker.enable_relocation_packing) { | 1179 invoker.enable_relocation_packing) { |
1028 _enable_relocation_packing = true | 1180 _enable_relocation_packing = true |
1029 } | 1181 } |
1030 } | 1182 } |
1031 | 1183 |
1032 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 1184 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
1033 | 1185 |
1034 write_build_config("${_template_name}__build_config") { | 1186 write_build_config("${_template_name}__build_config") { |
1035 type = "android_apk" | 1187 type = "android_apk" |
1036 dex_path = final_dex_path | 1188 dex_path = final_dex_path |
1037 resources_zip = resources_zip_path | 1189 resources_zip = resources_zip_path |
1038 build_config = _build_config | 1190 build_config = _build_config |
1039 | 1191 |
1040 if (defined(invoker.deps)) { | 1192 if (defined(invoker.deps)) { |
1041 deps = invoker.deps | 1193 deps = invoker.deps |
1042 } | 1194 } |
1043 | 1195 |
1044 native_libs = _native_libs | 1196 native_libs = _native_libs |
1045 } | 1197 } |
1046 | 1198 |
1047 final_deps = [] | 1199 final_deps = [] |
1048 | 1200 |
1049 final_deps += [":${_template_name}__process_resources"] | 1201 final_deps += [ ":${_template_name}__process_resources" ] |
1050 process_resources("${_template_name}__process_resources") { | 1202 process_resources("${_template_name}__process_resources") { |
1051 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1203 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1052 android_manifest = invoker.android_manifest | 1204 android_manifest = invoker.android_manifest |
1053 resource_dirs = ["//build/android/ant/empty/res"] | 1205 resource_dirs = [ "//build/android/ant/empty/res" ] |
1054 zip_path = resources_zip_path | 1206 zip_path = resources_zip_path |
1055 generate_constant_ids = true | 1207 generate_constant_ids = true |
1056 build_config = _build_config | 1208 build_config = _build_config |
1057 } | 1209 } |
1058 _srcjar_deps += [":${_template_name}__process_resources"] | 1210 _srcjar_deps += [ ":${_template_name}__process_resources" ] |
1059 | 1211 |
1060 if (_native_libs != []) { | 1212 if (_native_libs != []) { |
1061 _enable_chromium_linker_tests = false | 1213 _enable_chromium_linker_tests = false |
1062 if (defined(invoker.enable_chromium_linker_tests)) { | 1214 if (defined(invoker.enable_chromium_linker_tests)) { |
1063 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests | 1215 _enable_chromium_linker_tests = invoker.enable_chromium_linker_tests |
1064 } | 1216 } |
1065 | 1217 |
1066 _native_lib_version_name = "" | 1218 _native_lib_version_name = "" |
1067 | 1219 |
1068 java_cpp_template("${_template_name}__native_libraries_java") { | 1220 java_cpp_template("${_template_name}__native_libraries_java") { |
1069 package_name = "org/chromium/base/library_loader" | 1221 package_name = "org/chromium/base/library_loader" |
1070 sources = [ | 1222 sources = [ |
1071 "//base/android/java/templates/NativeLibraries.template", | 1223 "//base/android/java/templates/NativeLibraries.template", |
1072 ] | 1224 ] |
1073 inputs = [ | 1225 inputs = [ |
1074 _build_config, | 1226 _build_config, |
1075 ] | 1227 ] |
1076 | 1228 |
1077 defines = [ | 1229 defines = [ |
1078 "NATIVE_LIBRARIES_LIST=" + | 1230 "NATIVE_LIBRARIES_LIST=" + |
1079 "@FileArg($_rebased_build_config:native:java_libraries_list)", | 1231 "@FileArg($_rebased_build_config:native:java_libraries_list)", |
1080 "NATIVE_LIBRARIES_VERSION_NUMBER=\"$_native_lib_version_name\"", | 1232 "NATIVE_LIBRARIES_VERSION_NUMBER=\"$_native_lib_version_name\"", |
1081 ] | 1233 ] |
1082 if (_use_chromium_linker) { | 1234 if (_use_chromium_linker) { |
1083 defines += ["ENABLE_CHROMIUM_LINKER"] | 1235 defines += [ "ENABLE_CHROMIUM_LINKER" ] |
1084 } | 1236 } |
1085 if (_load_library_from_apk) { | 1237 if (_load_library_from_apk) { |
1086 defines += ["ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE"] | 1238 defines += [ "ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE" ] |
1087 } | 1239 } |
1088 if (_enable_chromium_linker_tests) { | 1240 if (_enable_chromium_linker_tests) { |
1089 defines += ["ENABLE_CHROMIUM_LINKER_TESTS"] | 1241 defines += [ "ENABLE_CHROMIUM_LINKER_TESTS" ] |
1090 } | 1242 } |
1091 } | 1243 } |
1092 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] | 1244 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] |
1093 } | 1245 } |
1094 | 1246 |
1095 final_deps += [ ":${_template_name}__java" ] | 1247 final_deps += [ ":${_template_name}__java" ] |
1096 java_library_impl("${_template_name}__java") { | 1248 java_library_impl("${_template_name}__java") { |
1097 supports_android = true | 1249 supports_android = true |
1098 requires_android = true | 1250 requires_android = true |
1099 override_build_config = _build_config | 1251 override_build_config = _build_config |
1100 android_manifest = invoker.android_manifest | 1252 android_manifest = invoker.android_manifest |
1101 chromium_code = true | 1253 chromium_code = true |
1102 if (defined(invoker.java_files)) { | 1254 if (defined(invoker.java_files)) { |
1103 java_files = invoker.java_files | 1255 java_files = invoker.java_files |
1104 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | 1256 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
1105 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 1257 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
1106 } else { | 1258 } else { |
1107 java_files = [] | 1259 java_files = [] |
1108 } | 1260 } |
1109 srcjar_deps = _srcjar_deps | 1261 srcjar_deps = _srcjar_deps |
1110 dex_path = base_path + ".dex.jar" | 1262 dex_path = base_path + ".dex.jar" |
1111 } | 1263 } |
1112 | 1264 |
1113 if (_dist_jar_path != "") { | 1265 if (_dist_jar_path != "") { |
1114 final_deps += [ ":${_template_name}__create_dist_jar" ] | 1266 final_deps += [ ":${_template_name}__create_dist_jar" ] |
| 1267 |
1115 # TODO(cjhopman): This is only ever needed to calculate the list of tests to | 1268 # TODO(cjhopman): This is only ever needed to calculate the list of tests to |
1116 # run. See build/android/pylib/instrumentation/test_jar.py. We should be | 1269 # run. See build/android/pylib/instrumentation/test_jar.py. We should be |
1117 # able to just do that calculation at build time instead. | 1270 # able to just do that calculation at build time instead. |
1118 action("${_template_name}__create_dist_jar") { | 1271 action("${_template_name}__create_dist_jar") { |
1119 script = "//build/android/gyp/create_dist_jar.py" | 1272 script = "//build/android/gyp/create_dist_jar.py" |
1120 depfile = "$target_gen_dir/$target_name.d" | 1273 depfile = "$target_gen_dir/$target_name.d" |
1121 inputs = [ _build_config ] | 1274 inputs = [ |
| 1275 _build_config, |
| 1276 ] |
1122 outputs = [ | 1277 outputs = [ |
1123 depfile, | 1278 depfile, |
1124 _dist_jar_path, | 1279 _dist_jar_path, |
1125 ] | 1280 ] |
1126 args = [ | 1281 args = [ |
1127 "--depfile", rebase_path(depfile, root_build_dir), | 1282 "--depfile", |
1128 "--output", rebase_path(_dist_jar_path, root_build_dir), | 1283 rebase_path(depfile, root_build_dir), |
| 1284 "--output", |
| 1285 rebase_path(_dist_jar_path, root_build_dir), |
1129 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", | 1286 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", |
1130 ] | 1287 ] |
1131 inputs += [ jar_path ] | 1288 inputs += [ jar_path ] |
1132 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) | 1289 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) |
1133 args += [ | 1290 args += [ "--inputs=$_rebased_jar_path" ] |
1134 "--inputs=$_rebased_jar_path", | |
1135 ] | |
1136 } | 1291 } |
1137 } | 1292 } |
1138 | 1293 |
1139 final_deps += [":${_template_name}__final_dex"] | 1294 final_deps += [ ":${_template_name}__final_dex" ] |
1140 dex("${_template_name}__final_dex") { | 1295 dex("${_template_name}__final_dex") { |
1141 deps = [ ":${_template_name}__java" ] | 1296 deps = [ |
1142 sources = [ jar_path ] | 1297 ":${_template_name}__java", |
1143 inputs = [ _build_config ] | 1298 ] |
| 1299 sources = [ |
| 1300 jar_path, |
| 1301 ] |
| 1302 inputs = [ |
| 1303 _build_config, |
| 1304 ] |
1144 output = final_dex_path | 1305 output = final_dex_path |
1145 dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files" | 1306 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1146 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1307 args = [ "--inputs=@FileArg($dex_arg_key)" ] |
1147 } | 1308 } |
1148 | 1309 |
1149 if (_native_libs != []) { | 1310 if (_native_libs != []) { |
1150 action("${_template_name}__prepare_native") { | 1311 action("${_template_name}__prepare_native") { |
1151 script = "//build/android/gyp/pack_arm_relocations.py" | 1312 script = "//build/android/gyp/pack_arm_relocations.py" |
1152 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" | 1313 packed_libraries_dir = "$_native_libs_dir/$android_app_abi" |
1153 depfile = "$target_gen_dir/$target_name.d" | 1314 depfile = "$target_gen_dir/$target_name.d" |
1154 outputs = [ | 1315 outputs = [ depfile ] |
1155 depfile | |
1156 ] | |
1157 inputs = [ | 1316 inputs = [ |
1158 _build_config | 1317 _build_config, |
1159 ] | 1318 ] |
1160 deps = [] | 1319 deps = [] |
1161 skip_packing_list = [ | 1320 skip_packing_list = [ |
1162 "gdbserver", | 1321 "gdbserver", |
1163 "libchromium_android_linker.so", | 1322 "libchromium_android_linker.so", |
1164 ] | 1323 ] |
1165 | 1324 |
1166 enable_packing_arg = 0 | 1325 enable_packing_arg = 0 |
1167 if (_enable_relocation_packing) { | 1326 if (_enable_relocation_packing) { |
1168 enable_packing_arg = 1 | 1327 enable_packing_arg = 1 |
1169 deps += [ | 1328 deps += [ relocation_packer_target ] |
1170 relocation_packer_target | |
1171 ] | |
1172 } | 1329 } |
1173 | 1330 |
1174 args = [ | 1331 args = [ |
1175 "--depfile", rebase_path(depfile, root_build_dir), | 1332 "--depfile", |
| 1333 rebase_path(depfile, root_build_dir), |
1176 "--enable-packing=$enable_packing_arg", | 1334 "--enable-packing=$enable_packing_arg", |
1177 "--has-relocations-with-addends=$relocations_have_addends", | 1335 "--has-relocations-with-addends=$relocations_have_addends", |
1178 "--exclude-packing-list=$skip_packing_list", | 1336 "--exclude-packing-list=$skip_packing_list", |
1179 "--android-pack-relocations", rebase_path(relocation_packer_exe, root_bu
ild_dir), | 1337 "--android-pack-relocations", |
1180 "--android-objcopy", rebase_path(android_objcopy, root_build_dir), | 1338 rebase_path(relocation_packer_exe, root_build_dir), |
1181 "--stripped-libraries-dir", rebase_path(root_build_dir, root_build_dir), | 1339 "--android-objcopy", |
1182 "--packed-libraries-dir", rebase_path(packed_libraries_dir, root_build_d
ir), | 1340 rebase_path(android_objcopy, root_build_dir), |
| 1341 "--stripped-libraries-dir", |
| 1342 rebase_path(root_build_dir, root_build_dir), |
| 1343 "--packed-libraries-dir", |
| 1344 rebase_path(packed_libraries_dir, root_build_dir), |
1183 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", | 1345 "--libraries=@FileArg(${_rebased_build_config}:native:libraries)", |
1184 "--clear-dir" | 1346 "--clear-dir", |
1185 ] | 1347 ] |
1186 | 1348 |
1187 if (is_debug) { | 1349 if (is_debug) { |
1188 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) | 1350 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) |
1189 inputs += [ android_gdbserver ] | 1351 inputs += [ android_gdbserver ] |
1190 args += [ | 1352 args += [ "--libraries=$rebased_gdbserver" ] |
1191 "--libraries=$rebased_gdbserver" | |
1192 ] | |
1193 } | 1353 } |
1194 } | 1354 } |
1195 } | 1355 } |
1196 | 1356 |
1197 final_deps += [":${_template_name}__create"] | 1357 final_deps += [ ":${_template_name}__create" ] |
1198 create_apk("${_template_name}__create") { | 1358 create_apk("${_template_name}__create") { |
1199 apk_path = _final_apk_path | 1359 apk_path = _final_apk_path |
1200 android_manifest = invoker.android_manifest | 1360 android_manifest = invoker.android_manifest |
1201 resources_zip = all_resources_zip_path | 1361 resources_zip = all_resources_zip_path |
1202 dex_path = final_dex_path | 1362 dex_path = final_dex_path |
1203 load_library_from_apk = _load_library_from_apk | 1363 load_library_from_apk = _load_library_from_apk |
1204 | 1364 |
1205 version_code = "1" | 1365 version_code = "1" |
1206 if (defined(invoker.version_code)) { | 1366 if (defined(invoker.version_code)) { |
1207 version_code = invoker.version_code | 1367 version_code = invoker.version_code |
1208 } | 1368 } |
1209 | 1369 |
1210 version_name = "Developer Build" | 1370 version_name = "Developer Build" |
1211 if (defined(invoker.version_name)) { | 1371 if (defined(invoker.version_name)) { |
1212 version_name = invoker.version_name | 1372 version_name = invoker.version_name |
1213 } | 1373 } |
1214 | 1374 |
1215 if (defined(invoker.asset_location)) { | |
1216 asset_location = invoker.asset_location | |
1217 } | |
1218 | |
1219 keystore_name = _keystore_name | 1375 keystore_name = _keystore_name |
1220 keystore_path = _keystore_path | 1376 keystore_path = _keystore_path |
1221 keystore_password = _keystore_password | 1377 keystore_password = _keystore_password |
1222 | 1378 |
| 1379 deps = [] |
| 1380 if (defined(invoker.asset_location)) { |
| 1381 asset_location = invoker.asset_location |
| 1382 |
| 1383 # We don't know the exact dependencies that create the assets in |
| 1384 # |asset_location|; we depend on all caller deps until a better solution |
| 1385 # is figured out (http://crbug.com/433330). |
| 1386 if (defined(invoker.deps)) { |
| 1387 deps += invoker.deps |
| 1388 } |
| 1389 } |
| 1390 |
1223 if (_native_libs != []) { | 1391 if (_native_libs != []) { |
1224 native_libs_dir = _native_libs_dir | 1392 native_libs_dir = _native_libs_dir |
1225 deps = [":${_template_name}__prepare_native"] | 1393 deps += [ ":${_template_name}__prepare_native" ] |
1226 } | 1394 } |
1227 } | 1395 } |
1228 | 1396 |
1229 group(target_name) { | 1397 group(target_name) { |
1230 deps = final_deps | 1398 deps = final_deps |
1231 if (defined(invoker.datadeps)) { | 1399 if (defined(invoker.datadeps)) { |
1232 # TODO(cjhopman): Fix this when group datadeps works. | 1400 # TODO(cjhopman): Fix this when group datadeps works. |
1233 deps += invoker.datadeps | 1401 deps += invoker.datadeps |
1234 } | 1402 } |
1235 } | 1403 } |
1236 } | 1404 } |
1237 | 1405 |
1238 | |
1239 # Declare an Android gtest apk | 1406 # Declare an Android gtest apk |
1240 # | 1407 # |
1241 # This target creates an Android apk for running gtest-based unittests. | 1408 # This target creates an Android apk for running gtest-based unittests. |
1242 # | 1409 # |
1243 # Variables | 1410 # Variables |
1244 # deps: Specifies the dependencies of this target. These will be passed to | 1411 # deps: Specifies the dependencies of this target. These will be passed to |
1245 # the underlying android_apk invocation and should include the java and | 1412 # the underlying android_apk invocation and should include the java and |
1246 # resource dependencies of the apk. | 1413 # resource dependencies of the apk. |
1247 # unittests_dep: This should be the label of the gtest native target. This | 1414 # unittests_dep: This should be the label of the gtest native target. This |
1248 # target must be defined previously in the same file. | 1415 # target must be defined previously in the same file. |
(...skipping 17 matching lines...) Expand all Loading... |
1266 | 1433 |
1267 if (defined(invoker.unittests_binary)) { | 1434 if (defined(invoker.unittests_binary)) { |
1268 unittests_binary = invoker.unittests_binary | 1435 unittests_binary = invoker.unittests_binary |
1269 } else { | 1436 } else { |
1270 unittests_binary = "lib" + test_suite_name + ".so" | 1437 unittests_binary = "lib" + test_suite_name + ".so" |
1271 } | 1438 } |
1272 | 1439 |
1273 android_apk(target_name) { | 1440 android_apk(target_name) { |
1274 _apk_name = test_suite_name | 1441 _apk_name = test_suite_name |
1275 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" | 1442 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" |
1276 java_files = [ | 1443 java_files = |
1277 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" | 1444 [ "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestA
ctivity.java" ] |
1278 ] | |
1279 android_manifest = "//testing/android/java/AndroidManifest.xml" | 1445 android_manifest = "//testing/android/java/AndroidManifest.xml" |
1280 native_libs = [ unittests_binary ] | 1446 native_libs = [ unittests_binary ] |
1281 deps = [ "//base:base_java" ] | 1447 deps = [ |
| 1448 "//base:base_java", |
| 1449 ] |
1282 if (defined(invoker.deps)) { | 1450 if (defined(invoker.deps)) { |
1283 deps += invoker.deps | 1451 deps += invoker.deps |
1284 } | 1452 } |
1285 datadeps = [ | 1453 datadeps = [ |
1286 "//tools/android/forwarder2", | 1454 "//tools/android/forwarder2", |
1287 "//tools/android/md5sum", | 1455 "//tools/android/md5sum", |
1288 ] | 1456 ] |
1289 } | 1457 } |
1290 } | 1458 } |
1291 | 1459 |
(...skipping 10 matching lines...) Expand all Loading... |
1302 # | 1470 # |
1303 # Example | 1471 # Example |
1304 # android_aidl("foo_aidl") { | 1472 # android_aidl("foo_aidl") { |
1305 # import_include = "java/src" | 1473 # import_include = "java/src" |
1306 # sources = [ | 1474 # sources = [ |
1307 # "java/src/com/foo/bar/FooBarService.aidl", | 1475 # "java/src/com/foo/bar/FooBarService.aidl", |
1308 # "java/src/com/foo/bar/FooBarServiceCallback.aidl", | 1476 # "java/src/com/foo/bar/FooBarServiceCallback.aidl", |
1309 # ] | 1477 # ] |
1310 # } | 1478 # } |
1311 template("android_aidl") { | 1479 template("android_aidl") { |
1312 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1480 if (defined(invoker.testonly)) { |
| 1481 testonly = invoker.testonly |
| 1482 } |
1313 | 1483 |
1314 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1484 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1315 aidl_path = "${android_sdk_build_tools}/aidl" | 1485 aidl_path = "${android_sdk_build_tools}/aidl" |
1316 framework_aidl = "$android_sdk/framework.aidl" | 1486 framework_aidl = "$android_sdk/framework.aidl" |
1317 | 1487 |
1318 action(target_name) { | 1488 action(target_name) { |
1319 script = "//build/android/gyp/aidl.py" | 1489 script = "//build/android/gyp/aidl.py" |
1320 sources = invoker.sources | 1490 sources = invoker.sources |
1321 | 1491 |
1322 imports = [ framework_aidl ] | 1492 imports = [ framework_aidl ] |
1323 if (defined(invoker.interface_file)) { | 1493 if (defined(invoker.interface_file)) { |
1324 assert(invoker.interface_file != "") | 1494 assert(invoker.interface_file != "") |
1325 imports += [ invoker.interface_file ] | 1495 imports += [ invoker.interface_file ] |
1326 } | 1496 } |
1327 | 1497 |
1328 inputs = [ | 1498 inputs = [ aidl_path ] + imports |
1329 aidl_path, | |
1330 ] + imports | |
1331 | 1499 |
1332 depfile = "${target_gen_dir}/${target_name}.d" | 1500 depfile = "${target_gen_dir}/${target_name}.d" |
1333 outputs = [ | 1501 outputs = [ |
1334 depfile, | 1502 depfile, |
1335 srcjar_path | 1503 srcjar_path, |
1336 ] | 1504 ] |
1337 rebased_imports = rebase_path(imports, root_build_dir) | 1505 rebased_imports = rebase_path(imports, root_build_dir) |
1338 args = [ | 1506 args = [ |
1339 "--depfile", rebase_path(depfile, root_build_dir), | 1507 "--depfile", |
1340 "--aidl-path", rebase_path(aidl_path, root_build_dir), | 1508 rebase_path(depfile, root_build_dir), |
| 1509 "--aidl-path", |
| 1510 rebase_path(aidl_path, root_build_dir), |
1341 "--imports=$rebased_imports", | 1511 "--imports=$rebased_imports", |
1342 "--srcjar", rebase_path(srcjar_path, root_build_dir), | 1512 "--srcjar", |
| 1513 rebase_path(srcjar_path, root_build_dir), |
1343 ] | 1514 ] |
1344 if (defined(invoker.import_include) && invoker.import_include != "") { | 1515 if (defined(invoker.import_include) && invoker.import_include != "") { |
1345 # TODO(cjhopman): aidl supports creating a depfile. We should be able to | 1516 # TODO(cjhopman): aidl supports creating a depfile. We should be able to |
1346 # switch to constructing a depfile for the overall action from that | 1517 # switch to constructing a depfile for the overall action from that |
1347 # instead of having all the .java files in the include paths as inputs. | 1518 # instead of having all the .java files in the include paths as inputs. |
1348 rebased_import_includes = rebase_path( | 1519 rebased_import_includes = |
1349 [invoker.import_include], root_build_dir) | 1520 rebase_path([ invoker.import_include ], root_build_dir) |
1350 args += [ "--includes=$rebased_import_includes" ] | 1521 args += [ "--includes=$rebased_import_includes" ] |
1351 | 1522 |
1352 _java_files_build_rel = exec_script( | 1523 _java_files_build_rel = |
1353 "//build/android/gyp/find.py", | 1524 exec_script("//build/android/gyp/find.py", |
1354 rebase_path([invoker.import_include], root_build_dir), | 1525 rebase_path([ invoker.import_include ], root_build_dir), |
1355 "list lines" | 1526 "list lines") |
1356 ) | |
1357 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | 1527 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) |
1358 inputs += _java_files | 1528 inputs += _java_files |
1359 } | 1529 } |
1360 args += rebase_path(sources, root_build_dir) | 1530 args += rebase_path(sources, root_build_dir) |
1361 } | 1531 } |
1362 } | 1532 } |
1363 | 1533 |
1364 # Creates a dist directory for a native executable. | 1534 # Creates a dist directory for a native executable. |
1365 # | 1535 # |
1366 # Running a native executable on a device requires all the shared library | 1536 # Running a native executable on a device requires all the shared library |
1367 # dependencies of that executable. To make it easier to install and run such an | 1537 # dependencies of that executable. To make it easier to install and run such an |
1368 # executable, this will create a directory containing the native exe and all | 1538 # executable, this will create a directory containing the native exe and all |
1369 # it's library dependencies. | 1539 # it's library dependencies. |
1370 # | 1540 # |
1371 # Note: It's usually better to package things as an APK than as a native | 1541 # Note: It's usually better to package things as an APK than as a native |
1372 # executable. | 1542 # executable. |
1373 # | 1543 # |
1374 # Variables | 1544 # Variables |
1375 # dist_dir: Directory for the exe and libraries. Everything in this directory | 1545 # dist_dir: Directory for the exe and libraries. Everything in this directory |
1376 # will be deleted before copying in the exe and libraries. | 1546 # will be deleted before copying in the exe and libraries. |
1377 # binary: Path to (stripped) executable. | 1547 # binary: Path to (stripped) executable. |
1378 # | 1548 # |
1379 # Example | 1549 # Example |
1380 # create_native_executable_dist("foo_dist") { | 1550 # create_native_executable_dist("foo_dist") { |
1381 # dist_dir = "$root_build_dir/foo_dist" | 1551 # dist_dir = "$root_build_dir/foo_dist" |
1382 # binary = "$root_build_dir/exe.stripped/foo" | 1552 # binary = "$root_build_dir/exe.stripped/foo" |
1383 # } | 1553 # } |
1384 template("create_native_executable_dist") { | 1554 template("create_native_executable_dist") { |
1385 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1555 if (defined(invoker.testonly)) { |
| 1556 testonly = invoker.testonly |
| 1557 } |
1386 | 1558 |
1387 dist_dir = invoker.dist_dir | 1559 dist_dir = invoker.dist_dir |
1388 binary = invoker.binary | 1560 binary = invoker.binary |
1389 final_deps = [] | 1561 final_deps = [] |
1390 template_name = target_name | 1562 template_name = target_name |
1391 | 1563 |
1392 libraries_list = "${target_gen_dir}/${template_name}_library_dependencies.list
" | 1564 libraries_list = |
| 1565 "${target_gen_dir}/${template_name}_library_dependencies.list" |
1393 | 1566 |
1394 # TODO(gyp) | 1567 # TODO(gyp) |
1395 #'dependencies': [ | 1568 #'dependencies': [ |
1396 #'<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 1569 #'<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
1397 #], | 1570 #], |
1398 | 1571 |
1399 stripped_libraries_dir = "$root_build_dir/lib.stripped" | 1572 stripped_libraries_dir = "$root_build_dir/lib.stripped" |
1400 final_deps += [ ":${template_name}__find_library_dependencies" ] | 1573 final_deps += [ ":${template_name}__find_library_dependencies" ] |
1401 action("${template_name}__find_library_dependencies") { | 1574 action("${template_name}__find_library_dependencies") { |
1402 script = "//build/android/gyp/write_ordered_libraries.py" | 1575 script = "//build/android/gyp/write_ordered_libraries.py" |
1403 depfile = "$target_gen_dir/$target_name.d" | 1576 depfile = "$target_gen_dir/$target_name.d" |
1404 inputs = [ | 1577 inputs = [ |
1405 binary, | 1578 binary, |
1406 android_readelf, | 1579 android_readelf, |
1407 ] | 1580 ] |
1408 outputs = [ | 1581 outputs = [ |
1409 depfile, | 1582 depfile, |
1410 libraries_list, | 1583 libraries_list, |
1411 ] | 1584 ] |
1412 rebased_binaries = rebase_path([ binary ], root_build_dir) | 1585 rebased_binaries = rebase_path([ binary ], root_build_dir) |
1413 args = [ | 1586 args = [ |
1414 "--depfile", rebase_path(depfile, root_build_dir), | 1587 "--depfile", |
| 1588 rebase_path(depfile, root_build_dir), |
1415 "--input-libraries=$rebased_binaries", | 1589 "--input-libraries=$rebased_binaries", |
1416 "--libraries-dir", rebase_path(stripped_libraries_dir, root_build_dir), | 1590 "--libraries-dir", |
1417 "--output", rebase_path(libraries_list, root_build_dir), | 1591 rebase_path(stripped_libraries_dir, root_build_dir), |
1418 "--readelf", rebase_path(android_readelf, root_build_dir), | 1592 "--output", |
| 1593 rebase_path(libraries_list, root_build_dir), |
| 1594 "--readelf", |
| 1595 rebase_path(android_readelf, root_build_dir), |
1419 ] | 1596 ] |
1420 } | 1597 } |
1421 | 1598 |
1422 final_deps += [ ":${template_name}__copy_libraries_and_exe" ] | 1599 final_deps += [ ":${template_name}__copy_libraries_and_exe" ] |
1423 copy_ex("${template_name}__copy_libraries_and_exe") { | 1600 copy_ex("${template_name}__copy_libraries_and_exe") { |
1424 clear_dir = true | 1601 clear_dir = true |
1425 inputs = [ | 1602 inputs = [ |
1426 binary, | 1603 binary, |
1427 libraries_list | 1604 libraries_list, |
1428 ] | 1605 ] |
1429 dest = dist_dir | 1606 dest = dist_dir |
1430 rebased_binaries_list = rebase_path([ binary ], root_build_dir) | 1607 rebased_binaries_list = rebase_path([ binary ], root_build_dir) |
1431 rebased_libraries_list = rebase_path(libraries_list, root_build_dir) | 1608 rebased_libraries_list = rebase_path(libraries_list, root_build_dir) |
1432 args = [ | 1609 args = [ |
1433 "--files=$rebased_binaries_list", | 1610 "--files=$rebased_binaries_list", |
1434 "--files=@FileArg($rebased_libraries_list:libraries)", | 1611 "--files=@FileArg($rebased_libraries_list:libraries)", |
1435 ] | 1612 ] |
1436 } | 1613 } |
1437 | 1614 |
1438 group(target_name) { | 1615 group(target_name) { |
1439 deps = final_deps | 1616 deps = final_deps |
1440 } | 1617 } |
1441 } | 1618 } |
1442 | 1619 |
1443 | |
1444 # Compile a protocol buffer to java. | 1620 # Compile a protocol buffer to java. |
1445 # | 1621 # |
1446 # This generates java files from protocol buffers and creates an Android library | 1622 # This generates java files from protocol buffers and creates an Android library |
1447 # containing the classes. | 1623 # containing the classes. |
1448 # | 1624 # |
1449 # Variables | 1625 # Variables |
1450 # sources: Paths to .proto files to compile. | 1626 # sources: Paths to .proto files to compile. |
1451 # proto_path: Root directory of .proto files. | 1627 # proto_path: Root directory of .proto files. |
1452 # | 1628 # |
1453 # Example: | 1629 # Example: |
1454 # proto_java_library("foo_proto_java") { | 1630 # proto_java_library("foo_proto_java") { |
1455 # proto_path = [ "src/foo" ] | 1631 # proto_path = [ "src/foo" ] |
1456 # sources = [ "$proto_path/foo.proto" ] | 1632 # sources = [ "$proto_path/foo.proto" ] |
1457 # } | 1633 # } |
1458 template("proto_java_library") { | 1634 template("proto_java_library") { |
1459 _protoc_dep = "//third_party/android_protobuf:android_protoc($host_toolchain)" | 1635 _protoc_dep = "//third_party/android_protobuf:android_protoc($host_toolchain)" |
1460 _protoc_out_dir = get_label_info(_protoc_dep, "root_out_dir") | 1636 _protoc_out_dir = get_label_info(_protoc_dep, "root_out_dir") |
1461 _protoc_bin = "$_protoc_out_dir/android_protoc" | 1637 _protoc_bin = "$_protoc_out_dir/android_protoc" |
1462 _proto_path = invoker.proto_path | 1638 _proto_path = invoker.proto_path |
1463 | 1639 |
1464 _template_name = target_name | 1640 _template_name = target_name |
1465 | 1641 |
1466 action("${_template_name}__protoc_java") { | 1642 action("${_template_name}__protoc_java") { |
1467 srcjar_path = "$target_gen_dir/$target_name.srcjar" | 1643 srcjar_path = "$target_gen_dir/$target_name.srcjar" |
1468 script = "//build/protoc_java.py" | 1644 script = "//build/protoc_java.py" |
1469 deps = [ | 1645 deps = [ |
1470 _protoc_dep | 1646 _protoc_dep, |
1471 ] | 1647 ] |
1472 sources = invoker.sources | 1648 sources = invoker.sources |
1473 depfile = "$target_gen_dir/$target_name.d" | 1649 depfile = "$target_gen_dir/$target_name.d" |
1474 outputs = [ | 1650 outputs = [ |
1475 depfile, | 1651 depfile, |
1476 srcjar_path, | 1652 srcjar_path, |
1477 ] | 1653 ] |
1478 args = [ | 1654 args = [ |
1479 "--depfile", rebase_path(depfile, root_build_dir), | 1655 "--depfile", |
1480 "--protoc", rebase_path(_protoc_bin, root_build_dir), | 1656 rebase_path(depfile, root_build_dir), |
1481 "--proto-path", rebase_path(_proto_path, root_build_dir), | 1657 "--protoc", |
1482 "--srcjar", rebase_path(srcjar_path, root_build_dir), | 1658 rebase_path(_protoc_bin, root_build_dir), |
1483 ] + rebase_path(sources, root_build_dir) | 1659 "--proto-path", |
| 1660 rebase_path(_proto_path, root_build_dir), |
| 1661 "--srcjar", |
| 1662 rebase_path(srcjar_path, root_build_dir), |
| 1663 ] + rebase_path(sources, root_build_dir) |
1484 } | 1664 } |
1485 | 1665 |
1486 android_library(target_name) { | 1666 android_library(target_name) { |
1487 java_files = [] | 1667 java_files = [] |
1488 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 1668 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
1489 deps = [ | 1669 deps = [ |
1490 "//third_party/android_protobuf:protobuf_nano_javalib", | 1670 "//third_party/android_protobuf:protobuf_nano_javalib", |
1491 ] | 1671 ] |
1492 } | 1672 } |
1493 } | 1673 } |
1494 | 1674 |
1495 # TODO(GYP): implement this. | 1675 # TODO(GYP): implement this. |
1496 template("uiautomator_test") { | 1676 template("uiautomator_test") { |
1497 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 1677 if (defined(invoker.testonly)) { |
| 1678 testonly = invoker.testonly |
| 1679 } |
1498 assert(target_name != "") | 1680 assert(target_name != "") |
1499 assert(invoker.deps != [] || true) | 1681 assert(invoker.deps != [] || true) |
1500 group(target_name) { | 1682 group(target_name) { |
1501 } | 1683 } |
1502 } | 1684 } |
OLD | NEW |