[email protected] | 7e4c3314 | 2014-05-21 22:01:32 | [diff] [blame] | 1 | # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
[email protected] | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 5 | import("//tools/grit/grit_rule.gni") |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 6 | import("//build/config/nacl/config.gni") |
[email protected] | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 7 | |
| 8 | # Applied by targets internal to content. |
| 9 | config("content_implementation") { |
| 10 | defines = [ "CONTENT_IMPLEMENTATION" ] |
| 11 | } |
| 12 | |
Brett Wilson | 8f132304 | 2014-09-11 16:58:56 | [diff] [blame] | 13 | # When targets depend on, e.g. //content/public/browser, what happens? To |
| 14 | # facilitate the complexity here, the "public" targets are groups that forward |
| 15 | # to the right thing depending on the build mode. Say for additional |
| 16 | # illustration, the public browser sources also depend on the public common |
| 17 | # ones. |
| 18 | # |
| 19 | # The non-component build is easy: |
| 20 | # foo -> |
| 21 | # //content/public/browser (group) -> |
| 22 | # //content/public/browser:browser_sources (source set) -> |
| 23 | # //content/browser (source set, this is the non-public browser target) |
| 24 | # //content/public/common:common_sources (source set) |
| 25 | # |
| 26 | # The component build is more complicated because we want everybody to depend on |
| 27 | # one content shared library regardless of which public target they depend on: |
| 28 | # foo -> |
| 29 | # //content/public/browser (group) -> |
| 30 | # //content (shared library) -> |
| 31 | # //content/public/browser:browser_sources (source set) -> |
| 32 | # //content/browser (source set; this is the non-public browser target) |
| 33 | # //content/public/common:common_sources (source set) |
| 34 | # |
| 35 | # That the internal content dependencies must depend on the *_sources targets |
| 36 | # to avoid dependency cycles, and external dependencies must depend on the |
| 37 | # //content/public/browser and similar targets to avoid double-linking (these |
| 38 | # targets make sure the dependency goes through the content shared library |
| 39 | # when doing a component build). |
brettw | b78fc9e | 2016-03-25 21:02:51 | [diff] [blame] | 40 | # |
| 41 | # TESTS |
| 42 | # ----- |
| 43 | # Tests are a challenge. The content tests need to access internals of |
| 44 | # content/browser, for example, but the tests themselves are outside of the |
| 45 | # content component (which is a shared library in the component build). To |
| 46 | # prevent external-to-content targets from depending on private headers, |
| 47 | # the non-public content/browser target is not a public dep of the content |
| 48 | # component. But this means there is also no public path for the content |
| 49 | # tests and no way to restrict that just to //content/test/* if we added one. |
| 50 | # |
| 51 | # As a result, we check deps for //content/test/* only in non-component builds |
| 52 | # (which should verify the dependencies are correct for both component and |
| 53 | # non-component cases equally). There are targets like |
| 54 | # //content/browser:for_content_tests that allow content/test to depend on the |
| 55 | # //content/browser target only in non-component builds (when there are no |
| 56 | # linking problems) for when check is enabled. |
Brett Wilson | 8f132304 | 2014-09-11 16:58:56 | [diff] [blame] | 57 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 58 | if (!is_nacl_nonsfi) { |
| 59 | content_shared_components = [ |
| 60 | "//content/gpu:gpu_sources", |
| 61 | "//content/public/browser:browser_sources", |
| 62 | "//content/public/child:child_sources", |
kcwu | 08377ad | 2016-02-18 19:12:42 | [diff] [blame] | 63 | "//content/public/gpu:gpu_sources", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 64 | "//content/public/common:common_sources", |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 65 | "//content/public/renderer:renderer_sources", |
| 66 | "//content/public/utility:utility_sources", |
| 67 | ] |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 68 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 69 | if (enable_plugins) { |
| 70 | content_shared_components += |
| 71 | [ "//content/ppapi_plugin:ppapi_plugin_sources" ] |
| 72 | } |
jamesr | 5008174 | 2014-09-09 07:52:22 | [diff] [blame] | 73 | } |
| 74 | |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 75 | if (is_component_build) { |
agrieve | 3f53232 | 2016-01-05 03:23:15 | [diff] [blame] | 76 | component("content") { |
scottmg | 7afc409 | 2014-12-03 19:22:42 | [diff] [blame] | 77 | public_deps = |
| 78 | content_shared_components + [ "//content/public/app:both_sources" ] |
brettw | ba7a73d | 2015-08-31 22:17:39 | [diff] [blame] | 79 | deps = [ |
| 80 | "//build/config/sanitizers:deps", |
| 81 | ] |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 82 | } |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 83 | } else if (is_nacl_nonsfi) { |
| 84 | source_set("content") { |
| 85 | set_sources_assignment_filter([]) |
| 86 | sources = [ |
| 87 | "common/sandbox_linux/sandbox_init_linux.cc", |
| 88 | "common/sandbox_linux/sandbox_seccomp_bpf_linux.cc", |
| 89 | "common/send_zygote_child_ping_linux.cc", |
| 90 | "public/common/content_switches.cc", |
| 91 | ] |
| 92 | set_sources_assignment_filter(sources_assignment_filter) |
| 93 | |
| 94 | defines = [ "USE_SECCOMP_BPF=1" ] |
| 95 | |
| 96 | deps = [ |
| 97 | "//base", |
| 98 | ] |
| 99 | } |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 100 | } else { |
| 101 | group("content") { |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 102 | public_deps = content_shared_components |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 103 | } |
| 104 | } |
| 105 | |
[email protected] | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 106 | grit("resources") { |
| 107 | source = "content_resources.grd" |
[email protected] | ae8d0898 | 2014-08-20 19:42:29 | [diff] [blame] | 108 | use_qualified_include = true |
[email protected] | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 109 | outputs = [ |
| 110 | "grit/content_resources.h", |
| 111 | "content_resources.pak", |
[email protected] | b89c5384 | 2014-07-23 16:32:32 | [diff] [blame] | 112 | ] |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 113 | grit_flags = [ |
| 114 | "-E", |
| 115 | "root_out_dir=" + rebase_path(root_out_dir, root_build_dir), |
| 116 | ] |
| 117 | deps = [ |
| 118 | "//content/public/app:browser_manifest", |
| 119 | "//content/public/app:renderer_manifest", |
ben | 7095d1a | 2016-04-13 06:14:58 | [diff] [blame^] | 120 | "//services/catalog:manifest", |
rockot | 00668f9 | 2016-04-07 18:56:23 | [diff] [blame] | 121 | ] |
[email protected] | 189add5 | 2014-05-28 16:51:44 | [diff] [blame] | 122 | } |
| 123 | |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 124 | # This target exists to "hold" the content_export header so we can do proper |
| 125 | # inclusion testing of it. |
| 126 | source_set("export") { |
brettw | b78fc9e | 2016-03-25 21:02:51 | [diff] [blame] | 127 | # Must only be used inside of content. |
brettw | 9af4262 | 2014-09-06 21:21:02 | [diff] [blame] | 128 | visibility = [ "//content/*" ] |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 129 | sources = [ |
tfarina | 9568fc6 | 2015-07-22 23:35:38 | [diff] [blame] | 130 | "common/content_export.h", |
[email protected] | dab154ee | 2014-06-13 23:48:50 | [diff] [blame] | 131 | ] |
| 132 | } |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 133 | |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 134 | # In the GYP build, this file is listed in several targets. In GN just have |
| 135 | # those targets depend on this one. This can be depended on for any |
| 136 | # platform for simplicity, and is a no-op on non-Windows. |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 137 | source_set("sandbox_helper_win") { |
brettw | 4f56c598 | 2015-05-04 22:12:39 | [diff] [blame] | 138 | if (is_win) { |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 139 | sources = [ |
pmonette | 18d3ed3 | 2015-10-16 21:06:06 | [diff] [blame] | 140 | "app/sandbox_helper_win.cc", |
| 141 | "public/app/sandbox_helper_win.h", |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 142 | ] |
| 143 | |
| 144 | deps = [ |
dpranke | db5527d7 | 2015-03-08 04:22:47 | [diff] [blame] | 145 | "//sandbox", |
| 146 | ] |
| 147 | } |
| 148 | } |