| 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 # Instantiate grit. This will produce a script target to run grit, and a | 5 # Instantiate grit. This will produce a script target to run grit, and a |
| 6 # static library that compiles the .cc files. | 6 # static library that compiles the .cc files. |
| 7 # | 7 # |
| 8 # Parameters | 8 # Parameters |
| 9 # | 9 # |
| 10 # source (required) | 10 # source (required) |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ] | 292 ] |
| 293 } | 293 } |
| 294 | 294 |
| 295 grit_resource_id_file = "//tools/gritsettings/resource_ids" | 295 grit_resource_id_file = "//tools/gritsettings/resource_ids" |
| 296 grit_info_script = "//tools/grit/grit_info.py" | 296 grit_info_script = "//tools/grit/grit_info.py" |
| 297 | 297 |
| 298 template("grit") { | 298 template("grit") { |
| 299 assert(defined(invoker.source), | 299 assert(defined(invoker.source), |
| 300 "\"source\" must be defined for the grit template $target_name") | 300 "\"source\" must be defined for the grit template $target_name") |
| 301 | 301 |
| 302 grit_inputs = [ invoker.source ] |
| 303 |
| 302 if (defined(invoker.resource_ids)) { | 304 if (defined(invoker.resource_ids)) { |
| 303 resource_ids = invoker.resource_ids | 305 resource_ids = invoker.resource_ids |
| 304 } else { | 306 } else { |
| 305 resource_ids = grit_resource_id_file | 307 resource_ids = grit_resource_id_file |
| 306 } | 308 } |
| 309 grit_inputs += [ resource_ids ] # Script depends on ID file. |
| 307 | 310 |
| 308 if (defined(invoker.output_dir)) { | 311 if (defined(invoker.output_dir)) { |
| 309 output_dir = invoker.output_dir | 312 output_dir = invoker.output_dir |
| 310 } else { | 313 } else { |
| 311 output_dir = target_gen_dir | 314 output_dir = target_gen_dir |
| 312 } | 315 } |
| 313 | 316 |
| 314 if (defined(invoker.output_name)) { | 317 if (defined(invoker.output_name)) { |
| 315 grit_output_name = invoker.output_name | 318 grit_output_name = invoker.output_name |
| 316 } else { | 319 } else { |
| 317 grit_output_name = target_name | 320 grit_output_name = target_name |
| 318 } | 321 } |
| 319 | 322 |
| 320 # These are all passed as arguments to the script so have to be relative to | 323 # These are all passed as arguments to the script so have to be relative to |
| 321 # the build directory. | 324 # the build directory. |
| 322 if (resource_ids != "") { | 325 if (resource_ids != "") { |
| 323 resource_ids = rebase_path(resource_ids, root_build_dir) | 326 resource_ids = rebase_path(resource_ids, root_build_dir) |
| 324 } | 327 } |
| 325 rebased_output_dir = rebase_path(output_dir, root_build_dir) | 328 rebased_output_dir = rebase_path(output_dir, root_build_dir) |
| 326 source_path = rebase_path(invoker.source, root_build_dir) | 329 source_path = rebase_path(invoker.source, root_build_dir) |
| 327 | 330 |
| 328 if (defined(invoker.grit_flags)) { | 331 if (defined(invoker.grit_flags)) { |
| 329 grit_flags = invoker.grit_flags | 332 grit_flags = invoker.grit_flags |
| 330 } else { | 333 } else { |
| 331 grit_flags = [] # These are optional so default to empty list. | 334 grit_flags = [] # These are optional so default to empty list. |
| 332 } | 335 } |
| 333 | 336 |
| 334 grit_inputs = [ invoker.source ] | |
| 335 | |
| 336 assert_files_flags = [] | 337 assert_files_flags = [] |
| 337 | 338 |
| 338 # We want to make sure the declared outputs actually match what Grit is | 339 # We want to make sure the declared outputs actually match what Grit is |
| 339 # writing. We write the list to a file (some of the output lists are long | 340 # writing. We write the list to a file (some of the output lists are long |
| 340 # enough to not fit on a Windows command line) and ask Grit to verify those | 341 # enough to not fit on a Windows command line) and ask Grit to verify those |
| 341 # are the actual outputs at runtime. | 342 # are the actual outputs at runtime. |
| 342 asserted_list_file = | 343 asserted_list_file = |
| 343 "$target_out_dir/${grit_output_name}_expected_outputs.txt" | 344 "$target_out_dir/${grit_output_name}_expected_outputs.txt" |
| 344 write_file(asserted_list_file, | 345 write_file(asserted_list_file, |
| 345 rebase_path(invoker.outputs, root_build_dir, output_dir)) | 346 rebase_path(invoker.outputs, root_build_dir, output_dir)) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (defined(invoker.configs)) { | 467 if (defined(invoker.configs)) { |
| 467 configs += invoker.configs | 468 configs += invoker.configs |
| 468 } | 469 } |
| 469 | 470 |
| 470 if (defined(invoker.visibility)) { | 471 if (defined(invoker.visibility)) { |
| 471 visibility = invoker.visibility | 472 visibility = invoker.visibility |
| 472 } | 473 } |
| 473 output_name = grit_output_name | 474 output_name = grit_output_name |
| 474 } | 475 } |
| 475 } | 476 } |
| OLD | NEW |