diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 17:31:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 17:31:42 +0000 |
commit | 5c516502c91dbc7d19fec0b210d0717594caff5c (patch) | |
tree | b3048cb8ed91a943331a95e3530561b64c12bec3 /tools/gn/secondary | |
parent | 404d1a2071bf3963cde2802238ff6d29a65dd482 (diff) | |
download | chromium_src-5c516502c91dbc7d19fec0b210d0717594caff5c.zip chromium_src-5c516502c91dbc7d19fec0b210d0717594caff5c.tar.gz chromium_src-5c516502c91dbc7d19fec0b210d0717594caff5c.tar.bz2 |
Work on generated resources for GN chrome build.
This adds some more grit targets and improves the grit rule. It still doesn't work as noted in grit_rule.gni
This checks template invocations for unused variables. This was forgotten and I noticed it when testing.
BUG=288991
R=koz@chromium.org
Review URL: https://codereview.chromium.org/23934012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/secondary')
-rw-r--r-- | tools/gn/secondary/chrome/BUILD.gn | 73 | ||||
-rw-r--r-- | tools/gn/secondary/tools/grit/grit_rule.gni | 31 |
2 files changed, 86 insertions, 18 deletions
diff --git a/tools/gn/secondary/chrome/BUILD.gn b/tools/gn/secondary/chrome/BUILD.gn index 4d48a99..53d772c 100644 --- a/tools/gn/secondary/chrome/BUILD.gn +++ b/tools/gn/secondary/chrome/BUILD.gn @@ -130,6 +130,10 @@ static_library("debugger") { ] deps = [ + ":chrome_extra_resources", + ":chrome_resources", + ":chrome_strings", + ":theme_resources", "//base", "//net", "//net:http_server", @@ -175,6 +179,28 @@ static_library("utility") { external = true } + +# Credits ---------------------------------------------------------------------- + +about_credits_file = "$root_gen_dir/about_credits.html" +build_relative_about_credits_file = to_build_path(about_credits_file) + +custom("about_credits") { + script = "//tools/licenses.py" + outputs = [ about_credits_file ] + + # This script is impossible to write proper input dependencies for because it + # basically greps the source tree for third_party directories. If a directory + # is added or removed, it will change the result, but there is no way to + # express this as a build dependency. We approximate this by depending on + # the last change file to force an update whenever the code is updated. + source_deps = [ "//build/utils/LASTCHANGE" ] + + hard_dep = true + + args = [ "credits", build_relative_about_credits_file ] +} + # Resources -------------------------------------------------------------------- group("chrome_resources") { @@ -185,15 +211,14 @@ group("chrome_resources") { ] } grit("browser_resources") { - external = true source = "browser/browser_resources.grd" + grit_flags = [ "-E", "about_credits_file=$build_relative_about_credits_file" ] + deps = [ ":about_credits" ] } grit("common_resources") { - external = true source = "common/common_resources.grd" } grit("renderer_resources") { - external = true source = "renderer/resources/renderer_resources.grd" } @@ -206,19 +231,15 @@ group("chrome_strings") { ] } grit("locale_settings") { - external = true source = "app/resources/locale_settings.grd" } grit("chromium_strings") { - external = true source = "app/chromium_strings.grd" } grit("generated_resources") { - external = true source = "app/generated_resources.grd" } grit("google_chrome_strings") { - external = true source = "app/google_chrome_strings.grd" } @@ -230,35 +251,57 @@ group("chrome_extra_resources") { ":sync_internals_resources", ":translate_internals_resources", ] + + if (!is_ios) { + deps += [ + ":component_extension_resources", + ":devtools_discovery_page_resources", + ":options_resources", + ":quota_internals_resources", + ":sync_file_system_internals_resources", + ] + } +} +grit("component_extension_resources") { + source = "browser/resources/component_extension_resources.grd" +} +grit("devtools_discovery_page_resources") { + source = "browser/devtools/frontend/devtools_discovery_page_resources.grd" } grit("memory_internals_resources") { - external = true source = "browser/resources/memory_internals_resources.grd" } +grit("quota_internals_resources") { + source = "browser/resources/quota_internals_resources.grd" +} grit("net_internals_resources") { - external = true source = "browser/resources/net_internals_resources.grd" } +grit("options_resources") { + source = "browser/resources/options_resources.grd" +} grit("signin_internals_resources") { - external = true source = "browser/resources/signin_internals_resources.grd" } +grit("sync_file_system_internals_resources") { + source = "browser/resources/sync_file_system_internals_resources.grd" +} grit("sync_internals_resources") { - external = true source = "browser/resources/sync_internals_resources.grd" } grit("translate_internals_resources") { - external = true source = "browser/resources/translate_internals_resources.grd" } group("theme_resources") { deps = [ - ":app_theme_resources", + ":theme_resources_gen", #"//ui:ui_resources", ] } -grit("app_theme_resources") { - external = true + +# TODO(brettw) rename "app_theme_resources" or something when we don't support +# GYP any more. This name is required to match the GYP build. +grit("theme_resources_gen") { source = "app/theme/theme_resources.grd" } diff --git a/tools/gn/secondary/tools/grit/grit_rule.gni b/tools/gn/secondary/tools/grit/grit_rule.gni index 22a90ac..3db2c33 100644 --- a/tools/gn/secondary/tools/grit/grit_rule.gni +++ b/tools/gn/secondary/tools/grit/grit_rule.gni @@ -2,6 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# Instantiate grit. This will produce a script target to run grit, and a +# static library that compiles the .cc files. +# +# Example: +# grit("my_resources") { +# source = "myfile.grd" # source is required. +# grit_flags = [ "-E", "foo=bar" ] # Optional extra flags. +# # You can also put deps here if the grit source depends on generated +# # files. +# } template("grit") { assert(defined(source), "\"source\" must be defined for the grit template $target_name") @@ -14,10 +24,19 @@ template("grit") { grit_info_script = to_build_path("//tools/grit/grit_info.py") source_path = to_build_path(source) + if (!defined(grit_flags)) { + grit_flags = [] # These are optional so default to empty list. + } + + # TODO(brettw) these are wrong because grit outputs the file names relative + # to its current directory (the build output) and we want them relative + # to the current input directory. We need a way to rebase the paths we get + # back. grit_inputs = exec_script(grit_info_script, - [ "--inputs", source_path, "-f", resource_ids], "list lines") + [ "--inputs", source_path, "-f", resource_ids] + grit_flags, "list lines") grit_outputs = exec_script(grit_info_script, - [ "--outputs", "$output_dir", source_path, "-f", resource_ids ], + [ "--outputs", "$output_dir", source_path, "-f", resource_ids ] + + grit_flags, "list lines") # The current grit setup makes an file in $target_gen_dir/grit/foo.h that @@ -40,7 +59,9 @@ template("grit") { "-i", source_path, "build", "-f", resource_ids, "-o", output_dir, - ] + ] + grit_flags + + # Inherit deps from template invocation if any. } # This is the thing that people actually link with, it must be named the @@ -51,6 +72,10 @@ template("grit") { hard_dep = true sources = grit_outputs + + # Deps set on the template invocation will go on the grit script running + # target rather than this library. + deps = [] deps = [ ":$grit_custom_target" ] direct_dependent_configs = [ ":$grit_config" ] } |