Commit 6a90cafc authored by Brett Wilson's avatar Brett Wilson

Hook up resources to the chrome GN build.

It also hooks up libpdf which chrome requires at startup.

Adds the enable_hidpi and use_athena build flags.

Adds a locales list.

This makes the chrome target actually runnable from a GN build.

R=jamesr@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#293360}
parent 9dcd3b50
......@@ -177,6 +177,12 @@ config("feature_flags") {
if (enable_one_click_signin) {
defines += [ "ENABLE_ONE_CLICK_SIGNIN" ]
}
if (use_athena) {
defines += [ "USE_ATHENA=1" ]
}
if (enable_hidpi) {
defines += [ "ENABLE_HIDPI=1" ]
}
}
# Debug/release ----------------------------------------------------------------
......
# 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.
# Note: keep in sync with below.
locales = [
"am",
"ar",
"bg",
"bn",
"ca",
"cs",
"da",
"de",
"el",
"en-GB",
"en-US",
"es-419",
"es",
"et",
"fa",
"fi",
"fil",
"fr",
"gu",
"he",
"hi",
"hr",
"hu",
"id",
"it",
"ja",
"kn",
"ko",
"lt",
"lv",
"ml",
"mr",
"ms",
"nb",
"nl",
"pl",
"pt-BR",
"pt-PT",
"ro",
"ru",
"sk",
"sl",
"sr",
"sv",
"sw",
"ta",
"te",
"th",
"tr",
"uk",
"vi",
"zh-CN",
"zh-TW",
]
# Same as the locales list but in the format Mac expects for output files:
# it uses underscores instead of hyphens, and "en" instead of "en-US".
locales_as_mac_outputs = [
"am",
"ar",
"bg",
"bn",
"ca",
"cs",
"da",
"de",
"el",
"en_GB",
"en",
"es_419",
"es",
"et",
"fa",
"fi",
"fil",
"fr",
"gu",
"he",
"hi",
"hr",
"hu",
"id",
"it",
"ja",
"kn",
"ko",
"lt",
"lv",
"ml",
"mr",
"ms",
"nb",
"nl",
"pl",
"pt_BR",
"pt_PT",
"ro",
"ru",
"sk",
"sl",
"sr",
"sv",
"sw",
"ta",
"te",
"th",
"tr",
"uk",
"vi",
"zh_CN",
"zh_TW",
]
......@@ -61,3 +61,7 @@ use_ozone_evdev = use_ozone
use_glib = is_linux
use_clipboard_aurax11 = is_linux && use_aura && use_x11
use_athena = false
enable_hidpi = is_mac || is_chromeos || is_win
......@@ -3,7 +3,9 @@
# found in the LICENSE file.
import("//build/config/features.gni")
import("//build/config/locales.gni")
import("//build/config/ui.gni")
import("//chrome/chrome_repack_locales.gni")
import("//chrome/version.gni")
# TODO(GYP) for Windows need to the the reorder-imports step which probably
......@@ -16,6 +18,7 @@ executable("chrome") {
"app/chrome_exe_resource.h",
]
deps = []
datadeps = []
# TODO(GYP) mac_bundle_resources, xcode_settings
......@@ -79,9 +82,34 @@ executable("chrome") {
sources += [
"app/chrome_exe_main_mac.cc",
]
# TODO(GYP) lots more stuff in the is_mac block.
} else { # Non-Mac.
deps += [
":packed_extra_resources",
":packed_resources",
# Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
# file decide what to do on a per-OS basis; on Mac, internal plugins
# go inside the framework, so this dependency is in chrome_dll.gypi.
#'../third_party/adobe/flash/flash_player.gyp:flapper_binaries', TODO(GYP)
# Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
# file decide what to do on a per-OS basis; on Mac, internal plugins
# go inside the framework, so this dependency is in chrome_dll.gypi.
#'../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter', TODO(GYP)
]
# TODO(GYP) some stuff from GYP including chrome_multiple_dll.
}
# TODO(GYP) is_mac
if (!is_mac && !is_android) {
# On Mac this is done in chrome_dll.gypi. Android doesn't use pdfium.
datadeps += [ "//pdf" ]
# TODO(GYP) pdf linux symbols
}
}
shared_library("main_dll") {
......@@ -273,6 +301,206 @@ group("extra_resources") {
}
}
group("packed_resources") {
deps = [
":repack_locales_pack",
":repack_pseudo_locales_pack",
":repack_chrome_100_percent",
]
# TODO(GYP) if (is_chrome_branded) {
# ... copy default_apps from default_apps_list
if (enable_hidpi) {
deps += [ ":repack_chrome_200_percent" ]
}
}
repack("packed_extra_resources") {
visibility = ":*"
sources = [
"$root_gen_dir/chrome/browser_resources.pak",
"$root_gen_dir/chrome/app/theme/chrome_unscaled_resources.pak",
"$root_gen_dir/chrome/common_resources.pak",
"$root_gen_dir/chrome/browser/resources/invalidations_resources.pak",
"$root_gen_dir/chrome/browser/resources/memory_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/net_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/password_manager_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/signin_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/sync_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/translate_internals_resources.pak",
"$root_gen_dir/components/resources/component_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
]
deps = [
"//chrome/browser:resources",
"//chrome/app/theme:chrome_unscaled_resources",
"//chrome/common:resources",
"//chrome/browser/resources:invalidations_resources",
"//chrome/browser/resources:memory_internals_resources",
"//chrome/browser/resources:net_internals_resources",
"//chrome/browser/resources:password_manager_internals_resources",
"//chrome/browser/resources:signin_internals_resources",
"//chrome/browser/resources:sync_internals_resources",
"//chrome/browser/resources:translate_internals_resources",
"//components/resources",
"//net:net_resources",
"//ui/resources",
]
if (!is_ios && !is_android) {
# New paks should be added here by default.
sources += [
"$root_gen_dir/webkit/devtools_resources.pak",
"$root_gen_dir/chrome/browser/resources/component_extension_resources.pak",
"$root_gen_dir/chrome/browser/resources/options_resources.pak",
"$root_gen_dir/chrome/browser/resources/quota_internals_resources.pak",
"$root_gen_dir/chrome/browser/resources/sync_file_system_internals_resources.pak",
]
deps += [
"//content/browser/devtools:devtools_resources",
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:options_resources",
"//chrome/browser/resources:quota_internals_resources",
"//chrome/browser/resources:sync_file_system_internals_resources",
]
}
if (!is_ios) {
sources += [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
"$root_gen_dir/extensions/extensions_resources.pak",
]
}
if (is_chromeos) {
sources += [ "$root_gen_dir/ui/file_manager/file_manager_resources.pak" ]
deps += [ "//ui/file_manager:resources" ]
}
if (enable_extensions) {
sources += [ "$root_gen_dir/chrome/extensions_api_resources.pak" ]
deps += [ "//chrome/common:extensions_api_resources" ]
}
# GYP outputs the file in the gen/repack directory. On non-Mac/iOS platforms
# it them copies it. This skipes the copy step and writes it to the final
# location.
if (is_mac || is_ios) {
output = "$root_gen_dir/repack/resources.pak"
} else {
output = "$root_out_dir/resources.pak"
}
}
# Collects per-locale grit files from many sources into global per-locale files.
chrome_repack_locales("repack_locales_pack") {
visibility = ":*"
input_locales = locales
if (is_mac) {
output_locales = locales_as_mac_outputs
} else {
output_locales = locales
}
}
chrome_repack_locales("repack_pseudo_locales_pack") {
visibility = ":*"
input_locales = [ "fake-bidi" ]
if (is_mac) {
output_locales = [ "fake_bidi" ] # Mac uses underscores.
} else {
output_locales = [ "fake-bidi" ]
}
}
# Generates a rule to repack a set of resources, substituting a given string
# in for the percentage (e.g. "100", "200"). It generates the repacked files in
# the "gen" directory, and then introduces a copy rule to copy it to the root
# build directory.
#
# It's not clear why this two-step dance is necessary as opposed to just
# generating the file in the destination. However, this is what the GYP build
# does, and for maintenance purposes, this keeps the same files in the same
# place between the two builds when possible.
#
# Argument:
# percent [required]
# String to substitute for the percentage.
template("chrome_repack_percent") {
percent = invoker.percent
repack_name = "${target_name}_repack"
repack_output_file = "$root_gen_dir/repack/chrome_${percent}_percent.pak"
copy_name = target_name
repack(repack_name) {
visibility = ":$copy_name"
# All sources should also have deps for completeness.
sources = [
"$root_gen_dir/components/resources/component_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
"$root_gen_dir/chrome/app/theme/theme_resources_${percent}_percent.pak",
]
deps = [
"//chrome/app/theme:theme_resources",
"//chrome/renderer:resources",
"//components/strings",
"//net:net_resources",
]
if (!is_ios) {
sources += [
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
]
deps += [ "//content:resources" ]
}
if (use_ash) {
sources += [ "$root_gen_dir/ash/resources/ash_resources_${percent}_percent.pak" ]
deps += [ "//ash/resources" ]
}
if (use_athena) {
sources += [
"$root_gen_dir/athena/resources/athena_resources_${percent}_percent.pak",
]
deps += [ "//athena/resources" ]
}
if (is_chromeos) {
sources += [
"$root_gen_dir/ui/chromeos/resources/ui_chromeos_resources_${percent}_percent.pak",
]
deps += [ "//ui/chromeos/resources" ]
}
output = repack_output_file
}
copy(copy_name) {
visibility = ":*"
deps = [ ":$repack_name" ]
sources = [ repack_output_file ]
outputs = [ "$root_build_dir/chrome_${percent}_percent.pak" ]
}
}
chrome_repack_percent("repack_chrome_100_percent") {
percent = "100"
}
if (enable_hidpi) {
chrome_repack_percent("repack_chrome_200_percent") {
percent = "200"
}
}
# GYP version: chrome/chrome_resources.gyp:chrome_strings
group("strings") {
deps = [
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
# GN version: //chrome:repack_chrome_100_percent
'action_name': 'repack_chrome_resources_100_percent',
'variables': {
'pak_inputs': [
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
# GN version: //chrome:repack_chrome_200_percent
'action_name': 'repack_chrome_resources_200_percent',
'variables': {
'pak_inputs': [
......
# 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/features.gni")
import("//build/config/ui.gni")
import("//tools/grit/repack.gni")
# Arguments:
#
# locale
# Internal name of locale. e.g. "pt-BR"
#
# output
# Output file name.
#
# visibility
# Normal meaning.
template("_repack_one_locale") {
locale = invoker.locale
repack(target_name) {
visibility = invoker.visibility
# Each input pak file should also have a deps line for completeness.
sources = [
"${root_gen_dir}/chrome/app/resources/platform_locale_settings_${locale}.pak",
"${root_gen_dir}/chrome/generated_resources_${locale}.pak",
"${root_gen_dir}/chrome/locale_settings_${locale}.pak",
"${root_gen_dir}/components/strings/components_strings_${locale}.pak",
]
deps = [
"//chrome/app/resources:platform_locale_settings",
"//chrome/app:generated_resources",
"//chrome/app/resources:locale_settings",
"//components/strings",
]
if (use_ash) {
sources += [
"${root_gen_dir}/ash/strings/ash_strings_${locale}.pak",
]
deps += [
"//ash/strings",
]
}
if (is_chromeos) {
sources += [
"${root_gen_dir}/ui/chromeos/strings/ui_chromeos_strings_${locale}.pak",
]
deps += [
"//ui/chromeos/strings",
]
}
if (!is_ios) {
sources += [
"${root_gen_dir}/content/app/strings/content_strings_${locale}.pak",
"${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
"${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
]
deps += [
"//content/app/strings",
"//ui/strings:ui_strings",
"//ui/strings:app_locale_settings",
]
}
if (enable_autofill_dialog && !is_ios && !is_android) {
sources += [
"${root_gen_dir}/third_party/libaddressinput/address_input_strings_${locale}.pak",
]
deps += [
"//third_party/libaddressinput:strings",
]
}
if (enable_extensions) {
sources += [
"${root_gen_dir}/device/bluetooth/device_bluetooth_strings_${locale}.pak",
# TODO(jamescook): When Android stops building extensions code move
# this to the OS != 'ios' and OS != 'android' section.
"${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
]
deps += [
"//device/bluetooth:strings",
"//extensions/strings",
]
}
if (is_chrome_branded) {
sources += [
"${root_gen_dir/chrome/chromium_strings_${locale}.pak",
]
deps += [
"//chrome/app:chromium_strings",
]
} else {
sources += [
"${root_gen_dir}/chrome/google_chrome_strings_${locale}.pak",
]
deps += [
"//chrome/app:google_chrome_strings",
]
}
output = invoker.output
}
}
# Creates an action to call the repack_locales script.
#
# The GYP version generates the locales in the "gen" directory and then copies
# it to the root build directory. This isn't easy to express in a GN copy
# rule since the files on Mac have a complex structure. So we generate the
# files into the final place and skip the "gen" directory.
#
# This template uses GN's looping constructs to avoid the complex call to
# chrome/tools/build/repack_locales.py which wraps the repack commands in the
# GYP build.
#
# Arguments
#
# input_locales
# List of locale names to use as inputs.
#
# output_locales
# A list containing the corresponding output names for each of the
# input names. Mac uses different names in some cases.
#
# visibility
template("chrome_repack_locales") {
# This is the name of the group below that will collect all the invidual
# locale targets. External targets will depend on this.
group_target_name = target_name
# GN's subscript is too stupid to do invoker.output_locales[foo] so we need
# to make a copy and do output_locales[foo].
output_locales = invoker.output_locales
# Collects all targets the loop generates.
locale_targets = []
# This loop iterates over the input locales and also keeps a counter so it
# can simultaneously iterate over the output locales (using GN's very
# limited looping capabilities).
current_index = 0
foreach(input_locale, invoker.input_locales) {
output_locale = output_locales[current_index]
# Compute the name of the target for the current file. Save it for the deps.
current_name = "${target_name}_${input_locale}"
locale_targets += [ ":$current_name" ]
_repack_one_locale(current_name) {
visibility = ":$group_target_name"
locale = input_locale
# Compute the output name. Mac uses a different location.
if (is_mac || is_ios) {
output = "${root_gen_dir}/repack/${output_locale}.lproj/locale.pak"
} else {
output = "${root_out_dir}/locales/${output_locale}.pak"
}
}
current_index = current_index + 1
}
# The group that external targets depend on which collects all deps.
group(group_target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
deps = locale_targets
}
}
......@@ -378,6 +378,7 @@
'includes': [ '../build/grit_target.gypi' ],
},
{
# GN version: //chrome:packed_extra_resources
'target_name': 'packed_extra_resources',
'type': 'none',
'dependencies': [
......@@ -405,6 +406,7 @@
],
},
{
# GN version: //chrome:packed_resources
'target_name': 'packed_resources',
'type': 'none',
'dependencies': [
......@@ -421,6 +423,7 @@
],
'actions': [
{
# GN version: //chrome:repack_locales_pack
'action_name': 'repack_locales_pack',
'variables': {
'pak_locales': '<(locales)',
......@@ -428,6 +431,7 @@
'includes': ['chrome_repack_locales.gypi']
},
{
# GN version: //chrome:repack_pseudo_locales_pack
'action_name': 'repack_pseudo_locales_pack',
'variables': {
'pak_locales': '<(pseudo_locales)',
......
......@@ -16,6 +16,8 @@ group("resources") {
grit("devtools_resources") {
source = "$root_gen_dir/devtools/devtools_resources.grd"
# TOOD(brettw) remove this so the output file goes into the target_gen_dir,
# but keep this for not for GYP compat.
output_dir = "$root_gen_dir/webkit"
outputs = [
"grit/devtools_resources.h",
......
......@@ -117,7 +117,6 @@ static_library("bluetooth") {
}
grit("strings") {
visibility = ":*"
source = "bluetooth_strings.grd"
outputs = [
"grit/device_bluetooth_strings.h",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment