Encode all grit outputs in .gn files

This finishes the rest of the Grit outputs that was started in a previous pass, and removes the ability to optionally deduce outputs at GN-time (which is slow so we don't want to do it).

R=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/411543005

git-svn-id: http://src.chromium.org/svn/trunk/src/build@284947 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
brettw@chromium.org 2014-07-23 16:32:32 +00:00
Родитель 0cf7e5f8bf
Коммит 4cf8684f3e
3 изменённых файлов: 31 добавлений и 330 удалений

Просмотреть файл

@ -335,6 +335,7 @@ template("android_resources") {
# Variables
# deps: Specifies the dependencies of this target.
# grd_file: Path to the .grd file to generate strings.xml from.
# outputs: Expected grit outputs (see grit rule).
#
# Example
# java_strings_grd("foo_strings_grd") {
@ -351,8 +352,11 @@ template("java_strings_grd") {
}
}
# Put grit files into this subdirectory of target_gen_dir.
extra_output_path = target_name + "_grit_output"
grit_target_name = "${target_name}__grit"
grit_output_dir = base_path + "_grit_output"
grit_output_dir = "$target_gen_dir/$extra_output_path"
grit(grit_target_name) {
grit_flags = [
"-E", "ANDROID_JAVA_TAGGED_ONLY=false",
@ -360,6 +364,10 @@ template("java_strings_grd") {
output_dir = grit_output_dir
resource_ids = ""
source = invoker.grd_file
# The grit rule expects files relative to target_gen_dir, but this rule
# appends a suffix to that. This rebase will prepend extra_output_path to
# each filename.
outputs = rebase_path(invoker.outputs, ".", extra_output_path)
}
# This needs to get outputs from grit's internal target, not the final

Просмотреть файл

@ -1,299 +0,0 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/crypto.gni")
import("//build/config/ui.gni")
import("//tools/grit/grit_rule.gni")
executable("chrome") {
sources = [
"app/breakpad_field_trial_win.cc",
"app/breakpad_field_trial_win.h",
"app/breakpad_win.cc",
"app/breakpad_win.h",
"app/chrome_dll_resource.h",
"app/chrome_exe_main_aura.cc",
"app/chrome_exe_main_gtk.cc",
"app/chrome_exe_main_mac.cc",
"app/chrome_exe_main_win.cc",
"app/chrome_exe_resource.h",
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
"app/client_util.cc",
"app/client_util.h",
"app/hard_error_handler_win.cc",
"app/hard_error_handler_win.h",
"app/metro_driver_win.cc",
"app/metro_driver_win.h",
"../content/app/startup_helper_win.cc",
]
if (is_linux) {
configs += [
# TODO(brettw) this is wrong, it should be picked up from deps.
"//build/config/linux:gtk",
"//build/config/linux:x11",
]
}
deps = [
# TODO(brettw) this is right on linux? Everything is linked into the
# exe, but wrong on Windows, where chrome_exe and chrome_dll are separate.
":browser",
":common",
":debugger",
":plugin",
":renderer",
":utility",
"//base",
]
# TODO(brettw) this isn't right for all platforms.
if (!use_aura) {
sources -= [ "app/chrome_exe_main_aura.cc" ]
}
if (!is_win) {
sources -= [
"app/client_util.cc",
"app/client_util.h",
]
}
}
static_library("browser") {
if (is_linux) {
configs += [
"//build/config/linux:x11",
]
}
deps = [
"//third_party/expat",
]
}
static_library("common") {
if (!use_openssl && is_linux) {
# common/net uses NSS.
# TODO(brettw) have a better way to express this without having to do
# "if (use_nss)" everywhere.
configs += [ "//third_party/nss:nss_linux_config" ]
}
deps = [
]
}
# TODO(brettw) move to browser/devtools/BUILD.gn
source_set("debugger") {
sources = [
"browser/devtools/device/adb/adb_client_socket.cc",
"browser/devtools/device/adb/adb_client_socket.h",
"browser/devtools/device/adb/adb_device_info_query.h",
"browser/devtools/device/adb/adb_device_info_query.cc",
"browser/devtools/device/adb/adb_device_provider.cc",
"browser/devtools/device/adb/adb_device_provider.h",
"browser/devtools/device/android_device_manager.cc",
"browser/devtools/device/android_device_manager.h",
"browser/devtools/device/android_web_socket.cc",
"browser/devtools/device/devtools_android_bridge.cc",
"browser/devtools/device/devtools_android_bridge.h",
"browser/devtools/device/port_forwarding_controller.cc",
"browser/devtools/device/port_forwarding_controller.h",
"browser/devtools/device/self_device_provider.cc",
"browser/devtools/device/self_device_provider.h",
"browser/devtools/device/usb/android_rsa.cc",
"browser/devtools/device/usb/android_rsa.h",
"browser/devtools/device/usb/android_usb_device.cc",
"browser/devtools/device/usb/android_usb_device.h",
"browser/devtools/device/usb/android_usb_socket.cc",
"browser/devtools/device/usb/android_usb_socket.h",
"browser/devtools/device/usb/usb_device_provider.cc",
"browser/devtools/device/usb/usb_device_provider.h",
"browser/devtools/browser_list_tabcontents_provider.cc",
"browser/devtools/browser_list_tabcontents_provider.h",
"browser/devtools/devtools_contents_resizing_strategy.cc",
"browser/devtools/devtools_contents_resizing_strategy.h",
"browser/devtools/devtools_embedder_message_dispatcher.cc",
"browser/devtools/devtools_embedder_message_dispatcher.h",
"browser/devtools/devtools_file_helper.cc",
"browser/devtools/devtools_file_helper.h",
"browser/devtools/devtools_file_system_indexer.cc",
"browser/devtools/devtools_file_system_indexer.h",
"browser/devtools/devtools_network_controller.cpp",
"browser/devtools/devtools_network_controller.h",
"browser/devtools/devtools_network_transaction.cpp",
"browser/devtools/devtools_network_transaction.h",
"browser/devtools/devtools_network_transaction_factory.cpp",
"browser/devtools/devtools_network_transaction_factory.h",
"browser/devtools/devtools_protocol.cc",
"browser/devtools/devtools_protocol.h",
"browser/devtools/devtools_toggle_action.h",
"browser/devtools/devtools_window.cc",
"browser/devtools/devtools_window.h",
"browser/devtools/remote_debugging_server.cc",
"browser/devtools/remote_debugging_server.h",
]
deps = [
# ":chrome_extra_resources",
# ":chrome_resources",
# ":chrome_strings",
# ":theme_resources",
"//base",
"//net",
"//net:http_server",
"//skia",
"//third_party/icu",
"//third_party/leveldatabase",
"//third_party/libusb",
]
if (is_android) {
sources -= [
"browser/devtools/adb/android_rsa.cc",
"browser/devtools/browser_list_tabcontents_provider.cc",
"browser/devtools/devtools_file_system_indexer.cc",
"browser/devtools/devtools_window.cc",
"browser/devtools/remote_debugging_server.cc",
]
deps -= [ "//third_party/libusb" ]
}
# TODO implement debug_devtools
# if (debug_devtools) {
# defines = [ "DEBUG_DEVTOOLS=1" ]
# }
# TODO(brettw) this may be required on Windows:
# if (is_win) {
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
# 'msvs_disabled_warnings': [ 4267, ]
# }
}
source_set("plugin") {
}
source_set("renderer") {
}
source_set("utility") {
}
# Credits ----------------------------------------------------------------------
about_credits_file = "$root_gen_dir/about_credits.html"
build_relative_about_credits_file =
rebase_path(about_credits_file, root_build_dir)
action("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.
inputs = [ "//build/util/LASTCHANGE" ]
args = [ "credits", build_relative_about_credits_file ]
}
# Resources --------------------------------------------------------------------
#group("chrome_resources") {
# deps = [
# ":browser_resources",
# ":common_resources",
# ":renderer_resources",
# ]
#}
#grit("browser_resources") {
# source = "browser/browser_resources.grd"
# grit_flags = [ "-E", "about_credits_file=$build_relative_about_credits_file" ]
# deps = [ ":about_credits" ]
#}
#grit("common_resources") {
# source = "common/common_resources.grd"
#}
#grit("renderer_resources") {
# source = "renderer/resources/renderer_resources.grd"
#}
#
#group("chrome_strings") {
# deps = [
# ":locale_settings",
# ":chromium_strings",
# ":generated_resources",
# ":google_chrome_strings",
# ]
#}
#grit("locale_settings") {
# source = "app/resources/locale_settings.grd"
#}
#grit("chromium_strings") {
# source = "app/chromium_strings.grd"
#}
#grit("generated_resources") {
# source = "app/generated_resources.grd"
#}
#grit("google_chrome_strings") {
# source = "app/google_chrome_strings.grd"
#}
#
#group("chrome_extra_resources") {
# deps = [
# ":memory_internals_resources",
# ":net_internals_resources",
# ":signin_internals_resources",
# ":sync_internals_resources",
# ":translate_internals_resources",
# ]
#
# if (!is_ios) {
# deps += [
# ":component_extension_resources",
# ":options_resources",
# ":quota_internals_resources",
# ":sync_file_system_internals_resources",
# ]
# }
#}
#grit("component_extension_resources") {
# source = "browser/resources/component_extension_resources.grd"
#}
#grit("memory_internals_resources") {
# source = "browser/resources/memory_internals_resources.grd"
#}
#grit("quota_internals_resources") {
# source = "browser/resources/quota_internals_resources.grd"
#}
#grit("net_internals_resources") {
# source = "browser/resources/net_internals_resources.grd"
#}
#grit("options_resources") {
# source = "browser/resources/options_resources.grd"
#}
#grit("signin_internals_resources") {
# 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") {
# source = "browser/resources/sync_internals_resources.grd"
#}
#grit("translate_internals_resources") {
# source = "browser/resources/translate_internals_resources.grd"
#}
#
## 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") {
# source = "app/theme/theme_resources.grd"
#}

Просмотреть файл

@ -7,10 +7,10 @@
#
# Parameters
#
# source
# source (required)
# Path to .grd file.
#
# outputs (optional)
# outputs (required)
# List of outputs from grit, relative to the target_gen_dir. If supplied,
# a call to Grit to compute the outputs can be skipped which will make
# GN run faster. Grit will verify at build time that this list is correct
@ -45,7 +45,13 @@
# Example
#
# grit("my_resources") {
# source = "myfile.grd" # source is required.
# # Source and outputs are required.
# source = "myfile.grd"
# outputs = [
# "foo_strings.h",
# "foo_strings.pak",
# ]
#
# grit_flags = [ "-E", "foo=bar" ] # Optional extra flags.
# # You can also put deps here if the grit source depends on generated
# # files.
@ -212,34 +218,20 @@ template("grit") {
grit_inputs = [ invoker.source ]
assert_files_flags = []
if (defined(invoker.outputs)) {
# If the declaration specified outputs, we want to make sure that they
# actually match what Grit is writing. We write the list to a file (some
# of the output lists are long enough to not fit on a Windows command line)
# and ask Grit to verify those are the actual outputs at runtime.
asserted_list_file = "$target_out_dir/${target_name}_expected_outputs.txt"
write_file(asserted_list_file,
rebase_path(invoker.outputs, root_build_dir, target_gen_dir))
assert_files_flags += [
"--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir),
]
grit_outputs = get_path_info(
rebase_path(invoker.outputs, ".", target_gen_dir),
"abspath")
} else {
# Ask Grit for the output list.
grit_outputs_build_rel = exec_script(grit_info_script,
[ "--outputs", "$rebased_output_dir", source_path, "-f", resource_ids ] +
grit_flags,
"list lines")
# The names returned by grit are relative to the current (build) directory,
# but references to files in this template are expected to be relative to
# the invoking BUILD.gn file's directory. Make it absolute so there's no
# ambiguity.
grit_outputs = get_path_info(
rebase_path(grit_outputs_build_rel, ".", root_build_dir), "abspath")
}
# We want to make sure the declared outputs actually match what Grit is
# writing. We write the list to a file (some of the output lists are long
# enough to not fit on a Windows command line) and ask Grit to verify those
# are the actual outputs at runtime.
asserted_list_file = "$target_out_dir/${target_name}_expected_outputs.txt"
write_file(asserted_list_file,
rebase_path(invoker.outputs, root_build_dir, target_gen_dir))
assert_files_flags += [
"--assert-file-list=" + rebase_path(asserted_list_file, root_build_dir),
]
grit_outputs = get_path_info(
rebase_path(invoker.outputs, ".", target_gen_dir),
"abspath")
# The config and the action below get this visibility son only the generated
# source set can depend on them. The variable "target_name" will get