Commit 8f132304 authored by Brett Wilson's avatar Brett Wilson

Make chrome GN build work in component mode.

This also fixes a resources regression (added extensions resources) that caused chrome not to run.

R=jamesr@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#294406}
parent 36e91cd9
......@@ -173,12 +173,12 @@ shared_library("main_dll") {
if (false) { #chrome_multiple_dll) {
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
deps += [
"//content/app:browser",
"//content/public/app:browser",
]
} else {
deps += [
":child_dependencies",
"//content/app:both",
"//content/public/app:both",
]
}
......@@ -230,8 +230,7 @@ group("child_dependencies") {
"//chrome/plugin",
"//chrome/renderer",
"//chrome/utility",
"//content/gpu",
"//content/ppapi_plugin",
"//content/public/child",
"//third_party/WebKit/public:blink_devtools_frontend_resources",
]
}
......@@ -481,6 +480,11 @@ template("chrome_repack_percent") {
]
deps += [ "//ui/chromeos/resources" ]
}
if (enable_extensions) {
sources += [
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
]
}
output = repack_output_file
}
......
......@@ -92,6 +92,7 @@ static_library("browser") {
"//courgette:courgette_lib",
"//crypto",
"//google_apis",
"//gpu/config",
"//jingle:notifier",
"//skia",
"//sql",
......
......@@ -9,16 +9,43 @@ config("content_implementation") {
defines = [ "CONTENT_IMPLEMENTATION" ]
}
# When targets depend on, e.g. //content/public/browser, what happens? To
# facilitate the complexity here, the "public" targets are groups that forward
# to the right thing depending on the build mode. Say for additional
# illustration, the public browser sources also depend on the public common
# ones.
#
# The non-component build is easy:
# foo ->
# //content/public/browser (group) ->
# //content/public/browser:browser_sources (source set) ->
# //content/browser (source set, this is the non-public browser target)
# //content/public/common:common_sources (source set)
#
# The component build is more complicated because we want everybody to depend on
# one content shared library regardless of which public target they depend on:
# foo ->
# //content/public/browser (group) ->
# //content (shared library) ->
# //content/public/browser:browser_sources (source set) ->
# //content/browser (source set; this is the non-public browser target)
# //content/public/common:common_sources (source set)
#
# That the internal content dependencies must depend on the *_sources targets
# to avoid dependency cycles, and external dependencies must depend on the
# //content/public/browser and similar targets to avoid double-linking (these
# targets make sure the dependency goes through the content shared library
# when doing a component build).
content_shared_components = [
"//content/gpu",
"//content/plugin",
"//content/public/browser:browser_sources",
"//content/public/child",
"//content/public/common",
"//content/public/plugin",
"//content/public/renderer",
"//content/public/utility",
"//content/renderer",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
"//content/public/plugin:plugin_sources",
"//content/public/renderer:renderer_sources",
"//content/public/utility:utility_sources",
]
if (enable_plugins) {
......@@ -28,8 +55,7 @@ if (enable_plugins) {
if (is_component_build) {
shared_library("content") {
deps = content_shared_components + [
"//content/app",
"//content/public/app",
"//content/public/app:both_sources",
]
forward_dependent_configs_from = deps
}
......
......@@ -25,7 +25,7 @@ content_app_deps = [
# picking the allocator.
"//base/allocator",
"//content:export",
"//content/public/common",
"//content/public/common:common_sources",
"//crypto",
"//ui/base",
"//ui/gfx",
......@@ -63,55 +63,41 @@ content_app_extra_configs = [
"//content:content_implementation",
]
if (is_component_build) {
source_set("app") {
sources = content_app_sources
configs += content_app_extra_configs
deps = content_app_deps
}
# This includes the app sources for both the browser and child processes.
source_set("both") {
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/app:*" ]
# In the component build, all of these app targets redirect to the content
# component. The content component in turn references the "app" target above.
group("browser") {
deps = [ "//content" ]
}
group("child") {
deps = [ "//content" ]
}
group("both") {
deps = [ "//content" ]
}
} else {
# Non-component build. In this case, we have different versions of
# "content/app" for the browser and child process.
sources = content_app_sources
configs += content_app_extra_configs
deps = content_app_deps
}
# TODO(GYP) enable chrome_multiple_dll support
is_chrome_multiple_dll = false
# TODO(GYP) enable chrome_multiple_dll support
is_chrome_multiple_dll = false
if (is_chrome_multiple_dll) {
# It doesn't make sense to do the browser/child dll split in component mode.
assert(!is_component_build)
source_set("browser") {
visibility = [ "//content/public/app:browser" ]
sources = content_app_sources
configs += content_app_extra_configs
deps = content_app_deps
if (is_chrome_multiple_dll) {
defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}
defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}
source_set("child") {
sources = content_app_sources
configs += content_app_extra_configs
deps = content_app_deps
if (is_chrome_multiple_dll) {
defines += [ "CHROME_MULTIPLE_DLL_CHILD" ]
}
}
visibility = [ "//content/public/app:child" ]
# Includes both browser and child process app sources.
source_set("both") {
sources = content_app_sources
configs += content_app_extra_configs
deps = content_app_deps
defines += [ "CHROME_MULTIPLE_DLL_CHILD" ]
}
}
......@@ -6,15 +6,10 @@ import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//content/browser/browser.gni")
config("storage_config") {
if (is_android) {
defines = [ "APPCACHE_USE_SIMPLE_CACHE" ]
}
}
source_set("browser") {
# Only targets in the content tree can depend directly on this target.
visibility = [ "//content/*" ]
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/browser:browser_sources" ]
defines = []
libs = []
......@@ -27,7 +22,7 @@ source_set("browser") {
"//content:resources",
"//content/browser/service_worker:proto",
"//content/browser/speech/proto",
"//content/public/common",
"//content/public/common:common_sources",
"//crypto",
"//google_apis",
"//net",
......
......@@ -8,8 +8,9 @@ import("//build/config/ui.gni")
import("//content/child/child.gni")
source_set("child") {
# Only targets in the content tree can depend directly on this target.
visibility = [ "//content/*" ]
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/child:child_sources" ]
sources = rebase_path(content_child_gypi_values.private_child_sources,
".", "//content")
......
......@@ -8,8 +8,9 @@ import("//content/common/common.gni")
import("//mojo/public/tools/bindings/mojom.gni")
source_set("common") {
# Only targets in the content tree can depend directly on this target.
visibility = [ "//content/*" ]
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/common:common_sources" ]
sources = rebase_path(content_common_gypi_values.private_common_sources,
".", "//content")
......@@ -51,6 +52,7 @@ source_set("common") {
# content and moved to android_webview. See crbug.com/365797.
"//gpu/command_buffer/client:gl_in_process_context",
"//gpu/command_buffer/client:gles2_c_lib",
"//gpu/command_buffer/client:gles2_cmd_helper",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/service",
"//gpu/ipc",
......
......@@ -6,9 +6,7 @@ import("//build/config/ui.gni")
import("//content/content.gni")
source_set("gpu") {
# TODO(brettw) it seems like this should be only visible to content like
# the other non-public content directories are. But this is depended on by
# the chrome target.
visibility = [ "//content/*" ]
sources = [
"gpu_main.cc",
......
......@@ -7,7 +7,10 @@ import("//build/config/features.gni")
# This is the NPAPI plugin process. It isn't used on Linux.
if (enable_plugins && !is_linux) {
source_set("plugin") {
visibility = [ "//content/*" ]
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/plugin:plugin_sources" ]
sources = [
"plugin_channel.cc",
"plugin_channel.h",
......
......@@ -3,6 +3,8 @@
# found in the LICENSE file.
source_set("ppapi_plugin") {
visibility = [ "//content/*" ]
sources = [
"broker_process_dispatcher.cc",
"broker_process_dispatcher.h",
......@@ -21,6 +23,8 @@ source_set("ppapi_plugin") {
deps = [
"//base",
"//content:export",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
"//mojo/public/interfaces/application",
"//ppapi:ppapi_ipc",
"//skia",
......
......@@ -2,47 +2,57 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Used internally to hold the sources shared between the various targets below.
source_set("app_shared_sources") {
# content_main_delegate.cc has ifdefs that depend on whether the file is
# being used in the context of the browser or child process. So that file has
# to be included in the per-type targets below rather than in this shared one.
sources = [
"android_library_loader_hooks.h",
"content_main.h",
"content_main_runner.h",
"startup_helper_win.h",
]
configs += [ "//content:content_implementation" ]
deps = [
"//base",
"//base:i18n",
"//content:export",
"//content/common",
"//content/public/plugin",
"//content/public/renderer",
"//content/public/utility",
]
}
# App different than the regular content subcomponents (see comments in
# //content/BUILD.gn) because it has to support the browser/child process split
# (the "both" target include both browser and child process files and is used
# for testing).
#
# In non-component mode, browser, child, and both all follow the same structure:
# foo ->
# //content/public/app:child (group) ->
# //content/public/app:child_sources (source set) ->
# //content/app:child (source set)
# In component mode, content is linked as one big turd so there is only one
# app target containing sources ("both") and the other ones forward to it:
# foo ->
# //content/public/app:child (group; "browser" and "both" ones look the same)
# //content (shared library) ->
# //content/public/app:both_sources (source set)
public_app_shared_sources = [
"android_library_loader_hooks.h",
"content_main.h",
"content_main_delegate.cc",
"content_main_delegate.h",
"content_main_runner.h",
"startup_helper_win.h",
]
public_app_shared_deps = [
"//base",
"//base:i18n",
"//content:export",
"//content/public/common:common_sources",
]
# The structure of this is like the private content/app implementation.
if (is_component_build) {
source_set("app") {
sources = [
"content_main_delegate.cc",
"content_main_delegate.h",
]
source_set("both_sources") {
# Only the main content shared library can pull this in.
visibility = [ "//content:content" ]
deps = [
":app_shared_sources",
"//content/app",
"//content/common",
"//content/public/browser",
sources = public_app_shared_sources
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:both",
"//content/public/browser:browser_sources",
]
}
# These all just forward to content, which in turn depends on "both_sources".
group("browser") {
deps = [ "//content" ]
}
......@@ -55,55 +65,70 @@ if (is_component_build) {
} else {
source_set("browser") {
# See comment in "child" target.
check_includes = false
sources = [
"content_main_delegate.cc",
"content_main_delegate.h",
]
deps = [
":app_shared_sources",
"//content/app:browser",
"//content/public/browser",
"//content/public/common",
]
}
source_set("child") {
# content_main_delegate.cc conditionally includes content_browser_client.h
# from //content/public/browser when it's not the child build. However,
# the header checker doesn't know this doesn't apply and throws an error.
#
# TODO(brettw) either teach the header checker to understand simple
# ifdefs or split the file apart so we can enable header checking here.
# Furthermore, since this file exists in more than one target, they all
# have to opt-out of header checking (a file is checked once for all
# targets using a source file).
check_includes = false
sources = [
"content_main_delegate.cc",
"content_main_delegate.h",
]
deps = [
":app_shared_sources",
"//content/app:child",
"//content/public/common",
]
}
# content_main_delegate.cc conditionally includes content_browser_client.h
# from //content/public/browser when it's not the child build. However,
# the header checker doesn't know this doesn't apply and throws an error.
# So all of these targets set check_includes = false.
#
# TODO(brettw) either teach the header checker to understand simple
# ifdefs or split the file apart so we can enable header checking here.
# Furthermore, since this file exists in more than one target, they all
# have to opt-out of header checking (a file is checked once for all
# targets using a source file).
source_set("both") {
# See comment in "child" target.
check_includes = false
sources = [
"content_main_delegate.cc",
"content_main_delegate.h",
]
deps = [
":app_shared_sources",
check_includes = false # See comment above.
sources = public_app_shared_sources
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:both",
"//content/public/browser",
"//content/public/common",
]
}
# TODO(GYP) enable chrome_multiple_dll support
is_chrome_multiple_dll = false
if (is_chrome_multiple_dll) {
source_set("browser") {
check_includes = false # See comment above.
sources = public_app_shared_sources
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:browser",
"//content/public/browser",
"//content/public/common",
]
}
source_set("child") {
check_includes = false # See comment above.
sources = public_app_shared_sources
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:child",
"//content/public/common",
]
}
} else {
# When the multi-DLL build is disabled, there is only one type of the
# "app" target, and "browser" and "child" are the same as "both".
group("browser") {
deps = [ ":both" ]
}
group("child") {
deps = [ ":both" ]
}
}
}
......@@ -5,6 +5,7 @@
import("//content/browser/browser.gni")
import("//build/config/ui.gni")
# See //content/BUILD.gn for how this works.
group("browser") {
if (is_component_build) {
deps = [ "//content" ]
......@@ -15,6 +16,8 @@ group("browser") {
}
source_set("browser_sources") {
visibility = [ "//content/*" ]
if (is_ios) {
# iOS doesn't get the normal file list and only takes these whitelisted
# files.
......@@ -40,7 +43,7 @@ source_set("browser_sources") {
deps = [
"//content/browser",
"//content/public/common",
"//content/public/common:common_sources",
"//net",
"//skia",
"//ui/accessibility",
......@@ -51,7 +54,8 @@ source_set("browser_sources") {
allow_circular_includes_from = [
# This target is a pair with content/browser. They always go together and
# include headers from each other.
"//content/browser",
# TODO(brettw) enable this when this permits non-dependent targets.
#"//content/browser",
]
# We expose skia headers in the public API.
......
......@@ -4,7 +4,19 @@
import("//content/child/child.gni")
source_set("child") {
# See //content/BUILD.gn for how this works.
group("child") {
if (is_component_build) {
deps = [ "//content" ]
} else {
deps = [ ":child_sources" ]
}
forward_dependent_configs_from = deps
}
source_set("child_sources") {
visibility = [ "//content/*" ]
sources = rebase_path(content_child_gypi_values.public_child_sources,
".", "//content")
......@@ -14,6 +26,6 @@ source_set("child") {
deps = [
"//content/child",
"//content/public/common",
"//content/public/common:common_sources",
]
}
......@@ -5,7 +5,19 @@
import("//build/config/features.gni")
import("//content/common/common.gni")
source_set("common") {
# See //content/BUILD.gn for how this works.
group("common") {
if (is_component_build) {
deps = [ "//content" ]
} else {
deps = [ ":common_sources" ]
}
forward_dependent_configs_from = deps
}
source_set("common_sources") {
visibility = [ "//content/*" ]
sources = rebase_path(content_common_gypi_values.public_common_sources,
".", "//content")
......
......@@ -2,7 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("plugin") {
# See //content/BUILD.gn for how this works.
group("plugin") {
if (is_component_build) {
deps = [ "//content" ]
} else {
deps = [ ":plugin_sources" ]
}
forward_dependent_configs_from = deps
}
source_set("plugin_sources") {
visibility = [ "//content/*" ]
sources = [
"content_plugin_client.h",
]
......@@ -10,6 +22,6 @@ source_set("plugin") {
deps = [
"//base",
"//content/plugin",
"//content/public/common",
"//content/public/common:common_sources",
]
}
......@@ -5,7 +5,19 @@
import("//build/config/features.gni")
import("//content/renderer/renderer.gni")
source_set("renderer") {
# See //content/BUILD.gn for how this works.
group("renderer") {
if (is_component_build) {
deps = [ "//content" ]
} else {
deps = [ ":renderer_sources" ]
}
forward_dependent_configs_from = deps
}
source_set("renderer_sources") {
visibility = [ "//content/*" ]
sources = rebase_path(content_renderer_gypi_values.public_renderer_sources,
".", "//content")
......@@ -14,7 +26,7 @@ source_set("renderer") {
]
deps = [
"//content/public/common",
"//content/public/common:common_sources",
"//content/renderer",
"//skia",
"//third_party/libjingle",
......@@ -27,7 +39,8 @@ source_set("renderer") {
allow_circular_includes_from = [
# This target is a pair with content/renderer. They always go together and
# include headers from each other.
"//content/renderer",
# TODO(brettw) enable this when this permits non-dependent targets.
#"//content/renderer",
]
if (enable_webrtc) {
......
......@@ -2,7 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("utility") {
# See //content/BUILD.gn for how this works.
group("utility") {
if (is_component_build) {
deps = [ "//content" ]
} else {
deps = [ ":utility_sources" ]
}
forward_dependent_configs_from = deps
}
source_set("utility_sources") {
visibility = [ "//content/*" ]
sources = [
"content_utility_client.cc",
"content_utility_client.h",
......@@ -15,7 +27,7 @@ source_set("utility") {
deps = [
"//base",
"//content:export",
"//content/public/common",
"//content/public/common:common_sources",
"//content/utility",
"//ipc",
]
......@@ -23,7 +35,8 @@ source_set("utility") {
allow_circular_includes_from = [
# This target is a pair with content/browser. They always go together and
# include headers from each other.
"//content/utility",
# TODO(brettw) enable this when this permits non-dependent targets.
#"//content/utility",
]
}
......@@ -7,8 +7,9 @@ import("//build/config/ui.gni")
import("//content/renderer/renderer.gni")
source_set("renderer") {
# Only targets in the content tree can depend directly on this target.
visibility = [ "//content/*" ]
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/renderer:renderer_sources" ]
sources = rebase_path(content_renderer_gypi_values.private_renderer_sources,
".", "//content")
......@@ -26,10 +27,9 @@ source_set("renderer") {
"//cc",
"//cc/blink",
"//content:resources",
"//content/public/child",
"//content/common:mojo_bindings",
"//content/public/child",
"//content/public/common",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
"//gin",
"//gpu",
"//jingle:jingle_glue",
......
......@@ -210,10 +210,10 @@ static_library("content_shell_lib") {
"//cc",
"//components/crash/app",
"//content:resources",
"//content/app:both",
"//content/app/resources",
"//content/app/strings",
"//content/gpu",
"//content/public/app:both",
"//content/public/browser",
"//content/public/common",
"//content/public/plugin",
......
......@@ -18,8 +18,8 @@ static_library("test_support") {
deps = [
"//cc/blink",
"//content/public/app:both",
"//content/public/browser",
"//content/public/common",
"//content/public/browser:browser_sources",
"//content/public/common:common_sources",
"//net:test_support",
"//skia",
"//storage/common",
......@@ -44,10 +44,10 @@ static_library("test_support") {
deps += [
"//content/browser/speech/proto",
"//content/child",
"//content/public/child:child_sources",
"//content/gpu",
"//content/public/renderer",
"//content/public/utility",
"//content/public/renderer:renderer_sources",
"//content/public/utility:utility_sources",
"//cc",
"//cc:test_support",
"//media",
......
......@@ -3,6 +3,10 @@
# found in the LICENSE file.
source_set("utility") {
# Only the public target should depend on this. All other targets (even
# internal content ones) should depend on the public one.
visibility = [ "//content/public/utility:utility_sources" ]
sources = [
"in_process_utility_thread.cc",
"in_process_utility_thread.h",
......@@ -16,8 +20,8 @@ source_set("utility") {
deps = [
"//base",
"//content:export",
"//content/public/child",
"//content/public/common",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
"//courgette:courgette_lib",
"//mojo/public/interfaces/application",
"//third_party/WebKit/public:blink_headers",
......
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