blob: 77a28ccd7e2f47faba6cc13ff1eeeed2146bfa30 [file] [log] [blame]
# 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/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/win/console_app.gni")
import("//build/config/win/manifest.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni")
if (is_android) {
import("//build/config/android/config.gni")
} else if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build/mac/tweak_info_plist.gni")
import("//third_party/icu/config.gni")
import("//v8/gni/v8.gni")
} else if (is_win) {
import("//build/win/syzygy/syzygy.gni")
}
declare_args() {
content_shell_product_name = "Content Shell"
content_shell_version = "99.77.34.5"
}
config("content_shell_lib_warnings") {
if (is_clang) {
# TODO(thakis): Remove this once http://crbug.com/383820 is figured out
cflags = [ "-Wno-nonnull" ]
}
}
static_library("content_shell_lib") {
testonly = true
sources = [
"android/shell_descriptors.h",
"android/shell_jni_registrar.cc",
"android/shell_jni_registrar.h",
"android/shell_manager.cc",
"android/shell_manager.h",
"app/blink_test_platform_support.h",
"app/blink_test_platform_support_android.cc",
"app/blink_test_platform_support_linux.cc",
"app/blink_test_platform_support_mac.mm",
"app/blink_test_platform_support_win.cc",
"app/paths_mac.h",
"app/paths_mac.mm",
"app/shell_crash_reporter_client.cc",
"app/shell_crash_reporter_client.h",
"app/shell_main_delegate.cc",
"app/shell_main_delegate.h",
"app/shell_main_delegate_mac.h",
"app/shell_main_delegate_mac.mm",
"browser/layout_test/blink_test_controller.cc",
"browser/layout_test/blink_test_controller.h",
"browser/layout_test/layout_test_android.cc",
"browser/layout_test/layout_test_android.h",
"browser/layout_test/layout_test_bluetooth_adapter_provider.cc",
"browser/layout_test/layout_test_bluetooth_adapter_provider.h",
"browser/layout_test/layout_test_bluetooth_chooser_factory.cc",
"browser/layout_test/layout_test_bluetooth_chooser_factory.h",
"browser/layout_test/layout_test_bluetooth_fake_adapter_setter_impl.cc",
"browser/layout_test/layout_test_bluetooth_fake_adapter_setter_impl.h",
"browser/layout_test/layout_test_browser_context.cc",
"browser/layout_test/layout_test_browser_context.h",
"browser/layout_test/layout_test_browser_main.cc",
"browser/layout_test/layout_test_browser_main.h",
"browser/layout_test/layout_test_browser_main_parts.cc",
"browser/layout_test/layout_test_browser_main_parts.h",
"browser/layout_test/layout_test_content_browser_client.cc",
"browser/layout_test/layout_test_content_browser_client.h",
"browser/layout_test/layout_test_devtools_frontend.cc",
"browser/layout_test/layout_test_devtools_frontend.h",
"browser/layout_test/layout_test_download_manager_delegate.cc",
"browser/layout_test/layout_test_download_manager_delegate.h",
"browser/layout_test/layout_test_first_device_bluetooth_chooser.cc",
"browser/layout_test/layout_test_first_device_bluetooth_chooser.h",
"browser/layout_test/layout_test_javascript_dialog_manager.cc",
"browser/layout_test/layout_test_javascript_dialog_manager.h",
"browser/layout_test/layout_test_message_filter.cc",
"browser/layout_test/layout_test_message_filter.h",
"browser/layout_test/layout_test_notification_manager.cc",
"browser/layout_test/layout_test_notification_manager.h",
"browser/layout_test/layout_test_permission_manager.cc",
"browser/layout_test/layout_test_permission_manager.h",
"browser/layout_test/layout_test_push_messaging_service.cc",
"browser/layout_test/layout_test_push_messaging_service.h",
"browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc",
"browser/layout_test/layout_test_resource_dispatcher_host_delegate.h",
"browser/layout_test/layout_test_url_request_context_getter.cc",
"browser/layout_test/layout_test_url_request_context_getter.h",
"browser/layout_test/secondary_test_window_observer.cc",
"browser/layout_test/secondary_test_window_observer.h",
"browser/layout_test/test_info_extractor.cc",
"browser/layout_test/test_info_extractor.h",
"browser/shell.cc",
"browser/shell.h",
"browser/shell_access_token_store.cc",
"browser/shell_access_token_store.h",
"browser/shell_android.cc",
"browser/shell_application_mac.h",
"browser/shell_application_mac.mm",
"browser/shell_browser_context.cc",
"browser/shell_browser_context.h",
"browser/shell_browser_main.cc",
"browser/shell_browser_main.h",
"browser/shell_browser_main_parts.cc",
"browser/shell_browser_main_parts.h",
"browser/shell_browser_main_parts_mac.mm",
"browser/shell_content_browser_client.cc",
"browser/shell_content_browser_client.h",
"browser/shell_devtools_frontend.cc",
"browser/shell_devtools_frontend.h",
"browser/shell_devtools_manager_delegate.cc",
"browser/shell_devtools_manager_delegate.h",
"browser/shell_download_manager_delegate.cc",
"browser/shell_download_manager_delegate.h",
"browser/shell_javascript_dialog.h",
"browser/shell_javascript_dialog_mac.mm",
"browser/shell_javascript_dialog_manager.cc",
"browser/shell_javascript_dialog_manager.h",
"browser/shell_javascript_dialog_win.cc",
"browser/shell_login_dialog.cc",
"browser/shell_login_dialog.h",
"browser/shell_login_dialog_mac.mm",
"browser/shell_mac.mm",
"browser/shell_mojo_test_utils_android.cc",
"browser/shell_mojo_test_utils_android.h",
"browser/shell_net_log.cc",
"browser/shell_net_log.h",
"browser/shell_network_delegate.cc",
"browser/shell_network_delegate.h",
"browser/shell_permission_manager.cc",
"browser/shell_permission_manager.h",
"browser/shell_platform_data_aura.cc",
"browser/shell_platform_data_aura.h",
"browser/shell_plugin_service_filter.cc",
"browser/shell_plugin_service_filter.h",
"browser/shell_quota_permission_context.cc",
"browser/shell_quota_permission_context.h",
"browser/shell_resource_dispatcher_host_delegate.cc",
"browser/shell_resource_dispatcher_host_delegate.h",
"browser/shell_speech_recognition_manager_delegate.cc",
"browser/shell_speech_recognition_manager_delegate.h",
"browser/shell_url_request_context_getter.cc",
"browser/shell_url_request_context_getter.h",
"browser/shell_web_contents_view_delegate.h",
"browser/shell_web_contents_view_delegate_android.cc",
"browser/shell_web_contents_view_delegate_creator.h",
"browser/shell_web_contents_view_delegate_mac.mm",
"common/layout_test/layout_test_content_client.cc",
"common/layout_test/layout_test_content_client.h",
"common/layout_test/layout_test_messages.cc",
"common/layout_test/layout_test_messages.h",
"common/layout_test/layout_test_switches.cc",
"common/layout_test/layout_test_switches.h",
"common/leak_detection_result.h",
"common/shell_content_client.cc",
"common/shell_content_client.h",
"common/shell_messages.cc",
"common/shell_messages.h",
"common/shell_origin_trial_policy.cc",
"common/shell_origin_trial_policy.h",
"common/shell_switches.cc",
"common/shell_switches.h",
"common/shell_test_configuration.cc",
"common/shell_test_configuration.h",
"renderer/layout_test/blink_test_helpers.cc",
"renderer/layout_test/blink_test_helpers.h",
"renderer/layout_test/blink_test_runner.cc",
"renderer/layout_test/blink_test_runner.h",
"renderer/layout_test/layout_test_content_renderer_client.cc",
"renderer/layout_test/layout_test_content_renderer_client.h",
"renderer/layout_test/layout_test_render_frame_observer.cc",
"renderer/layout_test/layout_test_render_frame_observer.h",
"renderer/layout_test/layout_test_render_thread_observer.cc",
"renderer/layout_test/layout_test_render_thread_observer.h",
"renderer/layout_test/leak_detector.cc",
"renderer/layout_test/leak_detector.h",
"renderer/layout_test/test_media_stream_renderer_factory.cc",
"renderer/layout_test/test_media_stream_renderer_factory.h",
"renderer/layout_test/test_media_stream_video_renderer.cc",
"renderer/layout_test/test_media_stream_video_renderer.h",
"renderer/shell_content_renderer_client.cc",
"renderer/shell_content_renderer_client.h",
"renderer/shell_render_view_observer.cc",
"renderer/shell_render_view_observer.h",
"utility/shell_content_utility_client.cc",
"utility/shell_content_utility_client.h",
]
configs += [
":content_shell_lib_warnings",
"//build/config:precompiled_headers",
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
"//build/config/compiler:no_size_t_to_int_warning",
"//third_party/WebKit/public:debug_devtools",
]
defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
public_deps = [
# This exposes all public content APIs.
"//content/public/app:both",
"//content/public/browser",
"//content/public/common",
"//content/public/renderer",
"//content/public/utility",
]
deps = [
":mojo_bindings",
":resources",
"//base",
"//base:base_static",
"//base/third_party/dynamic_annotations",
"//cc",
"//components/crash/content/app:app_breakpad_mac_win_to_be_deleted",
"//components/plugins/renderer",
"//components/test_runner:test_runner",
"//components/url_formatter",
"//components/web_cache/renderer",
"//content:resources",
"//content/app/resources",
"//content/app/strings",
"//content/gpu",
"//content/test:content_test_mojo_bindings",
"//content/test:layouttest_support",
"//content/test:test_support",
"//device/bluetooth",
"//device/bluetooth:mocks",
"//device/geolocation:device_geolocation",
"//gin",
"//gpu",
"//ipc",
"//media",
"//net",
"//net:net_resources",
"//sandbox",
"//services/shell/public/cpp",
"//skia",
"//storage/browser",
"//testing/gmock",
"//testing/gtest",
"//third_party/WebKit/public:blink",
"//third_party/WebKit/public:image_resources",
"//third_party/WebKit/public:resources",
"//third_party/WebKit/public:test_support",
"//third_party/icu",
"//ui/base",
"//ui/base/ime",
"//ui/display",
"//ui/events:events_base",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gfx/ipc",
"//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia",
"//ui/gl",
"//url",
"//v8",
]
# Annoyingly, this target and layouttest_support have circular includes.
allow_circular_includes_from = [ "//content/test:layouttest_support" ]
if (enable_plugins) {
deps += [
"//content/ppapi_plugin",
"//ppapi:blink_deprecated_test_plugin",
"//ppapi:blink_test_plugin",
"//ppapi/shared_impl",
]
}
if (mojo_media_host == "browser") {
deps += [ "//media/mojo/services" ]
}
if (is_win) {
sources += [
"common/v8_breakpad_support_win.cc",
"common/v8_breakpad_support_win.h",
]
}
if (is_linux) {
deps += [
"//build/linux:fontconfig",
"//ui/gfx:test_support",
]
}
if (use_x11) {
# Some tests rely on this tool at runtime. Note: it might be better if
# the tests that needed it had this as a dep instead of adding it here.
data_deps = [
"//tools/xdisplaycheck",
]
deps += [ "//ui/events/devices/x11" ]
}
if (is_android) {
deps += [ "//content/shell/android:content_shell_jni_headers" ]
}
if (is_posix && !is_mac) {
deps += [
"//components/crash/content/app",
"//components/crash/content/browser",
]
}
if (use_aura) {
deps += [
"//ui/aura",
"//ui/aura:test_support",
"//ui/events",
"//ui/strings",
"//ui/wm",
]
if (toolkit_views) {
sources += [
"browser/shell_views.cc",
"browser/shell_web_contents_view_delegate_views.cc",
]
deps += [
"//ui/resources",
"//ui/views",
"//ui/views:test_support",
"//ui/views/controls/webview",
"//ui/wm:test_support",
]
} else {
sources += [
"browser/shell_aura.cc",
"browser/shell_web_contents_view_delegate_aura.cc",
]
}
} else {
sources -= [
"browser/shell_platform_data_aura.cc",
"browser/shell_platform_data_aura.h",
]
}
if (is_chromeos) {
deps += [
"//chromeos",
"//ui/wm:test_support",
]
}
if (is_linux) {
deps += [ "//third_party/freetype2" ]
}
if (!enable_plugins) {
sources -= [
"browser/shell_plugin_service_filter.cc",
"browser/shell_plugin_service_filter.h",
]
}
}
grit("content_shell_resources_grit") {
# External code should depend on ":resources" instead.
visibility = [ ":*" ]
source = "shell_resources.grd"
outputs = [
"grit/shell_resources.h",
"shell_resources.pak",
]
}
copy("copy_shell_resources") {
sources = [
"$target_gen_dir/shell_resources.pak",
]
outputs = [
"$root_out_dir/shell_resources.pak",
]
public_deps = [
":content_shell_resources_grit",
]
}
group("resources") {
public_deps = [
":copy_shell_resources",
]
deps = [
"//components/test_runner:resources",
]
}
repack("pak") {
sources = [
"$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
"$root_gen_dir/content/app/strings/content_strings_en-US.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/content/shell/shell_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
]
deps = [
":resources",
"//content:resources",
"//content/app/resources",
"//content/app/strings",
"//content/browser/tracing:resources",
"//net:net_resources",
"//third_party/WebKit/public:image_resources",
"//third_party/WebKit/public:resources",
"//ui/resources",
"//ui/strings",
]
if (toolkit_views) {
deps += [ "//ui/views/resources" ]
sources +=
[ "$root_gen_dir/ui/views/resources/views_resources_100_percent.pak" ]
}
sources += [ "$root_gen_dir/blink/devtools_resources.pak" ]
deps += [ "//content/browser/devtools:resources" ]
output = "$root_out_dir/content_shell.pak"
}
if (is_android) {
group("content_shell") {
testonly = true
deps = [
"//content/shell/android:content_shell_apk",
]
}
} else if (is_mac) {
tweak_info_plist("content_shell_plist") {
testonly = true
info_plist = "app/app-Info.plist"
args = [
"--scm=1",
"--version",
content_shell_version,
]
}
mac_app_bundle("content_shell") {
testonly = true
output_name = content_shell_product_name
sources = [
"app/shell_main.cc",
]
deps = [
":content_shell_framework_bundle_data",
":content_shell_resources_bundle_data",
"//build/config/sanitizers:deps",
# TODO(rsesek): Remove this after GYP is gone, since it only needs to
# be here per the comment in blink_test_platform_support_mac.mm about
# the bundle structure.
"//components/test_runner:resources",
]
ldflags = [
# The main app is at Content Shell.app/Contents/MacOS/Content Shell
# so set the rpath up to Contents/ so that the loader can find
# Framworks/.
"-rpath",
"@executable_path/../",
]
info_plist_target = ":content_shell_plist"
}
} else {
# TODO(brettw) when GYP is no longer necessary, delete
# content/shell/app/shell.exe.manifest. This file is not used in GN.
executable("content_shell") {
testonly = true
# TODO(GYP) mac resource bundle stuff for this target.
sources = [
"app/shell_main.cc",
]
if (is_win) {
sources += [ "app/shell.rc" ]
}
defines = []
deps = [
":content_shell_lib",
":pak",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
]
if (is_win) {
deps += [ "//sandbox" ]
# This is a large module that can't do incremental linking in some cases.
configs -= [ "//build/config/win:default_incremental_linking" ]
configs +=
[ "//build/config/win:default_large_module_incremental_linking" ]
if (win_console_app) {
defines += [ "WIN_CONSOLE_APP" ]
} else {
# Set /SUBSYSTEM:WINDOWS unless a console build has been requested.
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
}
}
if (is_linux && !is_component_build) {
# Set rpath to find our own libfreetype even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
}
}
if (is_win) {
# GYP version: content/content_shell_and_tests.gyp:content_shell_crash_service
executable("content_shell_crash_service") {
sources = [
"tools/content_shell_crash_service.cc",
]
deps = [
"//base",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
"//components/crash/content/tools:crash_service",
]
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
}
if (is_syzyasan) {
syzygy_asan("content_shell_syzyasan") {
binary_name = "content_shell.exe"
dest_dir = "$root_out_dir/syzygy"
deps = [
"//content/shell:content_shell",
]
testonly = true
}
}
}
if (is_mac) {
mac_xib_bundle_data("content_shell_framework_xibs") {
sources = [
"app/English.lproj/HttpAuth.xib",
"app/English.lproj/MainMenu.xib",
]
output_path = "{{bundle_resources_dir}}/English.lproj"
}
bundle_data("content_shell_framework_resources") {
sources = [
"$root_out_dir/content_shell.pak",
"resources/missingImage.png",
"resources/textAreaResizeCorner.png",
]
public_deps = [
":pak",
]
if (icu_use_data_file) {
sources += [ "$root_out_dir/icudtl.dat" ]
deps = [
"//third_party/icu:icudata",
]
}
if (v8_use_external_startup_data) {
sources += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
public_deps += [ "//v8" ]
}
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
if (enable_plugins) {
bundle_data("content_shell_framework_plugins") {
sources = [
"$root_out_dir/blink_deprecated_test_plugin.plugin",
"$root_out_dir/blink_test_plugin.plugin",
]
outputs = [
"{{bundle_root_dir}}/{{source_file_part}}",
]
public_deps = [
"//ppapi:blink_deprecated_test_plugin",
"//ppapi:blink_test_plugin",
]
}
}
content_shell_framework_name = "$content_shell_product_name Framework"
content_shell_helper_name = "$content_shell_product_name Helper"
tweak_info_plist("content_shell_framework_plist") {
testonly = true
info_plist = "app/framework-Info.plist"
args = [
"--breakpad=0",
"--keystone=0",
"--scm=1",
"--version",
content_shell_version,
"--branding",
content_shell_product_name,
]
}
mac_framework_bundle("content_shell_framework") {
testonly = true
output_name = content_shell_framework_name
sources = [
"app/shell_content_main.cc",
"app/shell_content_main.h",
]
# TODO(rsesek): Handle these missing pieces:
# - crash_inspector
# - crash_report_sender.app
public_deps = [
":content_shell_lib",
]
deps = [
":content_shell_framework_resources",
":content_shell_framework_xibs",
"//third_party/icu:icudata",
]
if (enable_plugins) {
deps += [ ":content_shell_framework_plugins" ]
}
# Both the main :content_shell and :content_shell_helper_app executables
# need to link the framework. Because they are at different directory
# depths, using @executable_path as the install_name would require using
# install_name_tool on one of the executables. However install_name_tool
# only operates in-place, which is problematic to express in GN. Instead,
# use rpath-based loading.
# TODO(rsesek): After GYP is gone, re-write content_shell_main to be like
# chrome_main and use dlopen() instead of a linked framework.
ldflags = [ "-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name" ]
if (is_component_build) {
# Set up the rpath for the framework so that it can find dylibs in the
# root output directory. The framework is at
# Content Shell.app/Contents/Frameworks/Content Shell Framework.framework/Content Shell Framework
# so use loader_path to go back to the root output directory.
ldflags += [
"-rpath",
"@loader_path/../../../..",
]
}
info_plist_target = ":content_shell_framework_plist"
}
tweak_info_plist("content_shell_helper_plist") {
testonly = true
info_plist = "app/helper-Info.plist"
args = [
"--breakpad=0",
"--keystone=0",
"--scm=0",
"--version",
content_shell_version,
]
}
mac_app_bundle("content_shell_helper_app") {
testonly = true
output_name = content_shell_helper_name
sources = [
"app/shell_main.cc",
]
deps = [
":content_shell_framework+link",
"//build/config/sanitizers:deps",
]
ldflags = [
# The helper is in Content Shell.app/Contents/Frameworks/Content Shell Helper.app/Contents/MacOS/
# so set rpath up to Contents/ so that the loader can find Frameworks/.
"-rpath",
"@executable_path/../../../..",
]
info_plist_target = ":content_shell_helper_plist"
}
bundle_data("content_shell_framework_bundle_data") {
testonly = true
sources = [
"$root_out_dir/$content_shell_framework_name.framework",
"$root_out_dir/$content_shell_helper_name.app",
]
outputs = [
"{{bundle_root_dir}}/Frameworks/{{source_file_part}}",
]
public_deps = [
":content_shell_framework+link",
":content_shell_helper_app",
]
}
bundle_data("content_shell_resources_bundle_data") {
testonly = true
sources = [
"app/app.icns",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
}
mojom("mojo_bindings") {
sources = [
"common/layout_test/layout_test_bluetooth_fake_adapter_setter.mojom",
]
}