| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (use_ash) { | 139 if (use_ash) { |
| 140 grit_defines += [ | 140 grit_defines += [ |
| 141 "-D", | 141 "-D", |
| 142 "use_ash", | 142 "use_ash", |
| 143 ] | 143 ] |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (use_nss_certs) { | 146 if (use_nss_certs) { |
| 147 grit_defines += [ | 147 grit_defines += [ |
| 148 "-D", | 148 "-D", |
| 149 "use_nss", | 149 "use_nss_certs", |
| 150 ] | 150 ] |
| 151 } | 151 } |
| 152 | 152 |
| 153 if (use_ozone) { | 153 if (use_ozone) { |
| 154 grit_defines += [ | 154 grit_defines += [ |
| 155 "-D", | 155 "-D", |
| 156 "use_ozone", | 156 "use_ozone", |
| 157 ] | 157 ] |
| 158 } | 158 } |
| 159 | 159 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 rebase_path("//build/ios/grit_whitelist.txt", root_build_dir), | 197 rebase_path("//build/ios/grit_whitelist.txt", root_build_dir), |
| 198 ] | 198 ] |
| 199 } | 199 } |
| 200 | 200 |
| 201 if (enable_extensions) { | 201 if (enable_extensions) { |
| 202 grit_defines += [ | 202 grit_defines += [ |
| 203 "-D", | 203 "-D", |
| 204 "enable_extensions", | 204 "enable_extensions", |
| 205 ] | 205 ] |
| 206 } | 206 } |
| 207 if (enable_media_router) { |
| 208 grit_defines += [ |
| 209 "-D", |
| 210 "enable_media_router", |
| 211 ] |
| 212 } |
| 207 if (enable_plugins) { | 213 if (enable_plugins) { |
| 208 grit_defines += [ | 214 grit_defines += [ |
| 209 "-D", | 215 "-D", |
| 210 "enable_plugins", | 216 "enable_plugins", |
| 211 ] | 217 ] |
| 212 } | 218 } |
| 213 if (enable_basic_printing || enable_print_preview) { | 219 if (enable_basic_printing || enable_print_preview) { |
| 214 grit_defines += [ | 220 grit_defines += [ |
| 215 "-D", | 221 "-D", |
| 216 "enable_printing", | 222 "enable_printing", |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 ] | 298 ] |
| 293 } | 299 } |
| 294 | 300 |
| 295 grit_resource_id_file = "//tools/gritsettings/resource_ids" | 301 grit_resource_id_file = "//tools/gritsettings/resource_ids" |
| 296 grit_info_script = "//tools/grit/grit_info.py" | 302 grit_info_script = "//tools/grit/grit_info.py" |
| 297 | 303 |
| 298 template("grit") { | 304 template("grit") { |
| 299 assert(defined(invoker.source), | 305 assert(defined(invoker.source), |
| 300 "\"source\" must be defined for the grit template $target_name") | 306 "\"source\" must be defined for the grit template $target_name") |
| 301 | 307 |
| 308 grit_inputs = [ invoker.source ] |
| 309 |
| 302 if (defined(invoker.resource_ids)) { | 310 if (defined(invoker.resource_ids)) { |
| 303 resource_ids = invoker.resource_ids | 311 resource_ids = invoker.resource_ids |
| 304 } else { | 312 } else { |
| 305 resource_ids = grit_resource_id_file | 313 resource_ids = grit_resource_id_file |
| 306 } | 314 } |
| 315 grit_inputs += [ resource_ids ] # Script depends on ID file. |
| 307 | 316 |
| 308 if (defined(invoker.output_dir)) { | 317 if (defined(invoker.output_dir)) { |
| 309 output_dir = invoker.output_dir | 318 output_dir = invoker.output_dir |
| 310 } else { | 319 } else { |
| 311 output_dir = target_gen_dir | 320 output_dir = target_gen_dir |
| 312 } | 321 } |
| 313 | 322 |
| 314 if (defined(invoker.output_name)) { | 323 if (defined(invoker.output_name)) { |
| 315 grit_output_name = invoker.output_name | 324 grit_output_name = invoker.output_name |
| 316 } else { | 325 } else { |
| 317 grit_output_name = target_name | 326 grit_output_name = target_name |
| 318 } | 327 } |
| 319 | 328 |
| 320 # These are all passed as arguments to the script so have to be relative to | 329 # These are all passed as arguments to the script so have to be relative to |
| 321 # the build directory. | 330 # the build directory. |
| 322 if (resource_ids != "") { | 331 if (resource_ids != "") { |
| 323 resource_ids = rebase_path(resource_ids, root_build_dir) | 332 resource_ids = rebase_path(resource_ids, root_build_dir) |
| 324 } | 333 } |
| 325 rebased_output_dir = rebase_path(output_dir, root_build_dir) | 334 rebased_output_dir = rebase_path(output_dir, root_build_dir) |
| 326 source_path = rebase_path(invoker.source, root_build_dir) | 335 source_path = rebase_path(invoker.source, root_build_dir) |
| 327 | 336 |
| 328 if (defined(invoker.grit_flags)) { | 337 if (defined(invoker.grit_flags)) { |
| 329 grit_flags = invoker.grit_flags | 338 grit_flags = invoker.grit_flags |
| 330 } else { | 339 } else { |
| 331 grit_flags = [] # These are optional so default to empty list. | 340 grit_flags = [] # These are optional so default to empty list. |
| 332 } | 341 } |
| 333 | 342 |
| 334 grit_inputs = [ invoker.source ] | |
| 335 | |
| 336 assert_files_flags = [] | 343 assert_files_flags = [] |
| 337 | 344 |
| 338 # We want to make sure the declared outputs actually match what Grit is | 345 # 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 | 346 # 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 | 347 # enough to not fit on a Windows command line) and ask Grit to verify those |
| 341 # are the actual outputs at runtime. | 348 # are the actual outputs at runtime. |
| 342 asserted_list_file = | 349 asserted_list_file = |
| 343 "$target_out_dir/${grit_output_name}_expected_outputs.txt" | 350 "$target_out_dir/${grit_output_name}_expected_outputs.txt" |
| 344 write_file(asserted_list_file, | 351 write_file(asserted_list_file, |
| 345 rebase_path(invoker.outputs, root_build_dir, output_dir)) | 352 rebase_path(invoker.outputs, root_build_dir, output_dir)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 364 include_dirs = [ output_dir ] | 371 include_dirs = [ output_dir ] |
| 365 } | 372 } |
| 366 visibility = target_visibility | 373 visibility = target_visibility |
| 367 } | 374 } |
| 368 | 375 |
| 369 grit_custom_target = target_name + "_grit" | 376 grit_custom_target = target_name + "_grit" |
| 370 action(grit_custom_target) { | 377 action(grit_custom_target) { |
| 371 script = "//tools/grit/grit.py" | 378 script = "//tools/grit/grit.py" |
| 372 inputs = grit_inputs | 379 inputs = grit_inputs |
| 373 | 380 |
| 374 # TODO(knn): Remove this once grit has rolled to recognize the flag. | 381 depfile = "$output_dir/${grit_output_name}_stamp.d" |
| 375 depend_on_stamp = | 382 outputs = [ "${depfile}.stamp" ] + grit_outputs |
| 376 defined(invoker.depend_on_stamp) && invoker.depend_on_stamp | |
| 377 if (depend_on_stamp) { | |
| 378 # Need this for migrating existing targets without clobbering. | |
| 379 depfile = "$output_dir/${grit_output_name}_stamp.d" | |
| 380 outputs = [ | |
| 381 "${depfile}.stamp", | |
| 382 ] | |
| 383 } else { | |
| 384 depfile = "$output_dir/${grit_output_name}.d" | |
| 385 outputs = [] | |
| 386 } | |
| 387 outputs += grit_outputs | |
| 388 | 383 |
| 389 args = [ | 384 args = [ |
| 390 "-i", | 385 "-i", |
| 391 source_path, | 386 source_path, |
| 392 "build", | 387 "build", |
| 393 ] | 388 ] |
| 394 if (resource_ids != "") { | 389 if (resource_ids != "") { |
| 395 args += [ | 390 args += [ |
| 396 "-f", | 391 "-f", |
| 397 resource_ids, | 392 resource_ids, |
| 398 ] | 393 ] |
| 399 } | 394 } |
| 400 args += [ | 395 args += [ |
| 401 "-o", | 396 "-o", |
| 402 rebased_output_dir, | 397 rebased_output_dir, |
| 403 "--depdir", | 398 "--depdir", |
| 404 ".", | 399 ".", |
| 405 "--depfile", | 400 "--depfile", |
| 406 rebase_path(depfile, root_build_dir), | 401 rebase_path(depfile, root_build_dir), |
| 407 "--write-only-new=1", | 402 "--write-only-new=1", |
| 408 ] | 403 "--depend-on-stamp", |
| 409 if (depend_on_stamp) { | 404 ] + grit_defines |
| 410 args += [ "--depend-on-stamp" ] | |
| 411 } | |
| 412 args += grit_defines | |
| 413 | 405 |
| 414 # Add extra defines with -D flags. | 406 # Add extra defines with -D flags. |
| 415 if (defined(invoker.defines)) { | 407 if (defined(invoker.defines)) { |
| 416 foreach(i, invoker.defines) { | 408 foreach(i, invoker.defines) { |
| 417 args += [ | 409 args += [ |
| 418 "-D", | 410 "-D", |
| 419 i, | 411 i, |
| 420 ] | 412 ] |
| 421 } | 413 } |
| 422 } | 414 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (defined(invoker.configs)) { | 458 if (defined(invoker.configs)) { |
| 467 configs += invoker.configs | 459 configs += invoker.configs |
| 468 } | 460 } |
| 469 | 461 |
| 470 if (defined(invoker.visibility)) { | 462 if (defined(invoker.visibility)) { |
| 471 visibility = invoker.visibility | 463 visibility = invoker.visibility |
| 472 } | 464 } |
| 473 output_name = grit_output_name | 465 output_name = grit_output_name |
| 474 } | 466 } |
| 475 } | 467 } |
| OLD | NEW |