| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (mac_views_browser) { | 296 if (mac_views_browser) { |
| 297 grit_defines += [ | 297 grit_defines += [ |
| 298 "-D", | 298 "-D", |
| 299 "mac_views_browser", | 299 "mac_views_browser", |
| 300 ] | 300 ] |
| 301 } | 301 } |
| 302 | 302 |
| 303 grit_resource_id_file = "//tools/gritsettings/resource_ids" | 303 grit_resource_id_file = "//tools/gritsettings/resource_ids" |
| 304 grit_info_script = "//tools/grit/grit_info.py" | 304 grit_info_script = "//tools/grit/grit_info.py" |
| 305 | 305 |
| 306 js_minifier = rebase_path("//third_party/closure_compiler/js_minify.py") |
| 307 |
| 306 template("grit") { | 308 template("grit") { |
| 307 assert(defined(invoker.source), | 309 assert(defined(invoker.source), |
| 308 "\"source\" must be defined for the grit template $target_name") | 310 "\"source\" must be defined for the grit template $target_name") |
| 309 | 311 |
| 310 grit_inputs = [ invoker.source ] | 312 grit_inputs = [ invoker.source ] |
| 311 | 313 |
| 312 if (defined(invoker.resource_ids)) { | 314 if (defined(invoker.resource_ids)) { |
| 313 resource_ids = invoker.resource_ids | 315 resource_ids = invoker.resource_ids |
| 314 } else { | 316 } else { |
| 315 resource_ids = grit_resource_id_file | 317 resource_ids = grit_resource_id_file |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 foreach(i, invoker.defines) { | 436 foreach(i, invoker.defines) { |
| 435 args += [ | 437 args += [ |
| 436 "-D", | 438 "-D", |
| 437 i, | 439 i, |
| 438 ] | 440 ] |
| 439 } | 441 } |
| 440 } | 442 } |
| 441 | 443 |
| 442 args += grit_flags + assert_files_flags | 444 args += grit_flags + assert_files_flags |
| 443 | 445 |
| 446 if (strip_resource_files) { |
| 447 args += [ |
| 448 "--js-minifier", |
| 449 js_minifier, |
| 450 ] |
| 451 } |
| 452 |
| 444 if (defined(invoker.visibility)) { | 453 if (defined(invoker.visibility)) { |
| 445 # This needs to include both what the invoker specified (since they | 454 # This needs to include both what the invoker specified (since they |
| 446 # probably include generated headers from this target), as well as the | 455 # probably include generated headers from this target), as well as the |
| 447 # generated source set (since there's no guarantee that the visibility | 456 # generated source set (since there's no guarantee that the visibility |
| 448 # specified by the invoker includes our target). | 457 # specified by the invoker includes our target). |
| 449 # | 458 # |
| 450 # Only define visibility at all if the invoker specified it. Otherwise, | 459 # Only define visibility at all if the invoker specified it. Otherwise, |
| 451 # we want to keep the public "no visibility specified" default. | 460 # we want to keep the public "no visibility specified" default. |
| 452 visibility = target_visibility + invoker.visibility | 461 visibility = target_visibility + invoker.visibility |
| 453 } | 462 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 if (defined(invoker.configs)) { | 495 if (defined(invoker.configs)) { |
| 487 configs += invoker.configs | 496 configs += invoker.configs |
| 488 } | 497 } |
| 489 | 498 |
| 490 if (defined(invoker.visibility)) { | 499 if (defined(invoker.visibility)) { |
| 491 visibility = invoker.visibility | 500 visibility = invoker.visibility |
| 492 } | 501 } |
| 493 output_name = grit_output_name | 502 output_name = grit_output_name |
| 494 } | 503 } |
| 495 } | 504 } |
| OLD | NEW |